2023-01-09 16:06:45 -08:00
|
|
|
{{- if eq .host.distro.family "linux" -}}
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
|
|
|
### Create backups
|
2023-08-07 22:29:21 -07:00
|
|
|
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" ]; then
|
2023-12-24 22:50:02 -08:00
|
|
|
DCONF_TMP="$(mktemp)"
|
|
|
|
logg info 'Moving ~/.config/dconf/settings to '"$DCONF_TMP"
|
|
|
|
cp -rf "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" "$DCONF_TMP"
|
2023-01-09 16:06:45 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
### Ensure ~/.config/dconf/settings exists
|
2023-08-07 22:29:21 -07:00
|
|
|
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings"
|
2023-01-09 16:06:45 -08:00
|
|
|
|
|
|
|
### Overwrite ~/.config/dconf/settings configurations so we can diff with Chezmoi
|
2023-08-07 22:29:21 -07:00
|
|
|
find "${XDG_CONFIG_HOME:-$HOME/.config}/dconf/settings" -mindepth 1 -maxdepth 1 -type f | while read DCONF_CONFIG_FILE; do
|
2023-12-24 22:50:02 -08:00
|
|
|
DCONF_SETTINGS_ID="/$(basename "$DCONF_CONFIG_FILE" | sed 's/\./\//g')/"
|
|
|
|
logg info 'Dumping '"$DCONF_SETTINGS_ID"' to '"$DCONF_CONFIG_FILE"
|
|
|
|
dconf dump "$DCONF_SETTINGS_ID" > "$DCONF_CONFIG_FILE"
|
|
|
|
logg success 'Saved new configuration to '"$DCONF_CONFIG_FILE"
|
|
|
|
logg info 'Printing diff for '"$DCONF_CONFIG_FILE"
|
|
|
|
chezmoi diff "$DCONF_CONFIG_FILE" || true
|
2023-01-09 16:06:45 -08:00
|
|
|
done
|
|
|
|
|
|
|
|
{{ end -}}
|