From 03f5dbdce6fca1cc66751a4c721a129eeab5b293 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:41:49 +0000 Subject: [PATCH] Latest --- ...ange_after_26-system-vscode-node-modules.sh.tmpl | 4 ++-- .../run_onchange_after_32-gitomatic.sh.tmpl | 10 ++++++---- .../universal/run_onchange_after_51-samba.sh.tmpl | 6 +++--- .../universal/run_onchange_after_53-tabby.sh.tmpl | 2 +- .../universal/run_onchange_after_94-bash-it.sh.tmpl | 13 +++++++++++-- .../run_onchange_after_97-cloudflare.sh.tmpl | 7 ++++--- .../run_onchange_before_08-install-zx.sh.tmpl | 3 +++ .../run_onchange_before_09-node-version.sh.tmpl | 3 +++ ...ge_before_10-install-darwin-dependencies.sh.tmpl | 3 +++ home/dot_config/shell/exports.sh.tmpl | 5 +++++ home/dot_local/bin/executable_install-program | 7 +++---- .../{config.yaml.tmpl => config.yml.tmpl} | 0 software.yml | 3 ++- 13 files changed, 46 insertions(+), 20 deletions(-) rename home/dot_local/etc/cloudflared/{config.yaml.tmpl => config.yml.tmpl} (100%) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl index 44cf9ee7..b5adf06d 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_26-system-vscode-node-modules.sh.tmpl @@ -57,12 +57,12 @@ if command -v code > /dev/null && command -v npm > /dev/null && [ -f "${XDG_DATA if sudo cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" /package.json; then logg info 'Successfully copied linter fallback configurations package.json to /package.json' logg info 'Installing system root directory node_modules' - cd / && sudo npm i --no-package-lock || EXIT_CODE=$? + cd / && sudo npm i --quiet --no-package-lock || EXIT_CODE=$? else logg warn 'Unable to successfully copy linter fallback configurations package.json to /package.json' logg info 'Installing linter fallback configurations node_modules to home directory instead' cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/vscode/package.json" "$HOME/package.json" - cd ~ && npm i --no-package-lock || EXIT_CODE=$? + cd ~ && npm i --quiet --no-package-lock || EXIT_CODE=$? fi ### Log message if install failed diff --git a/home/.chezmoiscripts/universal/run_onchange_after_32-gitomatic.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_32-gitomatic.sh.tmpl index 9abc68fe..2ca197f2 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_32-gitomatic.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_32-gitomatic.sh.tmpl @@ -35,10 +35,12 @@ function gitomaticSetup() { ### macOS logg info 'Copying `gitomatic` plist file to /Library/LaunchDaemons' sudo cp -f "{{ .chezmoi.homeDir }}/.config/gitomatic/gitomatic.plist" /Library/LaunchDaemons/gitomatic.plist - logg info 'Running `sudo launchctl load /Library/LaunchDaemons/gitomatic.plist`' - sudo launchctl load /Library/LaunchDaemons/gitomatic.plist - logg info 'Running `sudo launchctl start /Library/LaunchDaemons/gitomatic.plist`' - sudo launchctl start /Library/LaunchDaemons/gitomatic.plist + if ! sudo launchctl list | grep 'gitomatic' > /dev/null; then + logg info 'Running `sudo launchctl load /Library/LaunchDaemons/gitomatic.plist`' + sudo launchctl load /Library/LaunchDaemons/gitomatic.plist + logg info 'Running `sudo launchctl start /Library/LaunchDaemons/gitomatic.plist`' + sudo launchctl start /Library/LaunchDaemons/gitomatic.plist + fi else ### Linux logg info 'Copying `gitomatic` systemd unit file to /etc/systemd/system/' diff --git a/home/.chezmoiscripts/universal/run_onchange_after_51-samba.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_51-samba.sh.tmpl index 6cfa701a..670726a3 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_51-samba.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_51-samba.sh.tmpl @@ -88,9 +88,9 @@ if command -v smbd > /dev/null; then chmod 775 "$HOME/Public" chown -Rf {{ .user.username }}:rclone "$HOME/Public" - sudo sharing -a "$PRIVATE_SHARE" -S "Private (System)" -n "Private (System)" -g 000 -s 001 -E 1 -R 1 && logg success "Configured $PRIVATE_SHARE as a private Samba share" - sudo sharing -a "$PUBLIC_SHARE" -S "Public (System)" -n "Public (System)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $PUBLIC_SHARE as a public Samba share" - sudo sharing -a "$HOME/Public" -S "Public (User)" -n "Public (User)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $HOME/Public as a public Samba share" + sudo sharing -a "$PRIVATE_SHARE" -S "Private (System)" -n "Private (System)" -g 000 -s 001 -E 1 -R 1 && logg success "Configured $PRIVATE_SHARE as a private Samba share" || logg info '`sharing` command failed - it is likely that the share was already set up' + sudo sharing -a "$PUBLIC_SHARE" -S "Public (System)" -n "Public (System)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $PUBLIC_SHARE as a public Samba share" || logg info '`sharing` command failed - it is likely that the share was already set up' + sudo sharing -a "$HOME/Public" -S "Public (User)" -n "Public (User)" -g 001 -s 001 -E 1 -R 0 && logg success "Configured $HOME/Public as a public Samba share" || logg info '`sharing` command failed - it is likely that the share was already set up' else logg info 'Ensuring /mnt for S3 buckets and Samba shares are configured' diff --git a/home/.chezmoiscripts/universal/run_onchange_after_53-tabby.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_53-tabby.sh.tmpl index b3dfbd08..95a25d5c 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_53-tabby.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_53-tabby.sh.tmpl @@ -53,7 +53,7 @@ if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/package.json" ]; then else logg info 'Installing Tabby plugins defined in `'"${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins/package.json"'`' cd "${XDG_CONFIG_HOME:-$HOME/.config}/tabby/plugins" - npm install + npm install --quiet logg success 'Finished installing Tabby plugins' fi else diff --git a/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl index 953cdd2f..2a697063 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_94-bash-it.sh.tmpl @@ -1,5 +1,5 @@ {{- if (ne .host.distro.family "windows") -}} -#!/usr/bin/env -S bash -i +#!/usr/bin/env bash # @file Bash It! # @brief Ensures Bash is configured to use Bash It! # @description @@ -15,6 +15,13 @@ if ! command -v powerline > /dev/null; then install-software powerline > /dev/null fi +### Include Bash It +export BASH_IT="${XDG_DATA_HOME:-$HOME/.local/share}/bash_it" +export BASH_IT_THEME="powerline" +if command -v powerline-daemon > /dev/null && [ -f "$BASH_IT/bash_it.sh" ]; then + . "$BASH_IT/bash_it.sh" +fi + ### Ensure ble.sh installed if [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/ble.sh" ] && [ ! ]; then logg info "${XDG_DATA_HOME:-$HOME/.local/share}/ble.sh present and ${XDG_DATA_HOME:-$HOME/.local/share}/blesh not present - installing ble.sh..." @@ -50,7 +57,9 @@ if command -v powerline > /dev/null && [ -f "$HOME/.bashrc" ]; then ### Ensure plugins are enabled logg info 'Enabling bash-it plugins' # TODO: Move these plugins to the .chezmoidata.yaml - for PLUGIN in base blesh browser cht-sh dirs gitstatus powerline sudo xterm; do + # Plugin: xterm causing following error so it was removed + # ble: Please run `stty sane' to recover the correct TTY state. + for PLUGIN in base blesh browser cht-sh dirs gitstatus powerline sudo; do if ls "$BASH_IT/enabled" | grep "$PLUGIN" > /dev/null; then rm -f "$BASH_IT/enabled/"*"$PLUGIN"* > /dev/null && logg info "Removed old $PLUGIN bash-it plugin symlink" || logg error "Failed to remove $PLUGIN bash-it plugin symlink" fi diff --git a/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl index f5f7f4f9..2cd3bba6 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_97-cloudflare.sh.tmpl @@ -116,13 +116,13 @@ if [ -d /System ] && [ -d /Applications ] && command -v warp-cli > /dev/null; th logg info 'Adding Cloudflare certificate to `/usr/local/etc/openssl@3/certs/Cloudflare_CA.pem`' echo | sudo cat - "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" >> /usr/local/etc/openssl@3/certs/Cloudflare_CA.pem logg info 'Running `/usr/local/opt/openssl@3/bin/c_rehash`' - /usr/local/opt/openssl@3/bin/c_rehash + /usr/local/opt/openssl@3/bin/c_rehash > /dev/null && logg success 'rehash successful' elif [ -d "/opt/homebrew/etc/openssl@3/certs" ]; then # Location on arm64 macOS logg info 'Adding Cloudflare certificate to `/opt/homebrew/etc/openssl@3/certs/Cloudflare_CA.pem`' echo | sudo cat - "${XDG_DATA_HOME:-$HOME/.local/share}/warp/Cloudflare_CA.pem" >> /opt/homebrew/etc/openssl@3/certs/Cloudflare_CA.pem logg info 'Running `/opt/homebrew/opt/openssl@3/bin/c_rehash`' - /opt/homebrew/opt/openssl@3/bin/c_rehash + /opt/homebrew/opt/openssl@3/bin/c_rehash > /dev/null && logg success 'rehash successful' else logg warn 'Unable to add `Cloudflare_CA.pem` because `/usr/local/etc/openssl@3/certs` and `/opt/homebrew/etc/openssl@3/certs` do not exist!' fi @@ -244,7 +244,8 @@ if command -v cloudflared > /dev/null && [ -d "$HOME/.local/etc/cloudflared" ]; # Copy over configuration files logg info 'Copying over configuration files from ~/.local/etc/cloudflared to /usr/local/etc/cloudflared' - sudo cp -rf "$HOME/.local/etc/cloudflared/"* /usr/local/etc/cloudflared + sudo cp -f "$HOME/.local/etc/cloudflared/cert.pem" /usr/local/etc/cloudflared/cert.pem + sudo cp -f "$HOME/.local/etc/cloudflared/config.yml /usr/local/etc/cloudflared/config.yml # Register tunnel (if not already registered) if cloudflared tunnel list | grep "host-{{ .host.hostname }}"; then diff --git a/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl index d4547446..65e87105 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.sh.tmpl @@ -15,6 +15,9 @@ {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} +export VOLTA_HOME="$XDG_DATA_HOME/volta" +export PATH="$VOLTA_HOME/bin:$PATH" + ### Ensure node is installed if ! command -v node > /dev/null; then if command -v brew; then diff --git a/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl index dbe3cae1..1c86e2bf 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_09-node-version.sh.tmpl @@ -11,6 +11,9 @@ {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} +export VOLTA_HOME="$XDG_DATA_HOME/volta" +export PATH="$VOLTA_HOME/bin:$PATH" + ### Ensure recent version of Node.js is being used if command -v volta > /dev/null; then if ! test "$(node --version | sed 's/^v//' | awk '{print $1}' | awk -F'.' ' ( $1 > 15) ')"; then diff --git a/home/.chezmoiscripts/universal/run_onchange_before_10-install-darwin-dependencies.sh.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_10-install-darwin-dependencies.sh.tmpl index 02a519c6..b9e32aa2 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_10-install-darwin-dependencies.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_10-install-darwin-dependencies.sh.tmpl @@ -11,6 +11,9 @@ {{ includeTemplate "universal/profile-before" }} {{ includeTemplate "universal/logg-before" }} +export VOLTA_HOME="$XDG_DATA_HOME/volta" +export PATH="$VOLTA_HOME/bin:$PATH" + if command -v brew > /dev/null; then logg 'Installing base dependencies for macOS using `brew bundle`' logg info 'Dependencies: age asdf jq node glow go go-task/tap/go-task gnupg gum m-cli progress volta yq m-cli yq zx' diff --git a/home/dot_config/shell/exports.sh.tmpl b/home/dot_config/shell/exports.sh.tmpl index f0973d3f..5d570ff1 100644 --- a/home/dot_config/shell/exports.sh.tmpl +++ b/home/dot_config/shell/exports.sh.tmpl @@ -195,6 +195,11 @@ if command -v fd > /dev/null; then export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" fi +### gcloud +if command -v python3 > /dev/null; then + export CLOUDSDK_PYTHON="$(which python3)" +fi + ### Git export GIT_MERGE_AUTOEDIT=no diff --git a/home/dot_local/bin/executable_install-program b/home/dot_local/bin/executable_install-program index 158e3a2d..a2d4d85a 100644 --- a/home/dot_local/bin/executable_install-program +++ b/home/dot_local/bin/executable_install-program @@ -1083,15 +1083,14 @@ async function ensurePackageManager(packageManager) { await $`brew install volta` } await $` - if [ -z "$VOLTA_HOME" ]; then - volta setup - fi + export VOLTA_HOME="\${XDG_DATA_HOME:-$HOME/.local/share}/volta" export PATH="$VOLTA_HOME/bin:$PATH" + volta setup volta install node ` } log('info', logStage, 'Ensuring Volt has Node.js runtime available') - await $`if ! volta list 2>&1 | grep 'runtime node' > /dev/null; then volta install node; fi` + await $`export VOLTA_HOME="\${XDG_DATA_HOME:-$HOME/.local/share}/volta" && export PATH="$VOLTA_HOME/bin:$PATH" && if ! volta list 2>&1 | grep 'runtime node' > /dev/null; then volta install node; fi` } else if (packageManager === 'pacman') { await ensureInstalled('pacman', false) } else if (packageManager === 'pipx') { diff --git a/home/dot_local/etc/cloudflared/config.yaml.tmpl b/home/dot_local/etc/cloudflared/config.yml.tmpl similarity index 100% rename from home/dot_local/etc/cloudflared/config.yaml.tmpl rename to home/dot_local/etc/cloudflared/config.yml.tmpl diff --git a/software.yml b/software.yml index 84f7971a..72691bbb 100644 --- a/software.yml +++ b/software.yml @@ -1154,7 +1154,6 @@ softwarePackages: _name: Bash Completion Formula _when: '! brew list bash-completion | grep bash-completion > /dev/null' brew: bash-completion@2 - brew: bash-completion@2 axel: _bin: axel _docs: null @@ -9440,6 +9439,8 @@ softwarePackages: _home: https://volta.sh _name: volta-vm _post: | + export VOLTA_HOME="$XDG_DATA_HOME/volta" + export PATH="$VOLTA_HOME/bin:$PATH" volta setup volta install node@latest ansible: professormanhattan.volta