2024-05-04 21:05:33 -07:00
#!/usr/bin/env bash
# @file Timeshift Configuration
# @brief Updates the Timeshift system configuration with the Timeshift configuration stored in the `home/dot_config/timeshift/timeshift.json` location.
# @description
# This script applies a Timeshift configuration that defines how Timeshift should maintain system backups.
2024-05-27 20:45:14 -07:00
set -Eeuo pipefail
2024-05-27 20:50:11 -07:00
trap "gum log -sl error 'Script encountered an error!'" ERR
2024-05-27 04:15:03 -07:00
2024-05-04 21:05:33 -07:00
if command -v timeshift > /dev/null; then
2024-05-27 20:50:11 -07:00
gum log -sl info 'Ensuring /etc/timeshift is a directory'
2024-05-04 21:05:33 -07:00
sudo mkdir -p /etc/timeshift
TIMESHIFT_CONFIG = " ${ XDG_CONFIG_HOME :- $HOME /.config } /timeshift/timeshift.json "
2024-05-27 20:50:11 -07:00
gum log -sl info " Copying $TIMESHIFT_CONFIG to /etc/timeshift/timeshift.json "
2024-05-04 21:05:33 -07:00
sudo cp -f " $TIMESHIFT_CONFIG " /etc/timeshift/timeshift.json
else
2024-05-27 20:50:11 -07:00
gum log -sl info 'The timeshift executable is not available'
2024-05-04 21:05:33 -07:00
fi