Compare commits

..

No commits in common. "4cd270ac54e117e06f98a18906077e8821977d41" and "e37268fd8821b399b830ad12b6d81e0a45041f40" have entirely different histories.

4 changed files with 38 additions and 51 deletions

View File

@ -1,10 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
source /sync/scripts/backup_resources.sh
# FSFIXME expand_aliases still needed?
source /sync/home_external/.bash_aliases
shopt -s expand_aliases # make aliases work
backupRootDirectory() {
ensureRootDirectory $2
sd rsync_backup $1 $2
}
backupDirectory() {
ensureDirectory $2
rsync_backup $1 $2
}
ensureRootDirectory() {
ensureDirectory $1
sudo chown root:root $1
}
ensureDirectory() {
if [[ ! -e $1 ]]; then
mkdir -p $1
fi
}
###############################
### update local backup dir ###
###############################
@ -13,12 +37,10 @@ BACKUP_DIR=/sync/backup
ensureDirectory $BACKUP_DIR
BACKUP_DIR_HOME=$BACKUP_DIR/home
ensureDirectory $BACKUP_DIR_HOME
backupDirectory $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
ensureRootDirectory $BACKUP_DIR_ROOT
sd rsync_backup /etc/hosts $BACKUP_DIR_ROOT/
sd rsync_backup /etc/ddclient.conf $BACKUP_DIR_ROOT/
backupRootDirectory /etc/ddclient/ $BACKUP_DIR_ROOT/ddclient/
@ -38,4 +60,3 @@ fi
sd rsync_backup -e "ssh -i /home/edi/.ssh/id_ed25519" --filter="P /home/docker" /sync/backup/ fabian@garrus:/citadel/backup/edi/
sd rsync_backup -e "ssh -i /home/edi/.ssh/id_ed25519" /home/edi/docker/ fabian@garrus:/citadel/backup/edi/home/docker/
echo "Note: remember to keep /citadel in sync!"

View File

@ -1,22 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail
source /sync/scripts/backup_resources.sh
# FSFIXME expand_aliases still needed?
source /sync/home_external/.bash_aliases
shopt -s expand_aliases # make aliases work
###############################
### update local backup dir ###
###############################
BACKUP_DIR=/sync/backup
ensureDirectory $BACKUP_DIR
BACKUP_DIR_HOME=$BACKUP_DIR/home
ensureDirectory $BACKUP_DIR_HOME
if [[ !($HOME/.bash_aliases_local -ef $BACKUP_DIR_HOME/.bash_aliases_local) ]]; then
ln $HOME/.bash_aliases_local $BACKUP_DIR_HOME/.bash_aliases_local
fi
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
ensureRootDirectory $BACKUP_DIR_ROOT
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
rsync_backup --link-dest="/etc/ssh/" /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
if [[ !(-d $BACKUP_DIR_ROOT/udev/rules.d) ]]; then
mkdir $BACKUP_DIR_ROOT/udev/rules.d
fi
@ -24,7 +24,6 @@ if [[ !(/etc/udev/rules.d/69-hdparm.rules -ef $BACKUP_DIR_ROOT/udev/rules.d/69-h
ln /etc/udev/rules.d/69-hdparm.rules $BACKUP_DIR_ROOT/udev/rules.d/69-hdparm.rules
fi
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
#####################
### upload backup ###

View File

@ -1,30 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
source /sync/home_external/.bash_aliases
shopt -s expand_aliases # make aliases work
backupRootDirectory() {
ensureRootDirectory $2
sd rsync_backup $1 $2
}
backupDirectory() {
ensureDirectory $2
rsync_backup $1 $2
}
ensureRootDirectory() {
ensureDirectory $1
sudo chown root:root $1
}
ensureDirectory() {
if [[ ! -d $1 ]]; then
mkdir -p $1
fi
}

View File

@ -1,27 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
source /sync/scripts/backup_resources.sh
# FSFIXME expand_aliases still needed?
source /sync/home_external/.bash_aliases
shopt -s expand_aliases # make aliases work
###############################
### update local backup dir ###
###############################
BACKUP_DIR=/sync/backup
ensureDirectory $BACKUP_DIR
BACKUP_DIR_HOME=$BACKUP_DIR/home
ensureDirectory $BACKUP_DIR_HOME
if [[ !($HOME/.bash_aliases_local -ef $BACKUP_DIR_HOME/.bash_aliases_local) ]]; then
ln $HOME/.bash_aliases_local $BACKUP_DIR_HOME/.bash_aliases_local
fi
rsync_backup --link-dest="$HOME/.ssh/" $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
backupDirectory $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
#####################
### upload backup ###
#####################
if [[ "$1" == "--noupload" ]]; then
exit 0;
fi
sd rsync_backup -e "ssh -i /home/fabian/.ssh/id_ed25519" $BACKUP_DIR/ fabian@garrus:/citadel/backup/shepard/