diff options
| author | Sam Scholten | 2025-10-22 16:44:53 +1000 |
|---|---|---|
| committer | Sam Scholten | 2025-10-22 16:44:53 +1000 |
| commit | 61ca95ae5929928ebfa50b8d99b18cf21c3e2ca7 (patch) | |
| tree | 0124c23545f21aee35107efb42a7827bb93e3179 /update.sh | |
| parent | 4352c0aedd3236b805977da8fc910fb8f46a9e2d (diff) | |
| download | drestic-1.2.tar.gz drestic-1.2.zip | |
Fix: Replace unsupported restic flags for 0.18.1 compatibilityv1.2
- Replace --lock-retry-after and --lock-stale-timeout with --retry-lock
- Fix shell script quoting issues (SC2086, SC2046)
- All tests passing: local, remote, lint, format
Diffstat (limited to 'update.sh')
| -rwxr-xr-x | update.sh | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -36,23 +36,23 @@ check_permissions() { backup_configs() { local install_type="$1" local backup_dir - + if [ "$install_type" = "system" ]; then backup_dir="/etc/restic/backup-$(date +%Y%m%d-%H%M%S)" sudo mkdir -p "$backup_dir" - else + else backup_dir="$HOME/.config/restic/backup-$(date +%Y%m%d-%H%M%S)" mkdir -p "$backup_dir" fi - + log "Backing up configuration to $backup_dir" - + if [ "$install_type" = "system" ]; then sudo cp -r /etc/restic/* "$backup_dir/" 2>/dev/null || true - else + else cp -r "$HOME/.config/restic"/* "$backup_dir/" 2>/dev/null || true fi - + echo "$backup_dir" } @@ -60,7 +60,7 @@ backup_configs() { update_scripts() { local install_type="$1" local install_dir - + if [ "$install_type" = "system" ]; then install_dir="/usr/local/bin" log "Updating scripts in $install_dir" @@ -83,7 +83,7 @@ update_scripts() { update_services() { local install_type="$1" local systemd_dir - + if [ "$install_type" = "system" ]; then systemd_dir="/etc/systemd/system" log "Updating systemd services in $systemd_dir" @@ -104,13 +104,13 @@ update_services() { update_bandwidth() { local install_type="$1" local env_file - + if [ "$install_type" = "system" ]; then env_file="/root/.restic_env" else env_file="$HOME/.config/restic/env" fi - + # Check if file exists and has old bandwidth setting if [ -f "$env_file" ] && grep -q "RCLONE_BWLIMIT=1M" "$env_file"; then log "Updating rclone bandwidth limit from 1M to 2M" @@ -125,7 +125,7 @@ update_bandwidth() { # Restart services restart_services() { local install_type="$1" - + log "Restarting systemd timers" if [ "$install_type" = "system" ]; then sudo systemctl restart restic-backup.timer restic-check.timer @@ -141,39 +141,39 @@ restart_services() { # Main update logic main() { log "Starting drestic update process" - + # Get script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" - + # Check we're in a git repo - if ! git rev-parse --git-dir > /dev/null 2>&1; then + if ! git rev-parse --git-dir >/dev/null 2>&1; then error "Not in a git repository. Please run from drestic directory." fi - + # Detect installation type install_type=$(detect_installation) log "Detected $install_type installation" - + # Check permissions check_permissions "$install_type" - + # Backup configs backup_dir=$(backup_configs "$install_type") log "Configuration backed up to: $backup_dir" - + # Update scripts update_scripts "$install_type" - + # Update services update_services "$install_type" - + # Update bandwidth (optional) update_bandwidth "$install_type" - + # Restart services restart_services "$install_type" - + log "Update completed successfully!" echo "" echo "Key improvements in this update:" @@ -186,4 +186,4 @@ main() { } # Run main function -main "$@"
\ No newline at end of file +main "$@" |
