From 6c95c870b01b67b3502646af9019f34b5a68cccc Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 25 Jan 2023 04:31:32 +0000 Subject: [PATCH] Update 28 files - /home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl - /home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl - /home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl - /home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl - /home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl - /home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl - /home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl - /home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl - /home/.chezmoiscripts/fedora/run_onchange_before_10-install-fedora-dependencies.tmpl - /home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.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/centos/run_onchange_before_10-install-centos-dependencies.tmpl - /home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.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_onchange_before_10-remove-bloatware.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_before_01-add-temporary-includes.tmpl - /home/.chezmoitemplates/universal/logg - /home/.chezmoitemplates/universal/profile - /home/.chezmoitemplates/universal/profile-before - /home/.chezmoitemplates/universal/logg-before - /home/.chezmoitemplates/universal/logg-compat - /home/.chezmoitemplates/universal/logg-inline - /home/.chezmoitemplates/universal/profile-inline - /home/.chezmoidata.yaml --- home/.chezmoidata.yaml | 13 ++ .../run_before_01-add-temporary-includes.tmpl | 20 +++ ...n_onchange_before_05-install-homebrew.tmpl | 5 +- .../run_onchange_before_08-install-zx.tmpl | 4 +- ...nchange_before_09-ensure-node-version.tmpl | 4 +- ...n_onchange_before_10-remove-bloatware.tmpl | 4 +- ...run_onchange_before_11-install-docker.tmpl | 4 +- ...ore_10-install-archlinux-dependencies.tmpl | 2 +- ...before_10-install-centos-dependencies.tmpl | 2 +- ...before_10-install-darwin-dependencies.tmpl | 4 +- ..._onchange_before_20-ensure-user-group.tmpl | 4 +- ...before_10-install-debian-dependencies.tmpl | 2 +- ...before_10-install-fedora-dependencies.tmpl | 2 +- ...ge_before_11-install-freebsd-packages.tmpl | 2 +- .../run_onchange_before_10-system-tweaks.tmpl | 4 +- ...run_onchange_before_11-configure-swap.tmpl | 4 +- ...e_before_11-install-opensuse-software.tmpl | 2 +- .../run_onchange_before_12-update-dom0.tmpl | 2 +- ...before_10-install-ubuntu-dependencies.tmpl | 2 +- .../run_before_01-decrypt-age-key.tmpl | 5 +- .../run_onchange_before_91-configure-gpg.tmpl | 4 +- home/.chezmoitemplates/universal/logg | 167 +----------------- home/.chezmoitemplates/universal/logg-before | 1 + home/.chezmoitemplates/universal/logg-compat | 2 +- home/.chezmoitemplates/universal/logg-inline | 166 +++++++++++++++++ home/.chezmoitemplates/universal/profile | 25 +-- .../universal/profile-before | 1 + .../universal/profile-inline | 29 +++ 28 files changed, 263 insertions(+), 223 deletions(-) create mode 100644 home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl create mode 100644 home/.chezmoitemplates/universal/logg-before create mode 100644 home/.chezmoitemplates/universal/logg-inline create mode 100644 home/.chezmoitemplates/universal/profile-before create mode 100644 home/.chezmoitemplates/universal/profile-inline diff --git a/home/.chezmoidata.yaml b/home/.chezmoidata.yaml index 7e9d6eab..4ffa33c3 100644 --- a/home/.chezmoidata.yaml +++ b/home/.chezmoidata.yaml @@ -977,6 +977,19 @@ softwarePlugins: - https://github.com/tpope/vim-surround.git - https://github.com/nanotee/zoxide.vim.git qubes: + dom0Packages: + - latte-dock + - nautilus + - nautilus-gtkhash + - nautilus-search-tool + - kde-settings-qubes + - kdeplasma-addons + - konsole + - kscreen + - kvantum + - plymouth-kcm + - sssd-kcm + - sddm-kcm mirageUrl: https://github.com/mirage/qubes-mirage-firewall/releases/latest/download/mirage-firewall.tar.bz2 promptKeyboards: false provisionVM: provision diff --git a/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl b/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl new file mode 100644 index 00000000..cf9a50c8 --- /dev/null +++ b/home/.chezmoiscripts/_universal/run_before_01-add-temporary-includes.tmpl @@ -0,0 +1,20 @@ +{{- if (ne .host.distro.family "windows") -}} +### Add pre-scaffolding profile to /tmp/tmp-profile so it's easier to navigate through scripts +cat << EOF > /tmp/tmp-profile +#!/usr/bin/env bash +{{ includeTemplate "universal/profile-inline" }} +EOF + +### Make /tmp/tmp-profile owned by root to prevent tampering +sudo chown root /tmp/tmp-profile + +### Add pre-scaffolding /tmp/tmp-logg +cat << EOF > /tmp/tmp-logg +#!/usr/bin/env bash +{{ includeTemplate "universal/logg-inline" }} +EOF + +### Make /tmp/tmp-logg owned by root to prevent tampering +sudo chown root /tmp/tmp-logg + +{{ end -}} \ No newline at end of file diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl b/home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl index d4ee5c64..a4dbde1e 100644 --- a/home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl +++ b/home/.chezmoiscripts/_universal/run_onchange_before_05-install-homebrew.tmpl @@ -1,9 +1,8 @@ {{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env bash - -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} ### Install Xcode CLI tools on macOS if [ -d /Applications ] && [ -d /Library ]; then diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl b/home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl index 5dff9293..fd5f6b96 100644 --- a/home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl +++ b/home/.chezmoiscripts/_universal/run_onchange_before_08-install-zx.tmpl @@ -1,8 +1,8 @@ {{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env bash -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} ### Ensure node is installed if ! command -v node > /dev/null; then 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 index b1f71f0c..34ac72c4 100644 --- a/home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl +++ b/home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl @@ -3,8 +3,8 @@ # Node.js version: {{ output "node" "--version" }} -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} ### Ensure recent version of Node.js is being used if command -v volta > /dev/null; then diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl b/home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl index 57289b16..2970dc0e 100644 --- a/home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl +++ b/home/.chezmoiscripts/_universal/run_onchange_before_10-remove-bloatware.tmpl @@ -1,8 +1,8 @@ {{- if eq .host.distro.family "linux" -}} #!/usr/bin/env bash -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $removePackages := join " " .removeLinuxPackages }} diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl b/home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl index 226b3baf..a6b508e2 100644 --- a/home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl +++ b/home/.chezmoiscripts/_universal/run_onchange_before_11-install-docker.tmpl @@ -1,8 +1,8 @@ {{- if ne .host.distro.family "windows" -}} #!/usr/bin/env bash -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} ### Install Docker if [ -d /Applications ] && [ -d /System ]; then diff --git a/home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.tmpl b/home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.tmpl index 50a4c567..724ac4bb 100644 --- a/home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.tmpl +++ b/home/.chezmoiscripts/archlinux/run_onchange_before_10-install-archlinux-dependencies.tmpl @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "archlinux/common-dependencies" .) -}} 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 d4ea4e57..c0cc5d68 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 @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "centos/common-dependencies" .) -}} diff --git a/home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.tmpl b/home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.tmpl index ac8d53a9..8f46c9a0 100644 --- a/home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.tmpl +++ b/home/.chezmoiscripts/darwin/run_onchange_before_10-install-darwin-dependencies.tmpl @@ -2,8 +2,8 @@ # darwin/Brewfile hash: {{ include (joinPath ".chezmoitemplates" "darwin" "Brewfile") | sha256sum }} -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} if command -v brew > /dev/null; then logg 'Installing base dependencies for macOS using `brew bundle`' diff --git a/home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.tmpl b/home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.tmpl index f9efdadd..551b630b 100644 --- a/home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.tmpl +++ b/home/.chezmoiscripts/darwin/run_onchange_before_20-ensure-user-group.tmpl @@ -1,7 +1,7 @@ #!/usr/bin/env bash -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} ### Ensure user has group of same name (required for Macports) logg info 'Ensuring user has a group with the same name and that it is a member. Sudo privileges may be required' diff --git a/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl b/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl index 18982c4b..71f546a9 100644 --- a/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl +++ b/home/.chezmoiscripts/debian/run_onchange_before_10-install-debian-dependencies.tmpl @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "debian/common-dependencies" .) -}} 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 d4a198d9..7e205ede 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 @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "fedora/common-dependencies" .) -}} diff --git a/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl b/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl index 7a2f6e81..c5fdb99c 100644 --- a/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl +++ b/home/.chezmoiscripts/freebsd/run_onchange_before_11-install-freebsd-packages.tmpl @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "freebsd/common-dependencies" .) -}} diff --git a/home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl b/home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl index d0310ab9..03c5b240 100644 --- a/home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl +++ b/home/.chezmoiscripts/linux/run_onchange_before_10-system-tweaks.tmpl @@ -1,7 +1,7 @@ #!/usr/bin/env bash -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} ### Set hostname (if redefined) if command -v hostnamectl > /dev/null; then diff --git a/home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl b/home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl index ce163357..18f90d1a 100644 --- a/home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl +++ b/home/.chezmoiscripts/linux/run_onchange_before_11-configure-swap.tmpl @@ -1,8 +1,8 @@ #!/usr/bin/env bash # TODO - make equivalent to https://gitlab.com/megabyte-labs/gas-station/-/blob/master/roles/system/common/tasks/linux/swap.yml -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} if [ ! -f /swapfile ]; then MEMORY_IN_KB="$(grep MemTotal /proc/meminfo | sed 's/.* \(.*\) kB/\1/')" diff --git a/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl b/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl index b6d0fb2a..82b6277a 100644 --- a/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl +++ b/home/.chezmoiscripts/opensuse/run_onchange_before_11-install-opensuse-software.tmpl @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "opensuse/common-dependencies" .) -}} diff --git a/home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl b/home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl index a13dbc17..2ec10045 100644 --- a/home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl +++ b/home/.chezmoiscripts/qubes/run_onchange_before_12-update-dom0.tmpl @@ -11,7 +11,7 @@ logg info "Installing qubes-repo-contrib" sudo qubes-dom0-update -y qubes-repo-contrib ### Install dependencies -for PACKAGE of latte-dock nautilus nautilus-gtkhash nautilus-search-tool kde-settings-qubes kdeplasma-addons konsole kscreen kvantum plymouth-kcm sssd-kcm sddm-kcm; do +for PACKAGE of {{ .qubes.dom0Packages | toString | replace "[" "" | replace "]" "" }}; do logg info "Installing $PACKAGE" sudo qubes-dom0-update -y "$PACKAGE" || true done diff --git a/home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl b/home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl index decd5441..6ea861ca 100644 --- a/home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl +++ b/home/.chezmoiscripts/ubuntu/run_onchange_before_10-install-ubuntu-dependencies.tmpl @@ -3,7 +3,7 @@ # 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" }} +{{ includeTemplate "universal/logg-bundle" }} {{- $packages := splitList " " (includeTemplate "universal/common-dependencies" .) -}} {{- $additionalPackages := splitList " " (includeTemplate "ubuntu/common-dependencies" .) -}} 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 b22366bb..3655e96c 100644 --- a/home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl +++ b/home/.chezmoiscripts/universal/run_before_01-decrypt-age-key.tmpl @@ -1,8 +1,7 @@ #!/usr/bin/env bash -{{ includeTemplate "universal/logg" }} - -XDG_CONFIG_HOME="$HOME/.config" +{{ includeTemplate "universal/logg-bundle" }} +{{ includeTemplate "universal/profile-bundle" }} ### Decrypt private key if it is not already present if [ ! -f "${XDG_CONFIG_HOME}/age/chezmoi.txt" ]; then diff --git a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl index 165d6fcd..87f64e09 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_91-configure-gpg.tmpl @@ -1,7 +1,7 @@ #!/usr/bin/env bash -{{ includeTemplate "universal/profile" }} -{{ includeTemplate "universal/logg" }} +{{ includeTemplate "universal/profile-bundle" }} +{{ includeTemplate "universal/logg-bundle" }} KEYID="{{ .user.gpg.id }}" diff --git a/home/.chezmoitemplates/universal/logg b/home/.chezmoitemplates/universal/logg index c32b50c4..008f9961 100644 --- a/home/.chezmoitemplates/universal/logg +++ b/home/.chezmoitemplates/universal/logg @@ -1,166 +1 @@ -# @description Installs glow (a markdown renderer) from GitHub releases -# @example installGlow -installGlow() { - # TODO: Add support for other architecture types - if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then - GLOW_DOWNLOAD_URL="https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_Darwin_x86_64.tar.gz" - elif [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then - GLOW_DOWNLOAD_URL="https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_linux_x86_64.tar.gz" - fi - if type curl &> /dev/null; then - if { [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; } || [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then - TMP="$(mktemp)" - TMP_DIR="$(dirname "$TMP")" - curl -sSL "$GLOW_DOWNLOAD_URL" > "$TMP" - tar -xzf "$TMP" -C "$TMP_DIR" - if [ -n "$HOME" ]; then - if mkdir -p "$HOME/.local/bin" && mv "$TMP_DIR/glow" "$HOME/.local/bin/glow"; then - GLOW_PATH="$HOME/.local/bin/glow" - else - GLOW_PATH="$(dirname "${BASH_SOURCE[0]}")/glow" - mv "$TMP_DIR/gum" "$GLOW_PATH" - fi - chmod +x "$GLOW_PATH" - else - echo "WARNING: The HOME environment variable is not set! (Glow)" - fi - else - echo "WARNING: Unable to detect system type. (Glow)" - fi - fi -} - -# @description Installs gum (a logging CLI) from GitHub releases -# @example installGum -installGum() { - # TODO: Add support for other architecture types - if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then - GUM_DOWNLOAD_URL="https://github.com/charmbracelet/gum/releases/download/v0.4.0/gum_0.4.0_Darwin_x86_64.tar.gz" - elif [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then - GUM_DOWNLOAD_URL="https://github.com/charmbracelet/gum/releases/download/v0.4.0/gum_0.4.0_linux_x86_64.tar.gz" - fi - if type curl &> /dev/null; then - if { [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; } || [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then - TMP="$(mktemp)" - TMP_DIR="$(dirname "$TMP")" - curl -sSL "$GUM_DOWNLOAD_URL" > "$TMP" - tar -xzf "$TMP" -C "$TMP_DIR" - if [ -n "$HOME" ]; then - if mkdir -p "$HOME/.local/bin" && mv "$TMP_DIR/gum" "$HOME/.local/bin/gum"; then - GUM_PATH="$HOME/.local/bin/gum" - else - GUM_PATH="$(dirname "${BASH_SOURCE[0]}")/gum" - mv "$TMP_DIR/gum" "$GLOW_PATH" - fi - chmod +x "$GUM_PATH" - else - echo "WARNING: The HOME environment variable is not set! (Gum)" - fi - else - echo "WARNING: Unable to detect system type. (Gum)" - fi - fi -} - -# @description Configure the logger to use echo or gum -if [ "${container:=}" != 'docker' ]; then - # Acquire gum's path or attempt to install it - if type gum &> /dev/null; then - GUM_PATH="$(which gum)" - elif [ -f "$HOME/.local/bin/gum" ]; then - GUM_PATH="$HOME/.local/bin/gum" - elif [ -f "$(dirname "${BASH_SOURCE[0]}")/gum" ]; then - GUM_PATH="$(dirname "${BASH_SOURCE[0]}")/gum" - elif type brew &> /dev/null; then - brew install gum - GUM_PATH="$(which gum)" - else - if ! command -v qubesctl > /dev/null; then - # Qubes dom0 - installGum - fi - fi - - # If gum's path was set, then turn on enhanced logging - if [ -n "$GUM_PATH" ]; then - chmod +x "$GUM_PATH" - fi -fi - -format() { - # shellcheck disable=SC2001,SC2016 - ANSI_STR_FORMATTED="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`.*/\1\\u001b[47;30m \2 \\e[49;m/')" - # shellcheck disable=SC2001,SC2016 - ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`\(.*\)$/\3/')" - if [ "$ANSI_STR_FORMATTED" != "$ANSI_STR" ]; then - if [[ $ANSI_STR == *'`'*'`'* ]]; then - ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$(format "$("$GUM_PATH" style --bold "$ANSI_STR")")" - else - ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$("$GUM_PATH" style --bold "$ANSI_STR")" - fi - fi - echo -e "$ANSI_STR_FORMATTED" -} - -formatFaint() { - # shellcheck disable=SC2001,SC2016 - ANSI_STR_FORMATTED="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`.*/\1\\u001b[47;30m \2 \\e[49;m/')" - # shellcheck disable=SC2001,SC2016 - ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`\(.*\)$/\3/')" - if [ "$ANSI_STR_FORMATTED" != "$ANSI_STR" ]; then - if [[ $ANSI_STR == *'`'*'`'* ]]; then - ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$(formatFaint "$("$GUM_PATH" style --faint "$ANSI_STR")")" - else - ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$("$GUM_PATH" style --faint "$ANSI_STR")" - fi - fi - echo -e "$ANSI_STR_FORMATTED" -} - -# @description Logs using Node.js -# @example logger info "An informative log" -logg() { - TYPE="$1" - MSG="$2" - if [ "$TYPE" == 'error' ]; then - "$GUM_PATH" style --border="thick" "$("$GUM_PATH" style --foreground="#ff0000" "✖") $("$GUM_PATH" style --bold --background="#ff0000" --foreground="#ffffff" " ERROR ") $("$GUM_PATH" style --bold "$(format "$MSG")")" - elif [ "$TYPE" == 'info' ]; then - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ffff" "○") $("$GUM_PATH" style --faint "$(formatFaint "$MSG")")" - elif [ "$TYPE" == 'md' ]; then - # @description Ensure glow is installed - if [ "${container:=}" != 'docker' ]; then - if type glow &> /dev/null; then - GLOW_PATH="$(which glow)" - elif [ -f "$HOME/.local/bin/glow" ]; then - GLOW_PATH="$HOME/.local/bin/glow" - elif [ -f "$(dirname "${BASH_SOURCE[0]}")/glow" ]; then - GLOW_PATH="$(dirname "${BASH_SOURCE[0]}")/glow" - elif type brew &> /dev/null; then - brew install glow - GLOW_PATH="$(which glow)" - else - if ! command -v qubesctl > /dev/null; then - # Qubes dom0 - installGlow - fi - fi - - if [ -n "$GLOW_PATH" ]; then - chmod +x "$GLOW_PATH" - fi - fi - "$GLOW_PATH" "$MSG" - elif [ "$TYPE" == 'prompt' ]; then - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00008b" "▶") $("$GUM_PATH" style --bold "$(format "$MSG")")" - elif [ "$TYPE" == 'star' ]; then - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#d1d100" "◆") $("$GUM_PATH" style --bold "$(format "$MSG")")" - elif [ "$TYPE" == 'start' ]; then - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ff00" "▶") $("$GUM_PATH" style --bold "$(format "$MSG")")" - elif [ "$TYPE" == 'success' ]; then - "$GUM_PATH" style "$("$GUM_PATH" style --foreground="#00ff00" "✔") $("$GUM_PATH" style --bold "$(format "$MSG")")" - elif [ "$TYPE" == 'warn' ]; then - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#d1d100" "◆") $("$GUM_PATH" style --bold --background="#ffff00" --foreground="#000000" " WARNING ") $("$GUM_PATH" style --bold "$(format "$MSG")")" - else - "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ff00" "▶") $("$GUM_PATH" style --bold "$(format "$TYPE")")" - fi -} +PATH="$HOME/.local/bin:$PATH" \ No newline at end of file diff --git a/home/.chezmoitemplates/universal/logg-before b/home/.chezmoitemplates/universal/logg-before new file mode 100644 index 00000000..75f78517 --- /dev/null +++ b/home/.chezmoitemplates/universal/logg-before @@ -0,0 +1 @@ +. /tmp/tmp-logg \ No newline at end of file diff --git a/home/.chezmoitemplates/universal/logg-compat b/home/.chezmoitemplates/universal/logg-compat index 93501128..7ea722dc 100644 --- a/home/.chezmoitemplates/universal/logg-compat +++ b/home/.chezmoitemplates/universal/logg-compat @@ -1,3 +1,3 @@ if command -v logg > /dev/null; then alias logg='echo' -fi +fi \ No newline at end of file diff --git a/home/.chezmoitemplates/universal/logg-inline b/home/.chezmoitemplates/universal/logg-inline new file mode 100644 index 00000000..290fb118 --- /dev/null +++ b/home/.chezmoitemplates/universal/logg-inline @@ -0,0 +1,166 @@ +# @description Installs glow (a markdown renderer) from GitHub releases +# @example installGlow +installGlow() { + # TODO: Add support for other architecture types + if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then + GLOW_DOWNLOAD_URL="https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_Darwin_x86_64.tar.gz" + elif [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then + GLOW_DOWNLOAD_URL="https://github.com/charmbracelet/glow/releases/download/v1.4.1/glow_1.4.1_linux_x86_64.tar.gz" + fi + if type curl &> /dev/null; then + if { [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; } || [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then + TMP="$(mktemp)" + TMP_DIR="$(dirname "$TMP")" + curl -sSL "$GLOW_DOWNLOAD_URL" > "$TMP" + tar -xzf "$TMP" -C "$TMP_DIR" + if [ -n "$HOME" ]; then + if mkdir -p "$HOME/.local/bin" && mv "$TMP_DIR/glow" "$HOME/.local/bin/glow"; then + GLOW_PATH="$HOME/.local/bin/glow" + else + GLOW_PATH="$(dirname "${BASH_SOURCE[0]}")/glow" + mv "$TMP_DIR/gum" "$GLOW_PATH" + fi + chmod +x "$GLOW_PATH" + else + echo "WARNING: The HOME environment variable is not set! (Glow)" + fi + else + echo "WARNING: Unable to detect system type. (Glow)" + fi + fi +} + +# @description Installs gum (a logging CLI) from GitHub releases +# @example installGum +installGum() { + # TODO: Add support for other architecture types + if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then + GUM_DOWNLOAD_URL="https://github.com/charmbracelet/gum/releases/download/v0.4.0/gum_0.4.0_Darwin_x86_64.tar.gz" + elif [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then + GUM_DOWNLOAD_URL="https://github.com/charmbracelet/gum/releases/download/v0.4.0/gum_0.4.0_linux_x86_64.tar.gz" + fi + if type curl &> /dev/null; then + if { [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; } || [ -f '/etc/ubuntu-release' ] || [ -f '/etc/debian_version' ] || [ -f '/etc/redhat-release' ] || [ -f '/etc/SuSE-release' ] || [ -f '/etc/arch-release' ] || [ -f '/etc/alpine-release' ]; then + TMP="$(mktemp)" + TMP_DIR="$(dirname "$TMP")" + curl -sSL "$GUM_DOWNLOAD_URL" > "$TMP" + tar -xzf "$TMP" -C "$TMP_DIR" + if [ -n "$HOME" ]; then + if mkdir -p "$HOME/.local/bin" && mv "$TMP_DIR/gum" "$HOME/.local/bin/gum"; then + GUM_PATH="$HOME/.local/bin/gum" + else + GUM_PATH="$(dirname "${BASH_SOURCE[0]}")/gum" + mv "$TMP_DIR/gum" "$GLOW_PATH" + fi + chmod +x "$GUM_PATH" + else + echo "WARNING: The HOME environment variable is not set! (Gum)" + fi + else + echo "WARNING: Unable to detect system type. (Gum)" + fi + fi +} + +# @description Configure the logger to use echo or gum +if [ "${container:=}" != 'docker' ]; then + # Acquire gum's path or attempt to install it + if type gum &> /dev/null; then + GUM_PATH="$(which gum)" + elif [ -f "$HOME/.local/bin/gum" ]; then + GUM_PATH="$HOME/.local/bin/gum" + elif [ -f "$(dirname "${BASH_SOURCE[0]}")/gum" ]; then + GUM_PATH="$(dirname "${BASH_SOURCE[0]}")/gum" + elif type brew &> /dev/null; then + brew install gum + GUM_PATH="$(which gum)" + else + if ! command -v qubesctl > /dev/null; then + # Qubes dom0 + installGum + fi + fi + + # If gum's path was set, then turn on enhanced logging + if [ -n "$GUM_PATH" ]; then + chmod +x "$GUM_PATH" + fi +fi + +format() { + # shellcheck disable=SC2001,SC2016 + ANSI_STR_FORMATTED="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`.*/\1\\u001b[47;30m \2 \\e[49;m/')" + # shellcheck disable=SC2001,SC2016 + ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`\(.*\)$/\3/')" + if [ "$ANSI_STR_FORMATTED" != "$ANSI_STR" ]; then + if [[ $ANSI_STR == *'`'*'`'* ]]; then + ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$(format "$("$GUM_PATH" style --bold "$ANSI_STR")")" + else + ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$("$GUM_PATH" style --bold "$ANSI_STR")" + fi + fi + echo -e "$ANSI_STR_FORMATTED" +} + +formatFaint() { + # shellcheck disable=SC2001,SC2016 + ANSI_STR_FORMATTED="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`.*/\1\\u001b[47;30m \2 \\e[49;m/')" + # shellcheck disable=SC2001,SC2016 + ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`\(.*\)$/\3/')" + if [ "$ANSI_STR_FORMATTED" != "$ANSI_STR" ]; then + if [[ $ANSI_STR == *'`'*'`'* ]]; then + ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$(formatFaint "$("$GUM_PATH" style --faint "$ANSI_STR")")" + else + ANSI_STR_FORMATTED="$ANSI_STR_FORMATTED$("$GUM_PATH" style --faint "$ANSI_STR")" + fi + fi + echo -e "$ANSI_STR_FORMATTED" +} + +# @description Logs using Node.js +# @example logger info "An informative log" +logg() { + TYPE="$1" + MSG="$2" + if [ "$TYPE" == 'error' ]; then + "$GUM_PATH" style --border="thick" "$("$GUM_PATH" style --foreground="#ff0000" "✖") $("$GUM_PATH" style --bold --background="#ff0000" --foreground="#ffffff" " ERROR ") $("$GUM_PATH" style --bold "$(format "$MSG")")" + elif [ "$TYPE" == 'info' ]; then + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ffff" "○") $("$GUM_PATH" style --faint "$(formatFaint "$MSG")")" + elif [ "$TYPE" == 'md' ]; then + # @description Ensure glow is installed + if [ "${container:=}" != 'docker' ]; then + if type glow &> /dev/null; then + GLOW_PATH="$(which glow)" + elif [ -f "$HOME/.local/bin/glow" ]; then + GLOW_PATH="$HOME/.local/bin/glow" + elif [ -f "$(dirname "${BASH_SOURCE[0]}")/glow" ]; then + GLOW_PATH="$(dirname "${BASH_SOURCE[0]}")/glow" + elif type brew &> /dev/null; then + brew install glow + GLOW_PATH="$(which glow)" + else + if ! command -v qubesctl > /dev/null; then + # Qubes dom0 + installGlow + fi + fi + + if [ -n "$GLOW_PATH" ]; then + chmod +x "$GLOW_PATH" + fi + fi + "$GLOW_PATH" "$MSG" + elif [ "$TYPE" == 'prompt' ]; then + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00008b" "▶") $("$GUM_PATH" style --bold "$(format "$MSG")")" + elif [ "$TYPE" == 'star' ]; then + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#d1d100" "◆") $("$GUM_PATH" style --bold "$(format "$MSG")")" + elif [ "$TYPE" == 'start' ]; then + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ff00" "▶") $("$GUM_PATH" style --bold "$(format "$MSG")")" + elif [ "$TYPE" == 'success' ]; then + "$GUM_PATH" style "$("$GUM_PATH" style --foreground="#00ff00" "✔") $("$GUM_PATH" style --bold "$(format "$MSG")")" + elif [ "$TYPE" == 'warn' ]; then + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#d1d100" "◆") $("$GUM_PATH" style --bold --background="#ffff00" --foreground="#000000" " WARNING ") $("$GUM_PATH" style --bold "$(format "$MSG")")" + else + "$GUM_PATH" style " $("$GUM_PATH" style --foreground="#00ff00" "▶") $("$GUM_PATH" style --bold "$(format "$TYPE")")" + fi +} \ No newline at end of file diff --git a/home/.chezmoitemplates/universal/profile b/home/.chezmoitemplates/universal/profile index fed1b1b7..689e03d3 100644 --- a/home/.chezmoitemplates/universal/profile +++ b/home/.chezmoitemplates/universal/profile @@ -1,24 +1 @@ -### Source .bashrc if it is present -if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" -elif [ -f "$HOME/.config/shell/exports.sh" ]; then - . "$HOME/.config/shell/exports.sh" -fi - -### Ensure Homebrew PATHs -if [ -d /home/linuxbrew/.linuxbrew/bin ]; then - export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" - export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar" - export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew" - export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}" - export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:" - export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}" - export WHALEBREW_INSTALL_PATH="/home/linuxbrew/.linuxbrew/whalebrew" -elif [ -f /opt/homebrew/bin/brew ]; then - eval "$(/opt/homebrew/bin/brew shellenv)" -elif [ -f /usr/local/bin/brew ]; then - eval "$(/usr/local/bin/brew shellenv)" -fi - -### Ensure ~/.local/bin in PATH -export PATH="$HOME/.local/bin:$PATH" +. "$HOME/.bashrc" \ No newline at end of file diff --git a/home/.chezmoitemplates/universal/profile-before b/home/.chezmoitemplates/universal/profile-before new file mode 100644 index 00000000..2a7ca617 --- /dev/null +++ b/home/.chezmoitemplates/universal/profile-before @@ -0,0 +1 @@ +. /tmp/tmp-profile \ No newline at end of file diff --git a/home/.chezmoitemplates/universal/profile-inline b/home/.chezmoitemplates/universal/profile-inline new file mode 100644 index 00000000..5f81fee9 --- /dev/null +++ b/home/.chezmoitemplates/universal/profile-inline @@ -0,0 +1,29 @@ +### Source .bashrc if it is present +if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" +elif [ -f "$HOME/.config/shell/exports.sh" ]; then + . "$HOME/.config/shell/exports.sh" +fi + +### XDG +XDG_CONFIG_HOME="$HOME/.config" +XDG_CACHE_HOME="$HOME/.cache" +XDG_DATA_DIR="$HOME/.local/share" + +### Ensure Homebrew PATHs +if [ -d /home/linuxbrew/.linuxbrew/bin ]; then + export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew" + export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar" + export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew" + export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin${PATH+:$PATH}" + export MANPATH="/home/linuxbrew/.linuxbrew/share/man${MANPATH+:$MANPATH}:" + export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:${INFOPATH:-}" + export WHALEBREW_INSTALL_PATH="/home/linuxbrew/.linuxbrew/whalebrew" +elif [ -f /opt/homebrew/bin/brew ]; then + eval "$(/opt/homebrew/bin/brew shellenv)" +elif [ -f /usr/local/bin/brew ]; then + eval "$(/usr/local/bin/brew shellenv)" +fi + +### Ensure ~/.local/bin in PATH +export PATH="$HOME/.local/bin:$PATH" \ No newline at end of file