Compare commits
No commits in common. "7b1d0ef25179a29879e6dfffee736b1d1693fa3d" and "707b581b88a6d04846196e2ef9c1a56a2171162a" have entirely different histories.
7b1d0ef251
...
707b581b88
@ -186,29 +186,26 @@ colours() {
|
|||||||
|
|
||||||
# ex - archive extractor
|
# ex - archive extractor
|
||||||
# usage: ex <file>
|
# usage: ex <file>
|
||||||
ex() {
|
ex ()
|
||||||
if [[ ! -f "$1" ]]; then
|
{
|
||||||
echo "'$1' is not a valid file"
|
if [ -f $1 ] ; then
|
||||||
return 1;
|
case $1 in
|
||||||
fi
|
*.tar.bz2) tar xjf $1 ;;
|
||||||
# FIXME 7z kann (theoretisch) tar
|
*.tar.gz) tar xzf $1 ;;
|
||||||
outdir=${1%.*}
|
*.bz2) bunzip2 $1 ;;
|
||||||
case "$1" in
|
*.rar) unrar x $1 ;;
|
||||||
*.tar.bz2 | *.tbz | *.tbz2)
|
*.gz) gunzip $1 ;;
|
||||||
tar xjf $1 -C $outdir;;
|
*.tar) tar xf $1 ;;
|
||||||
*.tar.gz | *.tgz)
|
*.tbz2) tar xjf $1 ;;
|
||||||
tar xzf $1 -C $outdir;;
|
*.tgz) tar xzf $1 ;;
|
||||||
*.tar)
|
*.zip) unzip $1 ;;
|
||||||
tar xf $1 -C $outdir;;
|
*.Z) uncompress $1;;
|
||||||
*.7z | *.zip | *.gz | *.bz | *.bz2)
|
*.7z) 7z x $1 ;;
|
||||||
7z x -o$outdir $1;;
|
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||||
*.rar)
|
|
||||||
unrar x $1;;
|
|
||||||
*.Z)
|
|
||||||
uncompress $1;;
|
|
||||||
*)
|
|
||||||
echo "'$1' cannot be extracted via ex()";;
|
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
echo "'$1' is not a valid file"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# BEGIN_KITTY_SHELL_INTEGRATION
|
# BEGIN_KITTY_SHELL_INTEGRATION
|
||||||
|
@ -10,47 +10,20 @@ shopt -s expand_aliases # make aliases work
|
|||||||
###############################
|
###############################
|
||||||
|
|
||||||
BACKUP_DIR=/sync/backup
|
BACKUP_DIR=/sync/backup
|
||||||
ensureDirectory $BACKUP_DIR
|
|
||||||
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
||||||
ensureDirectory $BACKUP_DIR_HOME
|
rsync_backup $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
|
||||||
backupDirectory $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
|
|
||||||
|
|
||||||
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
||||||
ensureRootDirectory $BACKUP_DIR_ROOT
|
sd rsync_backup /etc/ddclient/ $BACKUP_DIR_ROOT/ddclient/
|
||||||
sd rsync_backup /etc/hosts $BACKUP_DIR_ROOT/
|
|
||||||
sd rsync_backup /etc/ddclient.conf $BACKUP_DIR_ROOT/
|
sd rsync_backup /etc/ddclient.conf $BACKUP_DIR_ROOT/
|
||||||
backupRootDirectory /etc/ddclient/ $BACKUP_DIR_ROOT/ddclient/
|
sd rsync_backup /etc/letsencrypt/ $BACKUP_DIR_ROOT/letsencrypt/
|
||||||
backupRootDirectory /etc/letsencrypt/ $BACKUP_DIR_ROOT/letsencrypt/
|
sd rsync_backup /etc/nginx/ $BACKUP_DIR_ROOT/nginx/
|
||||||
backupRootDirectory /etc/nginx/ $BACKUP_DIR_ROOT/nginx/
|
sd rsync_backup /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
||||||
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
sd rsync_backup /etc/wireguard/ $BACKUP_DIR_ROOT/wireguard/
|
||||||
backupRootDirectory /etc/wireguard/ $BACKUP_DIR_ROOT/wireguard/
|
sd rsync_backup /etc/hosts $BACKUP_DIR_ROOT/
|
||||||
backupRootDirectory /etc/docker/daemon.json $BACKUP_DIR_ROOT/docker/
|
sd rsync_backup /etc/docker/daemon.json $BACKUP_DIR_ROOT/docker/
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
### upload backup ###
|
### upload backup ###
|
||||||
#####################
|
#####################
|
||||||
|
Loading…
Reference in New Issue
Block a user