From 0ce5a3c77b0830ccab6046b975382830f5e7d951 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 12 Apr 2023 03:57:02 +0000 Subject: [PATCH] Update 21 files - /home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.sh.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.sh.tmpl --- ...nchange_after_85-remove-shortcuts.sh.tmpl} | 5 ++++ ... => run_onchange_after_94-bash-it.sh.tmpl} | 5 ++++ ...nge_after_95-bootstrap-zsh-plugins.sh.tmpl | 20 ++++++++++++++++ ...change_after_95-bootstrap-zsh-plugins.tmpl | 14 ----------- ... => run_onchange_after_98-cleanup.sh.tmpl} | 5 ++++ ...un_onchange_after_99-restart-gnome.sh.tmpl | 24 +++++++++++++++++++ .../run_onchange_after_99-restart-gnome.tmpl | 13 ---------- ...run_onchange_before_08-install-zx.sh.tmpl} | 11 +++++++++ .../run_onchange_before_09-install-go.tmpl | 4 ++++ ...n_onchange_before_09-node-version.sh.tmpl} | 5 ++++ ...change_before_10-remove-bloatware.sh.tmpl} | 5 ++++ ...onchange_before_11-install-docker.sh.tmpl} | 11 +++++++++ ..._onchange_before_91-configure-gpg.sh.tmpl} | 6 +++++ 13 files changed, 101 insertions(+), 27 deletions(-) rename home/.chezmoiscripts/universal/{run_onchange_after_85-remove-shortcuts.tmpl => run_onchange_after_85-remove-shortcuts.sh.tmpl} (71%) rename home/.chezmoiscripts/universal/{run_onchange_after_94-bash-it.tmpl => run_onchange_after_94-bash-it.sh.tmpl} (81%) create mode 100644 home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.sh.tmpl delete mode 100644 home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.tmpl rename home/.chezmoiscripts/universal/{run_onchange_after_98-cleanup.tmpl => run_onchange_after_98-cleanup.sh.tmpl} (76%) create mode 100644 home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.sh.tmpl delete mode 100644 home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.tmpl rename home/.chezmoiscripts/universal/{run_onchange_before_08-install-zx.tmpl => run_onchange_before_08-install-zx.sh.tmpl} (68%) rename home/.chezmoiscripts/universal/{run_onchange_before_09-node-version.tmpl => run_onchange_before_09-node-version.sh.tmpl} (73%) rename home/.chezmoiscripts/universal/{run_onchange_before_10-remove-bloatware.tmpl => run_onchange_before_10-remove-bloatware.sh.tmpl} (81%) rename home/.chezmoiscripts/universal/{run_onchange_before_11-install-docker.tmpl => run_onchange_before_11-install-docker.sh.tmpl} (90%) rename home/.chezmoiscripts/universal/{run_onchange_before_91-configure-gpg.tmpl => run_onchange_before_91-configure-gpg.sh.tmpl} (82%) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.sh.tmpl similarity index 71% rename from home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.tmpl rename to home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.sh.tmpl index f9a796d9..f21ff46c 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_85-remove-shortcuts.sh.tmpl @@ -1,5 +1,10 @@ {{- if eq .host.distro.family "linux" -}} #!/usr/bin/env bash +# @file Linux Shortcut Removal +# @brief Cleans up desktop shortcuts that are out of place or unwanted on Linux devices +# @description +# This script loops through the `.removeLinuxShortcuts` value in `home/.chezmoidata.yaml` and removes +# desktop shortcuts that have been deemed to be unnecessary or obtrusive. {{ $removeShortcuts := join " " .removeLinuxShortcuts }} # shortcuts to remove: {{ $removeShortcuts }} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl similarity index 81% rename from home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.tmpl rename to home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl index 5aff3f58..9eca1f58 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl @@ -1,5 +1,10 @@ {{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env -S bash -i +# @file Bash It! +# @brief Ensures Bash is configured to use Bash It! +# @description +# This script ensures Bash is configured to use Bash It! It ensures dependencies are installed, installs completions, +# and enables Bash It! plugins. The completions and plugins are hardcoded in this script. {{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/logg" }} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.sh.tmpl new file mode 100644 index 00000000..9469c9b7 --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.sh.tmpl @@ -0,0 +1,20 @@ +{{- if (eq .host.headless true) }} +#!/usr/bin/env bash +# @file ZSH Pre-Initialization +# @brief Ensures ZSH is pre-initialized by invoking ZSH and allowing it to perform "first-run" tasks +# @description +# This script ensures that the first time you open a ZSH terminal session everything is loaded as fast as possible. +# It does this by invoking ZSH in the background during the provisioning process so that "first-run" tasks such +# as cache-building are handled ahead of time. + +# .zshrc hash: {{ include (joinPath .chezmoi.homeDir ".zshrc")| sha256sum }} + +{{ includeTemplate "universal/profile" }} +{{ includeTemplate "universal/logg" }} + +### Initialize ZSH so plugin bootstrap process is done ahead of time +if command -v zsh > /dev/null; then + logg info 'Bootstrapping ZSH by running `exec zsh && exit 0`' + exec zsh && exit 0 +fi +{{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.tmpl deleted file mode 100644 index 74f069d2..00000000 --- a/home/.chezmoiscripts/universal/run_onchange_after_95-bootstrap-zsh-plugins.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -{{- if (eq .host.headless true) }} - -# .zshrc hash: {{ include (joinPath .chezmoi.homeDir ".zshrc")| sha256sum }} - -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} - -### Initialize ZSH so plugin bootstrap process is done ahead of time -if command -v zsh > /dev/null; then - logg info 'Bootstrapping ZSH by running `exec zsh && exit 0`' - exec zsh && exit 0 -fi -{{ end }} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.sh.tmpl similarity index 76% rename from home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.tmpl rename to home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.sh.tmpl index 55c5dd73..aa0e1e25 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_98-cleanup.sh.tmpl @@ -1,4 +1,9 @@ #!/usr/bin/env bash +# @file Miscellaneous Clean Up +# @brief Removes certain files that should not be necessary +# @description +# This script removes various files in the `HOME` directory that are either no longer necessary +# or cluttery. ### Remove meta sudo file if [ -f "$HOME/.sudo_as_admin_successful" ]; then diff --git a/home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.sh.tmpl new file mode 100644 index 00000000..8308a7d3 --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.sh.tmpl @@ -0,0 +1,24 @@ +{{- if eq .host.distro.family "linux" -}} +#!/usr/bin/env bash +# @file GNOME Restart +# @brief Reloads `gnome-shell` so that the theme is properly loaded +# @description +# This script reloads the `gnome-shell` so that the theme is properly loaded without having to reboot. This +# only runs when the `HEADLESS_INSTALL` variable is passed because, unless you are provisioning the session headlessly, +# you probably want to retain the terminal window that initialized the provisioning process since it contains +# all the logs. +# +# ## Logs +# +# Regardless of whether or not this script runs, you can access the provisioning logs by browsing through +# `${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log` + +### Restart GNOME if `HEADLESS_INSTALL` is defined and `gnome-shell` is available +if [ -n "$HEADLESS_INSTALL" ] && command -v gnome-shell > /dev/null; then + logg info 'Reloading `gnome-shell`' + killall -3 gnome-shell +else + logg info 'Manually reload `gnome-shell`' +fi + +{{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.tmpl deleted file mode 100644 index b9d6c8b2..00000000 --- a/home/.chezmoiscripts/universal/run_onchange_after_99-restart-gnome.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -{{- if eq .host.distro.family "linux" -}} -#!/usr/bin/env bash - -### Restart GNOME -if command -v gnome-shell > /dev/null; then - logg info 'Manually reload `gnome-shell`' - # logg info 'Reloading `gnome-shell`' - # killall -3 gnome-shell - # Disabled because it causes the terminal window with the logs to close - # If you don't mind this, you can enable (logs are still stored at "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log") -fi - -{{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl similarity index 68% rename from home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl index d5959c6e..d4547446 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl @@ -1,5 +1,16 @@ {{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env bash +# @file Node.js / Volta / ZX Install +# @brief Ensures Node.js, Volta, and ZX are installed prior to Chezmoi applying the dotfile state. +# @description +# This script ensures required dependencies are installed. These dependencies include: +# +# 1. **[Node.js](https://nodejs.org/en)**: JavaScript runtime engine which is installed to ensure any user with Homebrew configured can access Node.js +# 2. **[Volta](https://volta.sh/)**: Node.js version manager that provides the capability of automatically using `package.json` defined Node.js versions +# 3. **[ZX](https://github.com/google/zx)**: Used for the script that installs the software packages on any OS +# +# The Volta setup process will ensure that the user is configured to use the latest Node.js version, by default. It then +# also ensures the user's `~/.bashrc` and `~/.zshrc` profiles are setup for use with Volta. {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl index 42402399..eaa9deba 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl @@ -1,5 +1,9 @@ {{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env bash +# @file Go Install +# @brief Ensures Go is installed via Homebrew +# @description +# This script ensures Go is installed. It uses Homebrew to install Go. {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl similarity index 73% rename from home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl index 68dea913..dbe3cae1 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl @@ -1,5 +1,10 @@ {{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env bash +# @file Node.js Version +# @brief Ensures a recent version of Node.js is available to the user by leveraging Volta +# @description +# This script installs the latest version of Node.js with Volta if the default Node.js version +# is an outdated version. # Node.js version: {{ output "node" "--version" }} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.sh.tmpl similarity index 81% rename from home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.sh.tmpl index c67f1d55..1c0b1dd4 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.sh.tmpl @@ -1,5 +1,10 @@ {{- if eq .host.distro.family "linux" -}} #!/usr/bin/env bash +# @file Linux Bloatware Removal +# @brief Removes Linux bloatware defined in `.removeLinuxPackages` of the `home/.chezmoidata.yaml` file +# @description +# This script removes some of the software deemed to be "bloatware" by cycling through the values defined in +# `.removeLinuxPackages` of the `home/.chezmoidata.yaml` file. {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.sh.tmpl similarity index 90% rename from home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.sh.tmpl index 4c80960c..9c600e2b 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.sh.tmpl @@ -1,5 +1,16 @@ {{- if ne .host.distro.family "windows" -}} #!/usr/bin/env bash +# @file Docker Install +# @brief Ensures Docker is installed, ensures the user can access Docker without sudo, and ensures Docker is configured to use gVisor +# @description +# This script ensures Docker is installed and then adds the provisioning user to the `docker` group so that they can +# access Docker without `sudo`. It also installs and configures gVisor for use with Docker. +# +# ## gVisor +# +# gVisor is included with our Docker setup because it improves the security of Docker. gVisor is an application kernel, written in Go, +# that implements a substantial portion of the Linux system call interface. It provides an additional layer of isolation between running +# applications and the host operating system. It has gained a lot of attention, perhaps partly, because it is maintained by Google. {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} diff --git a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.sh.tmpl similarity index 82% rename from home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.sh.tmpl index 626a51a9..28b323e9 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.sh.tmpl @@ -1,4 +1,10 @@ #!/usr/bin/env bash +# @file GPG Configuration +# @brief Imports the public GPG key defined by the variable `KEYID` and then assigns it ultimate trust +# @description +# This script imports your publicly hosted GPG key using `pgp.mit.edu` as the key host. It then assigns it +# the ultimate trust level. It also downloads and configures GPG to use the configuration defined in `.config.gpg` +# in the `home/.chezmoidata.yaml` file. {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }}