No backup if user config doesn't already exist
This commit is contained in:
parent
f223bbcb98
commit
93980e6138
@ -20,6 +20,7 @@ user_config_file="${HOME}/.config/$config_file"
|
|||||||
default_config_file="${HOME}/.local/share/omarchy/config/$config_file"
|
default_config_file="${HOME}/.local/share/omarchy/config/$config_file"
|
||||||
backup_config_file="$user_config_file.bak.$(date +%s)"
|
backup_config_file="$user_config_file.bak.$(date +%s)"
|
||||||
|
|
||||||
|
if [[ -f "$user_config_file" ]]; then
|
||||||
# Create preliminary backup
|
# Create preliminary backup
|
||||||
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
|
cp -f "$user_config_file" "$backup_config_file" 2>/dev/null
|
||||||
|
|
||||||
@ -33,3 +34,7 @@ else
|
|||||||
echo -e "\e[31mReplaced $user_config_file with new Omarchy default.\nSaved backup as ${backup_config_file}.\n\n\e[32mChanges:\e[0m"
|
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"
|
diff "$user_config_file" "$backup_config_file"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# Config file did not exist already
|
||||||
|
cp -f "$default_config_file" "$user_config_file" 2>/dev/null
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user