Update 44 files

- /home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.tmpl
- /home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl
- /home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl
- /home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl
- /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl
- /home/.chezmoiscripts/fedora/run_onchange_before_5-upgrade.tmpl
- /home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl
- /home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl
- /home/.chezmoiscripts/debian/run_onchange_before_14-warp.tmpl
- /home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl
- /home/.chezmoiscripts/ubuntu/run_onchange_before_14-warp.tmpl
- /home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_after_10-configure-macos.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_after_21-set-wallpaper.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.tmpl
- /home/.chezmoiscripts/windows/run_onchange_after_14-cleanup-windows
- /home/.chezmoiscripts/windows/run_onchange_before_10-install-windows-dependencies.tmpl
- /home/.chezmoiscripts/windows/run_onchange_before_11-install-windows-packages.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_after_11-set-wallpaper.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_11-update-timezone.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_13-install-official-templates.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_14-ensure-minimal-vms-passwordless.tmpl
- /home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.sh.tmpl
- /home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_01-requirements.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.sh.tmpl
- /home/.chezmoiscripts/linux/run_onchange_before_14-warp.sh.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_after_10-configure-macos.sh.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_after_20-ensure-zsh-macos.sh.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_after_21-set-wallpaper.sh.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.sh.tmpl
- /home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.sh.tmpl
- /home/.chezmoiscripts/windows/run_onchange_after_14-cleanup-windows.ps1
- /home/.chezmoiscripts/qubes/run_onchange_after_11-set-wallpaper.sh.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.sh.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_13-install-official-templates.sh.tmpl
- /home/.chezmoiscripts/qubes/run_onchange_before_14-ensure-minimal-vms-passwordless.sh.tmpl
This commit is contained in:
Brian Zalewski 2023-04-13 01:27:13 +00:00
parent abb0707047
commit 79078aa143
31 changed files with 354 additions and 341 deletions

View file

@ -1,5 +1,11 @@
{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file Logger Setup
# @brief Ensures environment variables are utilized and that logging functionality is available to Install Doctor
# @description
# This script pipes environment variables and a logger function to a temporary file that is included by other scripts.
# It is included as a temporary external file to aid in debugging since if the included files were inlined in scripts
# the scripts would be verbose when debugging.
### Ensure /tmp/tmp-profile is created
# Add pre-scaffolding profile to /tmp/tmp-profile so it's easier to navigate through scripts

View file

@ -1,5 +1,15 @@
{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file Homebrew / Xcode Tools Installation
# @brief Ensures Xcode tools are installed on macOS and ensures Homebrew is installed on either Linux or macOS
# @description
# This script ensures macOS has tools like `git` by installing the Xcode command-line developer tools if they are
# not already installed. Then, on both Linux and macOS, it ensures Homebrew is installed.
#
# ## Homebrew Requirement
#
# Install Doctor relies on Homebrew for many tools that are currently only available via Homebrew. Removing the dependency
# would be a nice-to-have but there are currently no plans for supporting systems without Homebrew installed.
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}

View file

@ -1,39 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# archlinux/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "archlinux" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "archlinux/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `pacman`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if pacman -Qs "$PACKAGE" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo pacman -Sy --noconfirm --needed "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via pacman'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
### Install yay
if ! command -v yay > /dev/null; then
logg info 'Cloning yay from `https://aur.archlinux.org/yay.git` to `/usr/local/src/yay`'
sudo git clone https://aur.archlinux.org/yay.git /usr/local/src/yay
cd /usr/local/src/yay
logg info 'Installing yay via `sudo makepkg -si`'
sudo makepkg -si
fi

View file

@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Source: https://www.linuxcapable.com/how-to-install-epel-on-centos-stream/
{{ includeTemplate "universal/logg-before" }}
### Upgrade system
logg info 'Upgrade system'
sudo dnf upgrade --refresh -y
### Enable CRB
logg info 'Ensure the CRB repository is activated'
sudo dnf config-manager --set-enabled crb
### Add EPEL
if ! dnf repolist | grep 'epel ' > /dev/null; then
logg info 'Adding the EPEL repository'
sudo dnf install -y "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${VERSION}.noarch.rpm"
fi
### Add EPEL Next
if ! dnf repolist | grep 'epel-next' > /dev/null; then
logg info 'Adding the EPEL Next repository'
sudo dnf install -y "https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-${VERSION}.noarch.rpm"
else
logg info 'EPEL Next repository already enabled (EPEL compatibility for CentOS)'
fi

View file

@ -1,37 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# centos/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "centos" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "centos/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Detect package manager
if command -v dnf > /dev/null; then
PKG_MANAGER='dnf'
else
PKG_MANAGER='yum'
fi
### Print dependency list
logg 'Installing common dependencies using `'"$PKG_MANAGER"'`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "^$PACKAGE-" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo "$PKG_MANAGER" install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via `'"$PKG_MANAGER"'`'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -1,4 +1,9 @@
#!/usr/bin/env bash
# @file macOS System Settings
# @brief Applies an optimized set of macOS system configurations intended to provide more sensible system defaults
# @description
# This script houses a wide range of macOS system tweaks that are intended to improve the developer experience on macOS,
# as well as improve security. Some of the tweaks include modifying default settings for various applications.
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}

View file

@ -1,4 +1,10 @@
#!/usr/bin/env bash
# @file macOS Ensure ZSH Default Shell
# @brief Ensures ZSH is configured to be used as the default command-line shell
# @description
# This script ensures ZSH is used as the default shell by ensuring it is added to `/etc/shells`. The script
# also ensures ZSH is available at `/usr/local/bin/zsh` on ARM64 systems by symlinking the Homebrew ZSH shell
# to `/usr/local/bin/zsh` if it is missing.
{{ includeTemplate "universal/logg" }}

View file

@ -1,4 +1,9 @@
#!/usr/bin/env bash
# @file macOS Set Wallpaper
# @brief Ensures the macOS wallpaper is set to the Betelgeuse wallpaper for macOS.
# @description
# This script ensures the macOS desktop wallpaper is set to the macOS Betelgeuse wallpaper. It uses the
# `m` CLI to apply the change.
# Betelgeuse-macOS wallpaper hash: {{ include (joinPath .chezmoi.homeDir ".local" "src" "betelgeuse" "share" "wallpapers" "Betelgeuse-macOS" "contents" "source.png") | sha256sum }}

View file

@ -1,4 +1,9 @@
#!/usr/bin/env bash
# @file macOS Common Dependencies
# @brief Ensures common system dependencies are installed via Homebrew on macOS
# @description
# This script ensures packages that are commonly used by other packages or needed by Install Doctor, are installed
# via Homebrew. The list of packages is defined in `home/.chezmoitemplates/darwin/Brewfile`.
# darwin/Brewfile hash: {{ include (joinPath ".chezmoitemplates" "darwin" "Brewfile") | sha256sum }}

View file

@ -1,4 +1,8 @@
#!/usr/bin/env bash
# @file macOS Ensure User Group
# @brief Ensures that the provisioning user has a group on the system with the same name
# @description
# This script ensures that there is a group with the same name of the provisioning user available on the system.
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}

View file

@ -1,40 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# debian/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "debian" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "debian/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `apt-get`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Update apt-get cache
logg info 'Running `sudo apt-get update`'
sudo apt-get update
### Update debconf for non-interactive installation
if command -v dpkg-reconfigure > /dev/null; then
logg info 'Running sudo dpkg-reconfigure debconf -f noninteractive -p critical'
sudo dpkg-reconfigure debconf -f noninteractive -p critical
fi
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if dpkg -l "$PACKAGE" | grep -E '^ii' > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -1,14 +0,0 @@
#!/usr/bin/env bash
{{ includeTemplate "universal/logg-before" }}
### Add CloudFlare WARP desktop app apt-get source
if [ ! -f /etc/apt/sources.list.d/cloudflare-client.list ]; then
logg info 'Adding CloudFlare WARP keyring'
curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
logg info 'Adding apt source reference'
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update
fi

View file

@ -1,30 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# fedora/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "fedora" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "fedora/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `dnf`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "^$PACKAGE-" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo dnf install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via dnf'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -1,31 +0,0 @@
#!/usr/bin/env bash
{{ includeTemplate "universal/logg-before" }}
### Upgrade system
logg info 'Upgrade system'
sudo dnf upgrade --refresh -y
# https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/
# TODO - Optional: Look into using Fedora's upgrade system described in the link above
# sudo dnf install dnf-plugin-system-upgrade
### Add RPM Fusion Free repository
if ! dnf repolist | grep 'rpmfusion-free' > /dev/null; then
logg info 'Adding RPM-Fusion Free repository for Fedora'
sudo dnf install -y "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm"
fi
### Add RPM Fusion Non-Free repository
if ! dnf repolist | grep 'rpmfusion-nonfree' > /dev/null; then
logg info 'Adding RPM-Fusion Non-Free repository for Fedora'
sudo dnf install -y "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
fi
### Add Appstream data from the RPM Fusion repositories
if command -v gnome-shell > /dev/null; then
logg info 'Adding Appstream data from the RPM-Fusion repositories'
sudo dnf group update -y core
else
logg warn 'Skipping installation of Appstream data because GNOME is not installed'
fi

View file

@ -1,25 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# freebsd/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "freebsd" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "freebsd/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `pkg`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install base dependencies
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Installing `'"$PACKAGE"'`'
sudo pkg install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via zypper'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
done

View file

@ -0,0 +1,240 @@
#!/usr/bin/env bash
# @file Linux Required Dependencies
# @brief Ensures commonly used system packages that are common dependencies of other packages are installed
# @description
# This script installs required system packages. Each system's required packages are defined in `home/.chezmoitemplates/$DISTRO_ID`,
# where `$DISTRO_ID` is equal to the Linux distribution ID found in `/etc/os-release`.
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# {{ .host.distro.id }}/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" .host.distro.id "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate join (.host.distro.id "/common-dependencies" .)) -}}
{{- $packages = concat $packages $additionalPackages -}}
if [ '{{ .host.distro.id }}' = 'archlinux' ]; then
### Print dependency list
logg 'Installing common dependencies using `pacman`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if pacman -Qs "$PACKAGE" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo pacman -Sy --noconfirm --needed "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via pacman'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
### Install yay
if ! command -v yay > /dev/null; then
logg info 'Cloning yay from `https://aur.archlinux.org/yay.git` to `/usr/local/src/yay`'
sudo git clone https://aur.archlinux.org/yay.git /usr/local/src/yay
cd /usr/local/src/yay
logg info 'Installing yay via `sudo makepkg -si`'
sudo makepkg -si
fi
elif [ '{{ .host.distro.id }}' = 'centos' ]; then
### Upgrade system
logg info 'Upgrade system'
sudo dnf upgrade --refresh -y
### Enable CRB
logg info 'Ensure the CRB repository is activated'
sudo dnf config-manager --set-enabled crb
### Add EPEL
if ! dnf repolist | grep 'epel ' > /dev/null; then
logg info 'Adding the EPEL repository'
sudo dnf install -y "https://dl.fedoraproject.org/pub/epel/epel-release-latest-${VERSION}.noarch.rpm"
fi
### Add EPEL Next
if ! dnf repolist | grep 'epel-next' > /dev/null; then
logg info 'Adding the EPEL Next repository'
sudo dnf install -y "https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-${VERSION}.noarch.rpm"
else
logg info 'EPEL Next repository already enabled (EPEL compatibility for CentOS)'
fi
### Detect package manager
if command -v dnf > /dev/null; then
PKG_MANAGER='dnf'
else
PKG_MANAGER='yum'
fi
### Print dependency list
logg 'Installing common dependencies using `'"$PKG_MANAGER"'`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "^$PACKAGE-" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo "$PKG_MANAGER" install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via `'"$PKG_MANAGER"'`'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
elif [ '{{ .host.distro.id }}' = 'debian' ]; then
### Print dependency list
logg 'Installing common dependencies using `apt-get`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Update apt-get cache
logg info 'Running `sudo apt-get update`'
sudo apt-get update
### Update debconf for non-interactive installation
if command -v dpkg-reconfigure > /dev/null; then
logg info 'Running sudo dpkg-reconfigure debconf -f noninteractive -p critical'
sudo dpkg-reconfigure debconf -f noninteractive -p critical
fi
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if dpkg -l "$PACKAGE" | grep -E '^ii' > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
elif [ '{{ .host.distro.id }}' = 'fedora' ]; then
### Upgrade system
logg info 'Upgrade system'
sudo dnf upgrade --refresh -y
# https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/
# TODO - Optional: Look into using Fedora's upgrade system described in the link above
# sudo dnf install dnf-plugin-system-upgrade
### Add RPM Fusion Free repository
if ! dnf repolist | grep 'rpmfusion-free' > /dev/null; then
logg info 'Adding RPM-Fusion Free repository for Fedora'
sudo dnf install -y "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm"
fi
### Add RPM Fusion Non-Free repository
if ! dnf repolist | grep 'rpmfusion-nonfree' > /dev/null; then
logg info 'Adding RPM-Fusion Non-Free repository for Fedora'
sudo dnf install -y "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
fi
### Add Appstream data from the RPM Fusion repositories
if command -v gnome-shell > /dev/null; then
logg info 'Adding Appstream data from the RPM-Fusion repositories'
sudo dnf group update -y core
else
logg warn 'Skipping installation of Appstream data because GNOME is not installed'
fi
### Print dependency list
logg 'Installing common dependencies using `dnf`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "^$PACKAGE-" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo dnf install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via dnf'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
elif [ '{{ .host.distro.id }}' = 'freebsd' ]; then
### Print dependency list
logg 'Installing common dependencies using `pkg`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install base dependencies
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Installing `'"$PACKAGE"'`'
sudo pkg install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via zypper'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
done
elif [ '{{ .host.distro.id }}' = 'opensuse' ]; then
### Print dependency list
logg 'Installing common dependencies using `zypper`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install base_devel
logg info 'Installing base_devel pattern with `sudo zypper install -t pattern devel_basis`'
sudo zypper install -t pattern devel_basis
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "$PACKAGE" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo zypper install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via zypper'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
elif [ '{{ .host.distro.id }}' = 'ubuntu' ]; then
### Print dependency list
logg 'Installing common dependencies using `apt-get`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Update apt-get cache
logg info 'Running `sudo apt-get update`'
sudo apt-get update
### Update debconf for non-interactive installation
if command -v dpkg-reconfigure > /dev/null; then
logg info 'Running sudo dpkg-reconfigure debconf -f noninteractive -p critical'
sudo dpkg-reconfigure debconf -f noninteractive -p critical
fi
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if dpkg -l "$PACKAGE" | grep -E '^ii' > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done
fi

View file

@ -1,4 +1,8 @@
#!/usr/bin/env bash
# @file Linux System Tweaks
# @brief Applies a set of generic Linux system tweaks such as ensuring the hostname is set, setting the timezone, and more
# @description
# This script applies generic Linux system tweaks that should be made before the rest of the provisioning process.
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}

View file

@ -1,5 +1,17 @@
#!/usr/bin/env bash
# TODO - make equivalent to https://gitlab.com/megabyte-labs/gas-station/-/blob/master/roles/system/common/tasks/linux/swap.yml
# @file Linux Swap
# @brief Determines the ideal size `/swapfile`, ensures it exists, and then enables it on Linux systems
# @description
# This script determines the ideal `/swapfile` size by checking how much RAM is available on the system.
# It then creates the appropriate `/swapfile` by considering factors such as the file system type. It
# currently supports BTRFS and regular file systems.
#
# After the `/swapfile` is created, it is enabled and assigned the appropriate permissions.
#
# ## TODO
#
# * Add logic that creates a swapfile for ZFS-based systems
# * Integrate logic from https://gitlab.com/megabyte-labs/gas-station/-/blob/master/roles/system/common/tasks/linux/swap.yml
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}

View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# @file CloudFlare WARP Repository
# @brief Adds the CloudFlare WARP `apt-get` repository to Debian and Ubuntu systems
# @description
# This script adds the CloudFlare WARP `apt-get` repository to Debian and Ubuntu systems. It currently does not support adding
# repositories for other systems because they are not provided by CloudFlare.
{{ includeTemplate "universal/logg-before" }}
if [ '{{ .host.distro.id }}' = 'debian' ]; then
### Add CloudFlare WARP desktop app apt-get source
if [ ! -f /etc/apt/sources.list.d/cloudflare-client.list ]; then
logg info 'Adding CloudFlare WARP keyring'
curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
logg info 'Adding apt source reference'
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update
fi
elif [ '{{ .host.distro.id }}' = 'ubuntu' ]; then
### Add CloudFlare WARP desktop app apt-get source
if [ ! -f /etc/apt/sources.list.d/cloudflare-client.list ]; then
logg info 'Adding CloudFlare WARP keyring'
curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
logg info 'Adding apt source reference'
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update
fi
fi

View file

@ -1,34 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# opensuse/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "opensuse" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "opensuse/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `zypper`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Install base_devel
logg info 'Installing base_devel pattern with `sudo zypper install -t pattern devel_basis`'
sudo zypper install -t pattern devel_basis
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if rpm -qa | grep "$PACKAGE" > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo zypper install -y "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via zypper'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
# @file Qubes Set Wallpaper
# @brief Ensures the Qubes wallpaper is set to the Betelgeuse wallpaper for Qubes.
# @description
# This script ensures the Qubes desktop wallpaper is set to the Qubes Betelgeuse wallpaper on KDE by
# using the `ksetwallpaper` script found in `~/.local/bin/ksetwallpaper`.
ksetwallpaper --file /usr/local/share/wallpapers/Betelgeuse/contents/images/3440x1440.jpg

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
ksetwallpaper --file /usr/local/share/wallpapers/Betelgeuse/contents/images/3440x1440.jpg

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
### Update timezone
logg info "Setting timezone to {{ .user.timezone }}"
timedatectl set-timezone {{ .user.timezone }}

View file

@ -1,4 +1,11 @@
#!/usr/bin/env bash
# @file Qubes Update dom0
# @brief Ensures Qubes dom0 is up-to-date, includes all the Qubes repository definitions, and that `sys-whonix` is running
# @description
# This script begins with ensuring Qubes dom0 is up-to-date by including developer-channel Qubes repository definitions are available.
# It then ensures Qubes dom0 is up-to-date using a combination of several methods including the recommended Salt-based
# update script. After dom0 is updated, it installs the packages defined in `.qubes.dom0Packages` which is defined in the
# `home/.chezmoidata.yaml` file. It also ensures `sys-whonix` is running if it is not already running.
# qubes-templates.repo hash: {{ include (joinPath .chezmoi.homeDir ".config" "qubes" "qubes-templates.repo") | sha256sum }}
# qubes-dom0.repo hash: {{ include (joinPath .chezmoi.homeDir ".config" "qubes" "qubes-dom0.repo") | sha256sum }}

View file

@ -1,4 +1,8 @@
#!/usr/bin/env bash
# @file Qubes Install Templates
# @brief Ensures the templates defined in `.qubes.templates` in the `home/.chezmoidata.yaml` file are installed
# @description
# This script runs in dom0 and ensures the templates defined in `home/.chezmoidata.yaml` are all installed.
### Ensure Qubes templates exist and download if they are not present
for TEMPLATE of {{ .qubes.templates | toString | replace "[" "" | replace "]" "" }}; do

View file

@ -1,4 +1,9 @@
#!/usr/bin/env bash
# @file Qubes Passwordless Templates
# @brief Ensures the minimal templates defined in `.qubes.templates` in the `home/.chezmoidata.yaml` file are configured to be passwordless
# @description
# This script runs in dom0 and ensures the templates defined in the `.qubes.templates` data key of `home/.chezmoidata.yaml` all have
# the `qubes-core-agent-passwordless-root` package installed so that they can be provisioned headlessly.
### Ensure Qubes minimal templates have passwordless sudo
for TEMPLATE of {{ .qubes.templates | toString | replace "[" "" | replace "]" "" }}; do

View file

@ -1,40 +0,0 @@
#!/usr/bin/env bash
# universal/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "universal" "common-dependencies") | sha256sum }}
# ubuntu/common-dependencies hash: {{ include (joinPath ".chezmoitemplates" "ubuntu" "common-dependencies") | sha256sum }}
{{ includeTemplate "universal/logg-before" }}
{{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}}
{{- $additionalPackages := splitList " " (includeTemplate "ubuntu/common-dependencies" .) -}}
{{- $packages = concat $packages $additionalPackages -}}
### Print dependency list
logg 'Installing common dependencies using `apt-get`'
logg info 'Dependencies: {{ $packages | sortAlpha | uniq | join " " -}}'
### Update apt-get cache
logg info 'Running `sudo apt-get update`'
sudo apt-get update
### Update debconf for non-interactive installation
if command -v dpkg-reconfigure > /dev/null; then
logg info 'Running sudo dpkg-reconfigure debconf -f noninteractive -p critical'
sudo dpkg-reconfigure debconf -f noninteractive -p critical
fi
### Install packages if they are not already present
for PACKAGE in {{ $packages | sortAlpha | uniq | join " " -}}; do
logg info 'Checking for presence of `'"$PACKAGE"'`'
if dpkg -l "$PACKAGE" | grep -E '^ii' > /dev/null; then
logg info 'The '"$PACKAGE"' package is already installed'
else
logg info 'Installing `'"$PACKAGE"'`'
sudo apt-get install -y --no-install-recommends "$PACKAGE" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
logg error 'Error installing `'"$PACKAGE"'` via apt-get'
logg info 'Proceeding with installation..'
unset EXIT_CODE
fi
fi
done

View file

@ -1,14 +0,0 @@
#!/usr/bin/env bash
{{ includeTemplate "universal/logg-before" }}
### Add CloudFlare WARP desktop app apt-get source
if [ ! -f /etc/apt/sources.list.d/cloudflare-client.list ]; then
logg info 'Adding CloudFlare WARP keyring'
curl https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
logg info 'Adding apt source reference'
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list
sudo apt-get update
fi