sync/scripts/backup_garrus.sh

40 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
2024-03-17 17:58:00 +01:00
source /sync/scripts/backup_resources.sh
# FSFIXME expand_aliases still needed?
shopt -s expand_aliases # make aliases work
###############################
### update local backup dir ###
###############################
BACKUP_DIR=/sync/backup
2024-03-17 17:58:00 +01:00
ensureDirectory $BACKUP_DIR
BACKUP_DIR_HOME=$BACKUP_DIR/home
2024-03-17 17:58:00 +01:00
ensureDirectory $BACKUP_DIR_HOME
2023-05-06 05:44:19 +02:00
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
2024-03-17 17:58:00 +01:00
ensureRootDirectory $BACKUP_DIR_ROOT
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
if [[ !(-d $BACKUP_DIR_ROOT/udev/rules.d) ]]; then
mkdir $BACKUP_DIR_ROOT/udev/rules.d
fi
if [[ !(/etc/udev/rules.d/69-hdparm.rules -ef $BACKUP_DIR_ROOT/udev/rules.d/69-hdparm.rules) ]]; then
ln /etc/udev/rules.d/69-hdparm.rules $BACKUP_DIR_ROOT/udev/rules.d/69-hdparm.rules
fi
2024-03-17 17:58:00 +01:00
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
2023-05-06 04:54:15 +02:00
#####################
### upload backup ###
#####################
2023-09-24 15:11:14 +02:00
echo 'upload of backup still manual for now.\nplease execute the following commands:'
echo 'su garrus'
2023-09-24 15:11:14 +02:00
echo "sd rsync_backup $BACKUP_DIR/ /citadel/backup/garrus/"
exit 0
su garrus
sd rsync_backup $BACKUP_DIR/ /citadel/backup/garrus/