diff --git a/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl index 3bd8c00d..1ef5721e 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_11-symlink-ansible-roles.tmpl @@ -11,18 +11,18 @@ {{- end }} logg info 'Ensuring Gas Station roles are symlinked to ~/.local/share/ansible/roles' -mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles" +mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles" find "$HOME/.local/src/gas-station/roles" -mindepth 2 -maxdepth 2 -type d | while read ROLE_PATH; do ROLE_FOLDER="professormanhattan.$(echo "$ROLE_PATH" | sed 's/.*\/\([^\/]*\)$/\1/')" ALT_ROLE_FOLDER="$(echo "$ROLE_PATH" | sed 's/.*\/\([^\/]*\)$/\1/')" - if [ ! -d "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" ] || [ "$(readlink -f "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER")" != "$ROLE_PATH" ]; then + if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" ] || [ "$(readlink -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER")" != "$ROLE_PATH" ]; then logg info 'Symlinking `'"$ROLE_FOLDER"'`' - rm -f "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" - ln -s "$ROLE_PATH" "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" + rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" + ln -s "$ROLE_PATH" "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" fi - if [ ! -d "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" ] || [ "$(readlink -f "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER")" != "$ROLE_PATH" ]; then - rm -f "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" - ln -s "$ROLE_PATH" "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" + if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" ] || [ "$(readlink -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER")" != "$ROLE_PATH" ]; then + rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" + ln -s "$ROLE_PATH" "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" fi done @@ -50,8 +50,8 @@ if [ -f "$HOME/.local/src/gas-station/requirements.yml" ]; then ### Ensure Ansible Galaxy was successfully loaded and then install the Ansible Galaxy requirements if command -v ansible-galaxy > /dev/null; then logg info 'Ensuring Ansible Galaxy collections are installed' - export ANSIBLE_CONFIG="${XDG_DATA_DIR:-$HOME/.local/share}/ansible/ansible.cfg" - ansible-galaxy install -r "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/requirements.yml" || EXIT_CODE=$? + export ANSIBLE_CONFIG="${XDG_DATA_HOME:-$HOME/.local/share}/ansible/ansible.cfg" + ansible-galaxy install -r "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/requirements.yml" || EXIT_CODE=$? if [ -n "$EXIT_CODE" ]; then logg error 'Failed to install Ansible requirements from Ansible Galaxy' if [ -d "$HOME/.local/src/gas-station/collections" ]; then diff --git a/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl index a6b6e459..cbf2073b 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_40-firefox.tmpl @@ -9,8 +9,8 @@ ### Add Firefox enterprise profile # TODO - figure out how to do this for other installations like Flatpak and macOS and Librewolf for FIREFOX_DIR in '/usr/lib/firefox' '/usr/lib/firefox-esr' '/Applications/Firefox.app/Contents/Resources'; do - if [ -d "$FIREFOX_DIR" ] && [ -d "${XDG_DATA_DIR:-$HOME/.local/share}/firefox" ] && command -v rsync > /dev/null; then - sudo rsync -artvu "${XDG_DATA_DIR:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR" + if [ -d "$FIREFOX_DIR" ] && [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/firefox" ] && command -v rsync > /dev/null; then + sudo rsync -artvu "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR" fi done @@ -80,13 +80,13 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app logg info 'Adding a secondary profile' rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.secondary" fi - logg info "Copying "${XDG_DATA_DIR:-$HOME/.local/share}/firefox/profiles.ini" to profile directory" + logg info "Copying "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" to profile directory" if [ -d /Applications ] && [ -d /System ]; then # macOS - cp -f "${XDG_DATA_DIR:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/../profiles.ini" + cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/../profiles.ini" else # Linux - cp -f "${XDG_DATA_DIR:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/profiles.ini" + cp -f "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/profiles.ini" "$SETTINGS_DIR/profiles.ini" fi ### Install Firefox addons (using list declared in .chezmoidata.yaml) diff --git a/home/.chezmoitemplates/universal/profile-inline b/home/.chezmoitemplates/universal/profile-inline index 6dcb1b6d..d357c48d 100644 --- a/home/.chezmoitemplates/universal/profile-inline +++ b/home/.chezmoitemplates/universal/profile-inline @@ -10,7 +10,7 @@ fi ### XDG XDG_CONFIG_HOME="$HOME/.config" XDG_CACHE_HOME="$HOME/.cache" -XDG_DATA_DIR="$HOME/.local/share" +XDG_DATA_HOME="$HOME/.local/share" ### Ensure Homebrew PATHs if [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then diff --git a/home/dot_local/bin/executable_provision.tmpl b/home/dot_local/bin/executable_provision.tmpl index 6ff259f3..a978a13c 100644 --- a/home/dot_local/bin/executable_provision.tmpl +++ b/home/dot_local/bin/executable_provision.tmpl @@ -24,8 +24,8 @@ if ! sudo cat /etc/sudoers | grep '# TEMPORARY FOR INSTALL DOCTOR' > /dev/null; fi ### Ensure ~/.local/share/megabyte-labs is a directory -if [ ! -d "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" ]; then - mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" +if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" ]; then + mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" fi ### Qubes dom0 @@ -237,19 +237,19 @@ fi ### Copy new files from src git repository to dotfiles with rsync rsyncChezmoiFiles() { - rsync -rtvu --delete /usr/local/src/install.doctor/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" & - rsync -rtvu --delete /usr/local/src/install.doctor/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" & - rsync -rtvu --delete /usr/local/src/install.doctor/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" & - rsync -rtvu /usr/local/src/install.doctor/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" & - rsync -rtvu /usr/local/src/install.doctor/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" & - rsync -rtvu /usr/local/src/install.doctor/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" & + rsync -rtvu --delete /usr/local/src/install.doctor/docs/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/" & + rsync -rtvu --delete /usr/local/src/install.doctor/home/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/" & + rsync -rtvu --delete /usr/local/src/install.doctor/system/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/system/" & + rsync -rtvu /usr/local/src/install.doctor/.chezmoiignore "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/.chezmoiignore" & + rsync -rtvu /usr/local/src/install.doctor/.chezmoiroot "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/.chezmoiroot" & + rsync -rtvu /usr/local/src/install.doctor/software.yml "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/software.yml" & wait logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository' } ### Copy files to HOME folder with rsync logg info 'Copying files from /usr/local/src/install.doctor to the HOME directory via rsync' -mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi" +mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi" rsyncChezmoiFiles ### Ensure ~/.local/bin files are executable logg info 'Ensuring scripts in ~/.local/bin are executable' @@ -290,15 +290,15 @@ else fi if [ -n "$FORCE_CHEZMOI" ]; then if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" fi else if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" fi fi diff --git a/local/provision.sh b/local/provision.sh index 694f3f87..57f998f9 100644 --- a/local/provision.sh +++ b/local/provision.sh @@ -9,8 +9,8 @@ # by calling the appropriate Chezmoi commands. ### Ensure ~/.local/share/megabyte-labs is a directory -if [ ! -d "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" ]; then - mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" +if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" ]; then + mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" fi # @description Installs glow (a markdown renderer) from GitHub releases @@ -402,19 +402,19 @@ fi ### Copy new files from src git repository to dotfiles with rsync rsyncChezmoiFiles() { - rsync -rtvu --delete /usr/local/src/install.doctor/docs/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/docs/" & - rsync -rtvu --delete /usr/local/src/install.doctor/home/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/home/" & - rsync -rtvu --delete /usr/local/src/install.doctor/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" & - rsync -rtvu /usr/local/src/install.doctor/.chezmoiignore "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" & - rsync -rtvu /usr/local/src/install.doctor/.chezmoiroot "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" & - rsync -rtvu /usr/local/src/install.doctor/software.yml "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/software.yml" & + rsync -rtvu --delete /usr/local/src/install.doctor/docs/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/docs/" & + rsync -rtvu --delete /usr/local/src/install.doctor/home/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/" & + rsync -rtvu --delete /usr/local/src/install.doctor/system/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/system/" & + rsync -rtvu /usr/local/src/install.doctor/.chezmoiignore "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/.chezmoiignore" & + rsync -rtvu /usr/local/src/install.doctor/.chezmoiroot "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/.chezmoiroot" & + rsync -rtvu /usr/local/src/install.doctor/software.yml "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/software.yml" & wait logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository' } ### Copy files to HOME folder with rsync logg info 'Copying files from /usr/local/src/install.doctor to the HOME directory via rsync' -mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi" +mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi" rsyncChezmoiFiles ### Ensure ~/.local/bin files are executable logg info 'Ensuring scripts in ~/.local/bin are executable' @@ -455,15 +455,15 @@ else fi if [ -n "$FORCE_CHEZMOI" ]; then if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" else - chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k --force 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" fi else if command -v unbuffer > /dev/null; then - unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + unbuffer -p chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" else - chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" + chezmoi apply $DEBUG_MODIFIER -k 2>&1 | tee "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs/betelgeuse.$(date +%s).log" fi fi