2022-11-27 18:42:29 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-04-13 00:36:02 +00:00
|
|
|
# @file Software Installation
|
2023-04-12 03:26:25 +00: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 17:46:53 +00:00
|
|
|
|
2022-12-25 08:30:40 +00:00
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
2022-12-06 05:22:15 +00:00
|
|
|
{{- $softwareGroup := nospace (cat "_" .host.softwareGroup) }}
|
2022-12-25 11:20:08 +00:00
|
|
|
{{- $softwareList := list (index .softwareGroups $softwareGroup | toString | replace "[" "" | replace "]" "") | uniq | join " " }}
|
2022-11-27 19:48:50 +00:00
|
|
|
|
2022-12-25 11:20:08 +00:00
|
|
|
# software: {{ $softwareList }}
|
2022-12-05 07:40:44 +00:00
|
|
|
# software map: {{ include (joinPath .chezmoi.homeDir ".local" "share" "chezmoi" "software.yml") | sha256sum }}
|
2022-11-27 18:42:29 +00:00
|
|
|
|
2022-11-30 09:21:36 +00:00
|
|
|
if command -v install-program > /dev/null; then
|
2022-11-28 01:34:41 +00:00
|
|
|
if command -v zx > /dev/null; then
|
2022-12-02 16:52:51 +00:00
|
|
|
logg info 'Installing packages defined in .chezmoidata.yaml under the .softwareGroups key'
|
2022-12-25 12:55:25 +00:00
|
|
|
logg info 'Installing: {{ $softwareList }}'
|
2022-12-02 17:29:41 +00:00
|
|
|
# Ask for the administrator password upfront
|
|
|
|
logg info 'A sudo password may be required for some of the installations'
|
2022-12-02 18:02:58 +00:00
|
|
|
sudo echo "Sudo access granted."
|
2022-12-25 11:44:42 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
export HOMEBREW_NO_ENV_HINTS=true
|
2023-01-04 05:39:50 +00:00
|
|
|
if ! command -v gcc-11; then
|
|
|
|
if command -v gcc; then
|
|
|
|
log info 'gcc-11 command missing. Symlinking to gcc'
|
|
|
|
sudo ln -s "$(which gcc)" /usr/local/bin/gcc-11
|
|
|
|
else
|
|
|
|
log warn 'gcc either needs to be added to the PATH or it is missing'
|
|
|
|
fi
|
|
|
|
fi
|
2023-01-09 08:46:18 +00:00
|
|
|
if [ -f "$HOME/.bashrc" ]; then
|
|
|
|
. "$HOME/.bashrc"
|
2023-01-30 08:44:16 +00:00
|
|
|
else
|
|
|
|
logg warn 'No ~/.bashrc file to import before running install-program'
|
2023-01-09 08:46:18 +00:00
|
|
|
fi
|
2023-01-05 09:39:30 +00:00
|
|
|
export LC_ALL="en_US.UTF-8"
|
2023-01-30 08:44:16 +00:00
|
|
|
logg info 'Printing environment variables for GO'
|
|
|
|
env | grep GO
|
2023-01-10 08:14:27 +00:00
|
|
|
install-program {{ $softwareList }}
|
2023-01-12 20:42:44 +00: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-28 01:34:41 +00:00
|
|
|
else
|
|
|
|
logg error '`zx` is not available'
|
|
|
|
fi
|
2022-11-27 18:42:29 +00:00
|
|
|
else
|
2022-11-30 09:21:36 +00:00
|
|
|
logg error '`install-program` is not in the PATH. It should be located in ~/.local/bin.'
|
2022-11-27 18:42:29 +00:00
|
|
|
fi
|