Updated XDG_DATA_DIR to XDG_DATA_HOME

This commit is contained in:
Brian Zalewski 2023-01-31 00:44:52 -05:00
parent a79c561e8d
commit a98eb44949
5 changed files with 41 additions and 41 deletions

View file

@ -11,18 +11,18 @@
{{- end }} {{- end }}
logg info 'Ensuring Gas Station roles are symlinked to ~/.local/share/ansible/roles' 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 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/')" ROLE_FOLDER="professormanhattan.$(echo "$ROLE_PATH" | sed 's/.*\/\([^\/]*\)$/\1/')"
ALT_ROLE_FOLDER="$(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"'`' logg info 'Symlinking `'"$ROLE_FOLDER"'`'
rm -f "${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_DIR:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER" ln -s "$ROLE_PATH" "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ROLE_FOLDER"
fi 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 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_DIR:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" rm -f "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER"
ln -s "$ROLE_PATH" "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER" ln -s "$ROLE_PATH" "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/roles/$ALT_ROLE_FOLDER"
fi fi
done 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 ### Ensure Ansible Galaxy was successfully loaded and then install the Ansible Galaxy requirements
if command -v ansible-galaxy > /dev/null; then if command -v ansible-galaxy > /dev/null; then
logg info 'Ensuring Ansible Galaxy collections are installed' logg info 'Ensuring Ansible Galaxy collections are installed'
export ANSIBLE_CONFIG="${XDG_DATA_DIR:-$HOME/.local/share}/ansible/ansible.cfg" export ANSIBLE_CONFIG="${XDG_DATA_HOME:-$HOME/.local/share}/ansible/ansible.cfg"
ansible-galaxy install -r "${XDG_DATA_DIR:-$HOME/.local/share}/ansible/requirements.yml" || EXIT_CODE=$? ansible-galaxy install -r "${XDG_DATA_HOME:-$HOME/.local/share}/ansible/requirements.yml" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then if [ -n "$EXIT_CODE" ]; then
logg error 'Failed to install Ansible requirements from Ansible Galaxy' logg error 'Failed to install Ansible requirements from Ansible Galaxy'
if [ -d "$HOME/.local/src/gas-station/collections" ]; then if [ -d "$HOME/.local/src/gas-station/collections" ]; then

View file

@ -9,8 +9,8 @@
### Add Firefox enterprise profile ### Add Firefox enterprise profile
# TODO - figure out how to do this for other installations like Flatpak and macOS and Librewolf # 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 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 if [ -d "$FIREFOX_DIR" ] && [ -d "${XDG_DATA_HOME:-$HOME/.local/share}/firefox" ] && command -v rsync > /dev/null; then
sudo rsync -artvu "${XDG_DATA_DIR:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR" sudo rsync -artvu "${XDG_DATA_HOME:-$HOME/.local/share}/firefox/" "$FIREFOX_DIR"
fi fi
done done
@ -80,13 +80,13 @@ for SETTINGS_DIR in "$HOME/snap/firefox/common/.mozilla/firefox" "$HOME/.var/app
logg info 'Adding a secondary profile' logg info 'Adding a secondary profile'
rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.secondary" rsync -a "$SETTINGS_DIR/profile.default/" "$SETTINGS_DIR/profile.secondary"
fi 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 if [ -d /Applications ] && [ -d /System ]; then
# macOS # 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 else
# Linux # 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 fi
### Install Firefox addons (using list declared in .chezmoidata.yaml) ### Install Firefox addons (using list declared in .chezmoidata.yaml)

View file

@ -10,7 +10,7 @@ fi
### XDG ### XDG
XDG_CONFIG_HOME="$HOME/.config" XDG_CONFIG_HOME="$HOME/.config"
XDG_CACHE_HOME="$HOME/.cache" XDG_CACHE_HOME="$HOME/.cache"
XDG_DATA_DIR="$HOME/.local/share" XDG_DATA_HOME="$HOME/.local/share"
### Ensure Homebrew PATHs ### Ensure Homebrew PATHs
if [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then if [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then

View file

@ -24,8 +24,8 @@ if ! sudo cat /etc/sudoers | grep '# TEMPORARY FOR INSTALL DOCTOR' > /dev/null;
fi fi
### Ensure ~/.local/share/megabyte-labs is a directory ### Ensure ~/.local/share/megabyte-labs is a directory
if [ ! -d "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" ]; then if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" ]; then
mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs"
fi fi
### Qubes dom0 ### Qubes dom0
@ -237,19 +237,19 @@ fi
### Copy new files from src git repository to dotfiles with rsync ### Copy new files from src git repository to dotfiles with rsync
rsyncChezmoiFiles() { 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/docs/ "${XDG_DATA_HOME:-$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/home/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/install.doctor/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" & 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_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" & 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_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" & 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_DIR:-$HOME/.local/share}/chezmoi/software.yml" & rsync -rtvu /usr/local/src/install.doctor/software.yml "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/software.yml" &
wait wait
logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository' logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository'
} }
### Copy files to HOME folder with rsync ### Copy files to HOME folder with rsync
logg info 'Copying files from /usr/local/src/install.doctor to the HOME directory via 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 rsyncChezmoiFiles
### Ensure ~/.local/bin files are executable ### Ensure ~/.local/bin files are executable
logg info 'Ensuring scripts in ~/.local/bin are executable' logg info 'Ensuring scripts in ~/.local/bin are executable'
@ -290,15 +290,15 @@ else
fi fi
if [ -n "$FORCE_CHEZMOI" ]; then if [ -n "$FORCE_CHEZMOI" ]; then
if command -v unbuffer > /dev/null; 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 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 fi
else else
if command -v unbuffer > /dev/null; then 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 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
fi fi

View file

@ -9,8 +9,8 @@
# by calling the appropriate Chezmoi commands. # by calling the appropriate Chezmoi commands.
### Ensure ~/.local/share/megabyte-labs is a directory ### Ensure ~/.local/share/megabyte-labs is a directory
if [ ! -d "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" ]; then if [ ! -d "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs" ]; then
mkdir -p "${XDG_DATA_DIR:-$HOME/.local/share}/megabyte-labs" mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/megabyte-labs"
fi fi
# @description Installs glow (a markdown renderer) from GitHub releases # @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 ### Copy new files from src git repository to dotfiles with rsync
rsyncChezmoiFiles() { 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/docs/ "${XDG_DATA_HOME:-$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/home/ "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/home/" &
rsync -rtvu --delete /usr/local/src/install.doctor/system/ "${XDG_DATA_DIR:-$HOME/.local/share}/chezmoi/system/" & 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_DIR:-$HOME/.local/share}/chezmoi/.chezmoiignore" & 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_DIR:-$HOME/.local/share}/chezmoi/.chezmoiroot" & 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_DIR:-$HOME/.local/share}/chezmoi/software.yml" & rsync -rtvu /usr/local/src/install.doctor/software.yml "${XDG_DATA_HOME:-$HOME/.local/share}/chezmoi/software.yml" &
wait wait
logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository' logg success 'Successfully updated the ~/.local/share/chezmoi folder with changes from the upstream repository'
} }
### Copy files to HOME folder with rsync ### Copy files to HOME folder with rsync
logg info 'Copying files from /usr/local/src/install.doctor to the HOME directory via 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 rsyncChezmoiFiles
### Ensure ~/.local/bin files are executable ### Ensure ~/.local/bin files are executable
logg info 'Ensuring scripts in ~/.local/bin are executable' logg info 'Ensuring scripts in ~/.local/bin are executable'
@ -455,15 +455,15 @@ else
fi fi
if [ -n "$FORCE_CHEZMOI" ]; then if [ -n "$FORCE_CHEZMOI" ]; then
if command -v unbuffer > /dev/null; 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 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 fi
else else
if command -v unbuffer > /dev/null; then 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 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
fi fi