install.fairie/home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl
Brian Zalewski 49148f1473 Update 3 files
- /home/.chezmoiscripts/universal/run_onchange_after_3-system-bin.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_19-theme-files.tmpl
- /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl
2023-01-10 09:27:32 +00:00

43 lines
1.6 KiB
Cheetah

{{- if (eq .host.distro.family "linux") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}
### Ensure /usr/local/bin/squash-symlink is present
if [ ! -f /usr/local/bin/squash-symlink ] && [ -f "$HOME/.local/bin/squash-symlink" ]; then
logg info 'Copying ~/.local/bin/squash-symlink to /usr/local/bin/squash-symlink'
sudo cp -f "$HOME/.local/bin/squash-symlink" /usr/local/bin/squash-symlink
fi
### Clean up system theme settings
for ITEM_TO_BE_REMOVED in "/usr/share/backgrounds/images" "/usr/share/backgrounds/f32" "/usr/share/backgrounds/qubes" "/usr/share/wallpapers"; do
if [ -d "$ITEM_TO_BE_REMOVED" ] || [ -f "$ITEM_TO_BE_REMOVED" ]; then
sudo rm -rf "$ITEM_TO_BE_REMOVED"
logg success "Removed $ITEM_TO_BE_REMOVED"
fi
done
### Ensure /usr/local/share exists
if [ ! -d /usr/local/share ]; then
sudo mkdir -p /usr/local/share
logg success 'Created /usr/local/share'
fi
### Copy theme files over to /usr/local/share
if [ -d "$HOME/.local/src/{{ .theme | lower }}/share" ]; then
logg info 'Copying ~/.local/src/{{ .theme | lower }}/share to /usr/local/share'
sudo cp -rf ~/.local/src/betelgeuse/share /usr/local/
else
logg warn '~/.local/src/betelgeuse/share is missing'
fi
### Flatten theme files (i.e. convert symlinks to regular files)
if command -v squash-symlink > /dev/null; then
logg info 'Converting all theme symlinks to equivalent regular files'
sudo find /usr/local/share -type l -exec squash-symlink {} +
else
logg warn '`squash-symlink` is not a script in the PATH'
fi
{{ end -}}