Files
dotfiles/script/sjb-update-config
T
steveandgitadmin 02a5e0df28 init: new dotfile configuration
Remove all org files using a new script to more config over, The old org
file configuaration were great but required org. This new version only
requires the scripts that is included in the repo.

The configuration are all done but have not ported the theming system
yet.

Signed-off-by: Steve Beaulac <steve@sagacity.ca>
Change-Id: I14cd7fe058a71c8ba9d6d35397dc8d7e6a6a6964
2026-03-02 13:26:21 -05:00

45 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
config_file=$1
if [[ -z "$SJB_CONF_DIR" ]]; then
echo "Error: SJB_CONF_DIR is not set" >&2
exit 1
fi
if [[ -z "$config_file" ]]; then
cat <<USAGE
Usage: $0 [config_file]
Must provide a file path from the .config directory to be refreshed.
To copy ~/.local/share/omarchy/config/hypr/hyprlock.conf to ~/.config/hypr/hyprlock.conf
$0 hypr/hyprlock.conf
USAGE
exit 1
fi
# Backup the destination file (with timestamp) to avoid clobbering (Ex: hyprlock.conf.bak.1753817951)
user_config_file="${HOME}/.config/$config_file"
default_config_file="${SJB_CONF_DIR}/config/$config_file"
backup_config_file="$user_config_file.bak.$(date +%s)"
if [[ -f "$user_config_file" ]]; then
# Create preliminary backup
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
# Replace config with new default
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
# Compare and delete/inform accordingly
if cmp -s "$user_config_file" "$backup_config_file"; then
rm "$backup_config_file"
else
echo -e "\e[31mReplaced $user_config_file with new Omarchy default.\nSaved backup as ${backup_config_file}.\n\n\e[32mChanges:\e[0m"
diff "$user_config_file" "$backup_config_file" || true
fi
else
# Config file did not exist already
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
fi