From a79c561e8d1da9f5fa72c9f0f4e592a8550716bc Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Tue, 31 Jan 2023 05:43:15 +0000 Subject: [PATCH] Update 22 files - /home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl - /home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl - /home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl - /home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl - /home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl - /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl - /home/.chezmoitemplates/universal/common-dependencies - /home/.chezmoitemplates/universal/profile-inline - /home/.chezmoitemplates/ubuntu/common-dependencies - /home/.chezmoitemplates/opensuse/common-dependencies - /home/.chezmoitemplates/freebsd/common-dependencies - /home/.chezmoitemplates/fedora/common-dependencies - /home/.chezmoitemplates/debian/common-dependencies - /home/.chezmoitemplates/archlinux/common-dependencies --- .../run_onchange_before_05-upgrade.tmpl | 28 +++++++++++++++ ...before_10-install-centos-dependencies.tmpl | 2 +- ...before_10-install-fedora-dependencies.tmpl | 2 +- .../run_before_01-decrypt-age-key.tmpl | 34 ++++++++++++------- ...n_onchange_before_05-install-homebrew.tmpl | 0 .../run_onchange_before_08-install-zx.tmpl | 0 ...nchange_before_09-ensure-node-version.tmpl | 0 ...n_onchange_before_10-remove-bloatware.tmpl | 0 ...run_onchange_before_11-install-docker.tmpl | 0 .../archlinux/common-dependencies | 1 + .../debian/common-dependencies | 1 + .../fedora/common-dependencies | 1 + .../freebsd/common-dependencies | 1 + .../opensuse/common-dependencies | 1 + .../ubuntu/common-dependencies | 1 + .../universal/common-dependencies | 1 - .../universal/profile-inline | 4 +++ 17 files changed, 62 insertions(+), 15 deletions(-) create mode 100644 home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl rename home/.chezmoiscripts/{_universal => universal}/run_onchange_before_05-install-homebrew.tmpl (100%) rename home/.chezmoiscripts/{_universal => universal}/run_onchange_before_08-install-zx.tmpl (100%) rename home/.chezmoiscripts/{_universal => universal}/run_onchange_before_09-ensure-node-version.tmpl (100%) rename home/.chezmoiscripts/{_universal => universal}/run_onchange_before_10-remove-bloatware.tmpl (100%) rename home/.chezmoiscripts/{_universal => universal}/run_onchange_before_11-install-docker.tmpl (100%) diff --git a/home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl b/home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl new file mode 100644 index 00000000..ba2893ff --- /dev/null +++ b/home/.chezmoiscripts/centos/run_onchange_before_05-upgrade.tmpl @@ -0,0 +1,28 @@ +#!/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 + +### 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' + . /etc/os-release + 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' + . /etc/os-release + 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 \ No newline at end of file diff --git a/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl b/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl index 8c758095..0ec58e74 100644 --- a/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl +++ b/home/.chezmoiscripts/centos/run_onchange_before_10-install-centos-dependencies.tmpl @@ -23,7 +23,7 @@ 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 + if rpm -qa | grep "^$PACKAGE-" > /dev/null; then logg info 'The '"$PACKAGE"' package is already installed' else logg info 'Installing `'"$PACKAGE"'`' diff --git a/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl b/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl index 1e59e7d7..21aace1a 100644 --- a/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl +++ b/home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl @@ -16,7 +16,7 @@ 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 + if rpm -qa | grep "^$PACKAGE-" > /dev/null; then logg info 'The '"$PACKAGE"' package is already installed' else logg info 'Installing `'"$PACKAGE"'`' diff --git a/home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl b/home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl index 3e5d2c89..7354942f 100644 --- a/home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl +++ b/home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl @@ -3,19 +3,29 @@ {{ includeTemplate "universal/logg-before" }} {{ includeTemplate "universal/profile-before" }} +### Install Age via Homebrew if not present +if ! command -v age > /dev/null; then + if command -v brew > /dev/null; then + brew install age + else + logg warn '`age` is not installed which is utilized in the decryption process' +fi + ### Decrypt private key if it is not already present -if [ ! -f "${XDG_CONFIG_HOME}/age/chezmoi.txt" ]; then - mkdir -p "${XDG_CONFIG_HOME}/age" - logg star '`PRESS ENTER` if you have not set up your encryption token yet' - age --decrypt --output "${XDG_CONFIG_HOME}/age/chezmoi.txt" "{{ .chezmoi.sourceDir }}/key.txt.age" || EXIT_CODE=$? - if [ -n "$EXIT_CODE" ]; then - logg info 'Proceeding without decrypting age encryption key stored at `~/.local/share/chezmoi/home/key.txt.age`' - logg info 'To have Chezmoi handle your encryption (so you can store your private files publicly) take a look at https://shorturl.at/jkpzG' - logg info 'Removing all files that begin with encrypted_ because decryption failed' - find "$HOME/.local/share/chezmoi" -type f -name "encrypted_*" | while read ENCRYPTED_FILE; do - logg info "Removing $ENCRYPTED_FILE" - rm -f "$ENCRYPTED_FILE" - done +if command -v age > /dev/null; then + if [ ! -f "${XDG_CONFIG_HOME}/age/chezmoi.txt" ]; then + mkdir -p "${XDG_CONFIG_HOME}/age" + logg star '`PRESS ENTER` if you have not set up your encryption token yet' + age --decrypt --output "${XDG_CONFIG_HOME}/age/chezmoi.txt" "{{ .chezmoi.sourceDir }}/key.txt.age" || EXIT_CODE=$? + if [ -n "$EXIT_CODE" ]; then + logg info 'Proceeding without decrypting age encryption key stored at `~/.local/share/chezmoi/home/key.txt.age`' + logg info 'To have Chezmoi handle your encryption (so you can store your private files publicly) take a look at https://shorturl.at/jkpzG' + logg info 'Removing all files that begin with encrypted_ because decryption failed' + find "$HOME/.local/share/chezmoi" -type f -name "encrypted_*" | while read ENCRYPTED_FILE; do + logg info "Removing $ENCRYPTED_FILE" + rm -f "$ENCRYPTED_FILE" + done + fi fi fi diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl similarity index 100% rename from home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_05-install-homebrew.tmpl diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl similarity index 100% rename from home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl similarity index 100% rename from home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl similarity index 100% rename from home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_10-remove-bloatware.tmpl diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl similarity index 100% rename from home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_11-install-docker.tmpl diff --git a/home/.chezmoitemplates/archlinux/common-dependencies b/home/.chezmoitemplates/archlinux/common-dependencies index 6f362d1b..a688c8bc 100644 --- a/home/.chezmoitemplates/archlinux/common-dependencies +++ b/home/.chezmoitemplates/archlinux/common-dependencies @@ -1,4 +1,5 @@ {{- $packages := list + "age" "base-devel" "ccid" "hopenpgp-tools" diff --git a/home/.chezmoitemplates/debian/common-dependencies b/home/.chezmoitemplates/debian/common-dependencies index 1e6aed11..5e3bb470 100644 --- a/home/.chezmoitemplates/debian/common-dependencies +++ b/home/.chezmoitemplates/debian/common-dependencies @@ -1,4 +1,5 @@ {{- $packages := list + "age/bullseye-backports" "build-essential" "gnupg-agent" "hopenpgp-tools" diff --git a/home/.chezmoitemplates/fedora/common-dependencies b/home/.chezmoitemplates/fedora/common-dependencies index cb4d9d7c..81dee9c7 100644 --- a/home/.chezmoitemplates/fedora/common-dependencies +++ b/home/.chezmoitemplates/fedora/common-dependencies @@ -1,4 +1,5 @@ {{- $packages := list + "age" "gcc" "gcc-c++" "gnupg2-smime" diff --git a/home/.chezmoitemplates/freebsd/common-dependencies b/home/.chezmoitemplates/freebsd/common-dependencies index 2c248a94..a326a5ce 100644 --- a/home/.chezmoitemplates/freebsd/common-dependencies +++ b/home/.chezmoitemplates/freebsd/common-dependencies @@ -1,4 +1,5 @@ {{- $packages := list + "age" "gcc" "gcc-c++" "kernel-devel" diff --git a/home/.chezmoitemplates/opensuse/common-dependencies b/home/.chezmoitemplates/opensuse/common-dependencies index 7fa078d6..bd0d07d3 100644 --- a/home/.chezmoitemplates/opensuse/common-dependencies +++ b/home/.chezmoitemplates/opensuse/common-dependencies @@ -1,4 +1,5 @@ {{- $packages := list + "age" "bash" "nodejs" "npm" diff --git a/home/.chezmoitemplates/ubuntu/common-dependencies b/home/.chezmoitemplates/ubuntu/common-dependencies index 1e6aed11..e9d23403 100644 --- a/home/.chezmoitemplates/ubuntu/common-dependencies +++ b/home/.chezmoitemplates/ubuntu/common-dependencies @@ -1,4 +1,5 @@ {{- $packages := list + "age" "build-essential" "gnupg-agent" "hopenpgp-tools" diff --git a/home/.chezmoitemplates/universal/common-dependencies b/home/.chezmoitemplates/universal/common-dependencies index 2045e998..50331889 100644 --- a/home/.chezmoitemplates/universal/common-dependencies +++ b/home/.chezmoitemplates/universal/common-dependencies @@ -1,6 +1,5 @@ {{/* bison required for ASDF PHP installation */}} {{- $packages := list - "age" "bash" "bison" "coreutils" diff --git a/home/.chezmoitemplates/universal/profile-inline b/home/.chezmoitemplates/universal/profile-inline index d9d96e71..6dcb1b6d 100644 --- a/home/.chezmoitemplates/universal/profile-inline +++ b/home/.chezmoitemplates/universal/profile-inline @@ -27,5 +27,9 @@ elif [ -f "/opt/homebrew/bin/brew" ]; then eval "$(/opt/homebrew/bin/brew shellenv)" fi +### Volta +export VOLTA_HOME="$XDG_DATA_HOME/volta" +export PATH="$VOLTA_HOME/bin:$PATH" + ### Ensure ~/.local/bin in PATH export PATH="$HOME/.local/bin:$PATH"