2022-11-27 10:42:29 -08:00
|
|
|
#!/usr/bin/env bash
|
2023-04-12 17:36:02 -07:00
|
|
|
# @file Software Installation
|
2023-04-11 20:26:25 -07:00
|
|
|
# @brief Installs the list of software that correlates to the software group that was chosen.
|
|
|
|
# @description
|
|
|
|
# This script initializes the installation process that handles the bulk of the software package installations.
|
Update dotfiles/.config/age/run_once_before_decrypt-private-key.sh.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoi.yaml.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiexternal.toml, dotfiles/.local/share/chezmoi/home/.chezmoitemplates/darwin/Brewfile, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/ubuntu/run_onchange_before_10_install-ubuntu-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/archlinux/run_onchange_before_10_install-archlinux-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_90-install-packages.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_91-configure-gpg.tmpl, dotfiles/.local/share/chezmoi/home/.chezmoidata.yml
2022-11-27 09:46:53 -08:00
|
|
|
|
2022-12-25 00:30:40 -08:00
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
2023-11-04 20:56:58 -07:00
|
|
|
|
2022-12-05 21:22:15 -08:00
|
|
|
{{- $softwareGroup := nospace (cat "_" .host.softwareGroup) }}
|
2022-12-25 03:20:08 -08:00
|
|
|
{{- $softwareList := list (index .softwareGroups $softwareGroup | toString | replace "[" "" | replace "]" "") | uniq | join " " }}
|
2022-11-27 11:48:50 -08:00
|
|
|
|
2022-12-25 03:20:08 -08:00
|
|
|
# software: {{ $softwareList }}
|
2022-12-04 23:40:44 -08:00
|
|
|
# software map: {{ include (joinPath .chezmoi.homeDir ".local" "share" "chezmoi" "software.yml") | sha256sum }}
|
2022-11-27 10:42:29 -08:00
|
|
|
|
2022-11-30 01:21:36 -08:00
|
|
|
if command -v install-program > /dev/null; then
|
2022-11-27 17:34:41 -08:00
|
|
|
if command -v zx > /dev/null; then
|
2022-12-02 08:52:51 -08:00
|
|
|
logg info 'Installing packages defined in .chezmoidata.yaml under the .softwareGroups key'
|
2022-12-25 04:55:25 -08:00
|
|
|
logg info 'Installing: {{ $softwareList }}'
|
2022-12-02 09:29:41 -08:00
|
|
|
# Ask for the administrator password upfront
|
|
|
|
logg info 'A sudo password may be required for some of the installations'
|
2022-12-02 10:02:58 -08:00
|
|
|
sudo echo "Sudo access granted."
|
2022-12-25 03:44:42 -08:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
export HOMEBREW_NO_ENV_HINTS=true
|
2023-07-10 22:05:07 -07:00
|
|
|
export HOMEBREW_NO_ANALYTICS=1
|
2023-01-03 21:39:50 -08:00
|
|
|
if ! command -v gcc-11; then
|
|
|
|
if command -v gcc; then
|
2023-11-04 20:19:29 -07:00
|
|
|
logg info 'gcc-11 command missing. Symlinking to gcc'
|
2023-01-03 21:39:50 -08:00
|
|
|
sudo ln -s "$(which gcc)" /usr/local/bin/gcc-11
|
|
|
|
else
|
2023-11-04 20:19:29 -07:00
|
|
|
logg warn 'gcc either needs to be added to the PATH or it is missing'
|
2023-01-03 21:39:50 -08:00
|
|
|
fi
|
|
|
|
fi
|
2023-01-09 00:46:18 -08:00
|
|
|
if [ -f "$HOME/.bashrc" ]; then
|
|
|
|
. "$HOME/.bashrc"
|
2023-01-30 00:44:16 -08:00
|
|
|
else
|
|
|
|
logg warn 'No ~/.bashrc file to import before running install-program'
|
2023-01-09 00:46:18 -08:00
|
|
|
fi
|
2023-01-05 01:39:30 -08:00
|
|
|
export LC_ALL="en_US.UTF-8"
|
2023-01-30 00:44:16 -08:00
|
|
|
logg info 'Printing environment variables for GO'
|
|
|
|
env | grep GO
|
2023-07-18 11:27:07 -07:00
|
|
|
logg info 'Printing environment variables for Java'
|
|
|
|
env | grep JAVA
|
|
|
|
env | grep SDKMAN
|
|
|
|
env | grep ASDF
|
2023-11-27 09:07:24 -08:00
|
|
|
if ! command -v unbuffer > /dev/null; then
|
|
|
|
if command -v brew > /dev/null; then
|
2023-11-29 23:52:35 -08:00
|
|
|
logg info 'Ensuring expect is installed for the unbuffer command' && brew install --quiet expect
|
2023-11-27 09:07:24 -08:00
|
|
|
fi
|
|
|
|
fi
|
2023-11-06 21:42:06 -08:00
|
|
|
if command -v unbuffer > /dev/null; then
|
2023-11-27 09:07:24 -08:00
|
|
|
logg info 'Running unbuffer install-program'
|
2023-11-06 21:42:06 -08:00
|
|
|
unbuffer install-program {{ $softwareList }}
|
|
|
|
else
|
2023-11-27 09:07:24 -08:00
|
|
|
logg info 'Running install-program without unbuffer'
|
2023-11-06 21:42:06 -08:00
|
|
|
install-program {{ $softwareList }}
|
|
|
|
fi
|
2023-01-12 12:42:44 -08:00
|
|
|
# TODO - Figure out how to configure no logs to print to ~/.ansible.log -- should be printing to the value specified in the ansible.cfg
|
|
|
|
rm -rf "$HOME/.ansible.log"
|
2022-11-27 17:34:41 -08:00
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg error 'zx is not available'
|
2022-11-27 17:34:41 -08:00
|
|
|
fi
|
2022-11-27 10:42:29 -08:00
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg error 'install-program is not in the PATH. It should be located in ~/.local/bin.'
|
2022-11-27 10:42:29 -08:00
|
|
|
fi
|