Compare commits
37 Commits
3d740f1c3b
...
debian_alt
Author | SHA1 | Date | |
---|---|---|---|
4cd270ac54 | |||
553d15e38b | |||
e37268fd88 | |||
46e9aea2dd | |||
f23a40f524 | |||
7b1d0ef251 | |||
36e122b62c | |||
96893dff23 | |||
707b581b88 | |||
31e618be9e | |||
91d3d1d98d | |||
d79688f50f | |||
34baf7e029 | |||
3820ea0297 | |||
43a70bb9de | |||
c926e32cda | |||
0848db107c | |||
236672fd44 | |||
e2f4267b7a | |||
6f16c5e710 | |||
784818b510 | |||
afbfeef4d2 | |||
8e29301d96 | |||
937fe0142d | |||
6fb25215b5 | |||
3837b797d0 | |||
812805ced5 | |||
32c066fe4d | |||
8ebda1aa12 | |||
632a0c6741 | |||
e08fa4f6a6 | |||
fc13f9b73e | |||
1ab292fe6f | |||
25065ea703 | |||
bb48fa187f | |||
fd9dba9f12 | |||
ba623040b9 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
/backup
|
/backup
|
||||||
output.txt
|
output.txt
|
||||||
.bash_aliases_local
|
/.sublime
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"folders":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"path": ".."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -19,6 +19,7 @@ alias rsync_backup="rsync $DEFAULT_RSYNC --checksum --times --group --owner --de
|
|||||||
alias rsync_move="rsync $DEFAULT_RSYNC --checksum --remove-source-files"
|
alias rsync_move="rsync $DEFAULT_RSYNC --checksum --remove-source-files"
|
||||||
alias rsync_update="rsync $DEFAULT_RSYNC --update --times"
|
alias rsync_update="rsync $DEFAULT_RSYNC --update --times"
|
||||||
alias rsync_copy="rsync $DEFAULT_RSYNC --ignore-times"
|
alias rsync_copy="rsync $DEFAULT_RSYNC --ignore-times"
|
||||||
|
alias copy_link='cp --no-dereference --recursive --preserve=all --link' # not --force to make it optional
|
||||||
alias off='systemctl poweroff'
|
alias off='systemctl poweroff'
|
||||||
alias nnn='nnn -dHrR'
|
alias nnn='nnn -dHrR'
|
||||||
alias nn='n -dHrR'
|
alias nn='n -dHrR'
|
||||||
@ -29,6 +30,31 @@ alias mountdrive='udisksctl mount -b'
|
|||||||
alias unmountdrive='udisksctl unmount -b'
|
alias unmountdrive='udisksctl unmount -b'
|
||||||
alias fssizes='df -kh --output=size,used,avail,pcent,target | sort -hr'
|
alias fssizes='df -kh --output=size,used,avail,pcent,target | sort -hr'
|
||||||
alias dirsizes='du -kh --apparent-size --max-depth=1 | sort -hr'
|
alias dirsizes='du -kh --apparent-size --max-depth=1 | sort -hr'
|
||||||
|
# sed -ie 's/Beispiel/Ersetzung/' *.xml
|
||||||
|
# sed -Eie 's/(Beispiel)/\1Anhang/' *.xml
|
||||||
|
alias start_x11_vnc="x11vnc -many -display :0 -no6 -rfbport 5900 -auth /var/run/lightdm/root/:0 -rfbauth $HOME/.vnc/passwd"
|
||||||
|
|
||||||
|
|
||||||
|
rsyncLink() {
|
||||||
|
source=$1;
|
||||||
|
linkSource="$(realpath $source)";
|
||||||
|
linkSource=${linkSource%/}; # cut off trailing "/"
|
||||||
|
shift;
|
||||||
|
dest=$1;
|
||||||
|
shift;
|
||||||
|
rsync $DEFAULT_RSYNC --one-file-system --link-dest=$linkSource $source $dest $*;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateSystem() {
|
||||||
|
executeAndNotify "doUpdateSystem $1" "system updated" "system update failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doUpdateSystem() {
|
||||||
|
updatePackages $1;
|
||||||
|
updateFlatpak $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
updateFlatpak() {
|
updateFlatpak() {
|
||||||
@ -42,7 +68,7 @@ updateFlatpak() {
|
|||||||
|
|
||||||
doUpdateFlatpak() {
|
doUpdateFlatpak() {
|
||||||
flatpak update $1;
|
flatpak update $1;
|
||||||
flatpak remove --unused $1
|
flatpak remove --unused $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,10 +76,10 @@ doUpdateFlatpak() {
|
|||||||
execute() {
|
execute() {
|
||||||
dir="$(pwd)";
|
dir="$(pwd)";
|
||||||
dir=${dir##*/};
|
dir=${dir##*/};
|
||||||
if [ -n "$2" ]; then
|
if [[ -n "$2" ]]; then
|
||||||
errLog=$2
|
errLog=$2;
|
||||||
else
|
else
|
||||||
errLog="execution of \"$1\" failed"
|
errLog="execution of \"$1\" failed";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! $1; then
|
if ! $1; then
|
||||||
@ -66,33 +92,33 @@ execute() {
|
|||||||
# executes command and notifies upon success or failure
|
# executes command and notifies upon success or failure
|
||||||
executeAndNotify () {
|
executeAndNotify () {
|
||||||
dir="$(pwd)";
|
dir="$(pwd)";
|
||||||
dir=${dir##*/};
|
dir=${dir##*/}; # cut off previous path (/path/to/foo.txt -> foo.txt)
|
||||||
if [ -n "$2" ]; then
|
if [[ -n "$2" ]]; then
|
||||||
winLog=$2
|
winLog=$2;
|
||||||
else
|
else
|
||||||
winLog="execution of \"$1\" succeeded"
|
winLog="execution of \"$1\" succeeded";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! execute "$1" "$3"; then # arguments in quotes so they are interpreted as ONE argument each by execute()
|
if ! execute "$1" "$3"; then # arguments in quotes so they are interpreted as ONE argument each by execute()
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
notifyInfo "$dir: $winLog"
|
notifyInfo "$dir: $winLog";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# find file but don't print errors (e.g. can't access directory etc.)
|
# find file but don't print errors (e.g. can't access directory etc.)
|
||||||
finds () {
|
finds () {
|
||||||
find $* 2>/dev/null
|
find $* 2>/dev/null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# sends a desktop-notification with an icon signalling an error
|
# sends a desktop-notification with an icon signalling an error
|
||||||
notifyError () {
|
notifyError () {
|
||||||
notify-send "$1" --icon=data-warning
|
notify-send "$1" --icon=data-warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# sends a desktop-notification with an icon signalling a simple information
|
# sends a desktop-notification with an icon signalling a simple information
|
||||||
notifyInfo () {
|
notifyInfo () {
|
||||||
notify-send "$1" --icon=preferences-desktop-notification
|
notify-send "$1" --icon=preferences-desktop-notification;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
updateSystem() {
|
|
||||||
|
updatePackages() {
|
||||||
noconfirm=
|
noconfirm=
|
||||||
if [[ $1 == "-y" ]]; then
|
if [[ $1 == "-y" ]]; then
|
||||||
noconfirm="--assume-yes"
|
noconfirm="--assume-yes"
|
||||||
@ -9,11 +10,11 @@ updateSystem() {
|
|||||||
if [[ $2 == "--full" ]]; then
|
if [[ $2 == "--full" ]]; then
|
||||||
full="full-"
|
full="full-"
|
||||||
fi
|
fi
|
||||||
executeAndNotify "doUpdateSystem $noconfirm $full" "system updated" "system update failed";
|
executeAndNotify "doUpdatePackages $noconfirm $full" "system updated" "system update failed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
doUpdateSystem() {
|
doUpdatePackages() {
|
||||||
sudo apt update;
|
sudo apt update;
|
||||||
sudo apt ${2}upgrade $1;
|
sudo apt ${2}upgrade $1;
|
||||||
sudo apt autoremove $1;
|
sudo apt autoremove $1;
|
@ -46,6 +46,8 @@ shopt -s checkwinsize
|
|||||||
# match all files and zero or more directories and subdirectories.
|
# match all files and zero or more directories and subdirectories.
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
|
|
||||||
|
shopt -s dotglob
|
||||||
|
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
if [ -x /usr/bin/lesspipe ]; then
|
if [ -x /usr/bin/lesspipe ]; then
|
||||||
eval "$(SHELL=/bin/sh lesspipe)"
|
eval "$(SHELL=/bin/sh lesspipe)"
|
||||||
@ -184,26 +186,29 @@ colours() {
|
|||||||
|
|
||||||
# ex - archive extractor
|
# ex - archive extractor
|
||||||
# usage: ex <file>
|
# usage: ex <file>
|
||||||
ex ()
|
ex() {
|
||||||
{
|
if [[ ! -f "$1" ]]; then
|
||||||
if [ -f $1 ] ; then
|
echo "'$1' is not a valid file"
|
||||||
case $1 in
|
return 1;
|
||||||
*.tar.bz2) tar xjf $1 ;;
|
fi
|
||||||
*.tar.gz) tar xzf $1 ;;
|
# FIXME 7z kann (theoretisch) tar
|
||||||
*.bz2) bunzip2 $1 ;;
|
outdir=${1%.*}
|
||||||
*.rar) unrar x $1 ;;
|
case "$1" in
|
||||||
*.gz) gunzip $1 ;;
|
*.tar.bz2 | *.tbz | *.tbz2)
|
||||||
*.tar) tar xf $1 ;;
|
tar xjf $1 -C $outdir;;
|
||||||
*.tbz2) tar xjf $1 ;;
|
*.tar.gz | *.tgz)
|
||||||
*.tgz) tar xzf $1 ;;
|
tar xzf $1 -C $outdir;;
|
||||||
*.zip) unzip $1 ;;
|
*.tar)
|
||||||
*.Z) uncompress $1;;
|
tar xf $1 -C $outdir;;
|
||||||
*.7z) 7z x $1 ;;
|
*.7z | *.zip | *.gz | *.bz | *.bz2)
|
||||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
7z x -o$outdir $1;;
|
||||||
esac
|
*.rar)
|
||||||
else
|
unrar x $1;;
|
||||||
echo "'$1' is not a valid file"
|
*.Z)
|
||||||
fi
|
uncompress $1;;
|
||||||
|
*)
|
||||||
|
echo "'$1' cannot be extracted via ex()";;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# BEGIN_KITTY_SHELL_INTEGRATION
|
# BEGIN_KITTY_SHELL_INTEGRATION
|
||||||
|
@ -44,4 +44,5 @@
|
|||||||
"use_tab_stops": false,
|
"use_tab_stops": false,
|
||||||
"word_wrap": true,
|
"word_wrap": true,
|
||||||
"wrap_width": 120,
|
"wrap_width": 120,
|
||||||
|
"index_files": true,
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -63,10 +63,6 @@ PasswordAuthentication no
|
|||||||
|
|
||||||
# Change to yes to enable challenge-response passwords (beware issues with
|
# Change to yes to enable challenge-response passwords (beware issues with
|
||||||
# some PAM modules and threads)
|
# some PAM modules and threads)
|
||||||
# FIXME! outdated/ replaced by KbdInteractiveAuthentication?
|
|
||||||
ChallengeResponseAuthentication no
|
|
||||||
|
|
||||||
# Change to no to disable s/key passwords
|
|
||||||
KbdInteractiveAuthentication no
|
KbdInteractiveAuthentication no
|
||||||
|
|
||||||
# Kerberos options
|
# Kerberos options
|
||||||
@ -86,7 +82,7 @@ KbdInteractiveAuthentication no
|
|||||||
# be allowed through the KbdInteractiveAuthentication and
|
# be allowed through the KbdInteractiveAuthentication and
|
||||||
# PasswordAuthentication. Depending on your PAM configuration,
|
# PasswordAuthentication. Depending on your PAM configuration,
|
||||||
# PAM authentication via KbdInteractiveAuthentication may bypass
|
# PAM authentication via KbdInteractiveAuthentication may bypass
|
||||||
# the setting of "PermitRootLogin without-password".
|
# the setting of "PermitRootLogin prohibit-password".
|
||||||
# If you just want the PAM account and session checks to run without
|
# If you just want the PAM account and session checks to run without
|
||||||
# PAM authentication, then enable this but set PasswordAuthentication
|
# PAM authentication, then enable this but set PasswordAuthentication
|
||||||
# and KbdInteractiveAuthentication to 'no'.
|
# and KbdInteractiveAuthentication to 'no'.
|
||||||
@ -122,10 +118,10 @@ PrintMotd no # pam does that
|
|||||||
AcceptEnv LANG LC_*
|
AcceptEnv LANG LC_*
|
||||||
|
|
||||||
# override default of no subsystems
|
# override default of no subsystems
|
||||||
# DEACTIVATED because no need for sftp and differences between debian and arch
|
|
||||||
# debian
|
# debian
|
||||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||||
# arch
|
# arch
|
||||||
|
# DEACTIVATED because no need for sftp and differences between debian and arch
|
||||||
# Subsystem sftp /usr/lib/ssh/sftp-server
|
# Subsystem sftp /usr/lib/ssh/sftp-server
|
||||||
|
|
||||||
# Example of overriding settings on a per-user basis
|
# Example of overriding settings on a per-user basis
|
||||||
|
3
scripts/archive_and_compress.sh
Executable file
3
scripts/archive_and_compress.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source=${1%/}; # cut off trailing "/"
|
||||||
|
tar cfv $source.tar $source && xz $source.tar;
|
@ -1,35 +1,41 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
source /sync/home_external/.bash_aliases
|
source /sync/scripts/backup_resources.sh
|
||||||
|
# FSFIXME expand_aliases still needed?
|
||||||
shopt -s expand_aliases # make aliases work
|
shopt -s expand_aliases # make aliases work
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
### update local backup dir ###
|
### update local backup dir ###
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
BACKUP_DIR=/sync/backup
|
BACKUP_DIR=/sync/backup
|
||||||
|
ensureDirectory $BACKUP_DIR
|
||||||
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
||||||
if [[ !($HOME/.bash_aliases_local -ef $BACKUP_DIR_HOME/.bash_aliases_local) ]]; then
|
ensureDirectory $BACKUP_DIR_HOME
|
||||||
ln $HOME/.bash_aliases_local $BACKUP_DIR_HOME/.bash_aliases_local
|
|
||||||
fi
|
backupDirectory $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
|
||||||
rsync_backup --link-dest="$HOME/.ssh/" $HOME/.ssh/ $BACKUP_DIR_HOME/.ssh/
|
|
||||||
|
|
||||||
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
||||||
sd rsync_backup --link-dest="/etc/ddclient/" /etc/ddclient/ $BACKUP_DIR_ROOT/ddclient/
|
ensureRootDirectory $BACKUP_DIR_ROOT
|
||||||
sd rsync_backup --link-dest="/etc/letsencrypt/" /etc/letsencrypt/ $BACKUP_DIR_ROOT/letsencrypt/
|
|
||||||
sd rsync_backup --link-dest="/etc/nginx/" /etc/nginx/ $BACKUP_DIR_ROOT/nginx/
|
|
||||||
sd rsync_backup --link-dest="/etc/ssh/" /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
|
||||||
sd rsync_backup --link-dest="/etc/wireguard/" /etc/wireguard/ $BACKUP_DIR_ROOT/wireguard/
|
|
||||||
if [[ !(/etc/ddclient.conf -ef $BACKUP_DIR_ROOT/ddclient.conf) ]]; then
|
|
||||||
ln /etc/ddclient.conf $BACKUP_DIR_ROOT/ddclient.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
sd rsync_backup /etc/hosts $BACKUP_DIR_ROOT/
|
||||||
|
sd rsync_backup /etc/ddclient.conf $BACKUP_DIR_ROOT/
|
||||||
|
backupRootDirectory /etc/ddclient/ $BACKUP_DIR_ROOT/ddclient/
|
||||||
|
backupRootDirectory /etc/letsencrypt/ $BACKUP_DIR_ROOT/letsencrypt/
|
||||||
|
backupRootDirectory /etc/nginx/ $BACKUP_DIR_ROOT/nginx/
|
||||||
|
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
||||||
|
backupRootDirectory /etc/wireguard/ $BACKUP_DIR_ROOT/wireguard/
|
||||||
|
backupRootDirectory /etc/docker/daemon.json $BACKUP_DIR_ROOT/docker/
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
### upload backup ###
|
### upload backup ###
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
|
if [[ "$1" == "--noupload" ]]; then
|
||||||
|
exit 0;
|
||||||
|
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" --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/
|
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!"
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
source /sync/home_external/.bash_aliases
|
source /sync/scripts/backup_resources.sh
|
||||||
|
# FSFIXME expand_aliases still needed?
|
||||||
shopt -s expand_aliases # make aliases work
|
shopt -s expand_aliases # make aliases work
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
### update local backup dir ###
|
### update local backup dir ###
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
BACKUP_DIR=/sync/backup
|
BACKUP_DIR=/sync/backup
|
||||||
|
ensureDirectory $BACKUP_DIR
|
||||||
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
||||||
if [[ !($HOME/.bash_aliases_local -ef $BACKUP_DIR_HOME/.bash_aliases_local) ]]; then
|
ensureDirectory $BACKUP_DIR_HOME
|
||||||
ln $HOME/.bash_aliases_local $BACKUP_DIR_HOME/.bash_aliases_local
|
|
||||||
fi
|
|
||||||
|
|
||||||
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
||||||
rsync_backup --link-dest="/etc/ssh/" /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
ensureRootDirectory $BACKUP_DIR_ROOT
|
||||||
|
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
||||||
if [[ !(-d $BACKUP_DIR_ROOT/udev/rules.d) ]]; then
|
if [[ !(-d $BACKUP_DIR_ROOT/udev/rules.d) ]]; then
|
||||||
mkdir $BACKUP_DIR_ROOT/udev/rules.d
|
mkdir $BACKUP_DIR_ROOT/udev/rules.d
|
||||||
fi
|
fi
|
||||||
@ -24,14 +24,15 @@ 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
|
ln /etc/udev/rules.d/69-hdparm.rules $BACKUP_DIR_ROOT/udev/rules.d/69-hdparm.rules
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
### upload backup ###
|
### upload backup ###
|
||||||
#####################
|
#####################
|
||||||
|
|
||||||
echo $'upload of backup still manual for now.\nplease execute the following commands:'
|
echo 'upload of backup still manual for now.\nplease execute the following commands:'
|
||||||
echo 'su garrus'
|
echo 'su garrus'
|
||||||
echo 'sd rsync_backup $BACKUP_DIR/ /citadel/backup/garrus/'
|
echo "sd rsync_backup $BACKUP_DIR/ /citadel/backup/garrus/"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
su garrus
|
su garrus
|
||||||
|
30
scripts/backup_resources.sh
Normal file
30
scripts/backup_resources.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/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
|
||||||
|
}
|
@ -1,24 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
source /sync/home_external/.bash_aliases
|
source /sync/scripts/backup_resources.sh
|
||||||
|
# FSFIXME expand_aliases still needed?
|
||||||
shopt -s expand_aliases # make aliases work
|
shopt -s expand_aliases # make aliases work
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
### update local backup dir ###
|
### update local backup dir ###
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
BACKUP_DIR=/sync/backup
|
BACKUP_DIR=/sync/backup
|
||||||
|
ensureDirectory $BACKUP_DIR
|
||||||
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
||||||
if [[ !($HOME/.bash_aliases_local -ef $BACKUP_DIR_HOME/.bash_aliases_local) ]]; then
|
ensureDirectory $BACKUP_DIR_HOME
|
||||||
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 ###
|
### 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/
|
sd rsync_backup -e "ssh -i /home/fabian/.ssh/id_ed25519" $BACKUP_DIR/ fabian@garrus:/citadel/backup/shepard/
|
||||||
|
4
scripts/decompress_and_unarchive.sh
Executable file
4
scripts/decompress_and_unarchive.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source=$1;
|
||||||
|
archive=${source%.xz}; # cut off trailing ".xz"
|
||||||
|
unxz $source && tar xfv $archive
|
@ -11,6 +11,8 @@ replacements[':']='_';
|
|||||||
replacements["'"]='_';
|
replacements["'"]='_';
|
||||||
replacements['(']='_';
|
replacements['(']='_';
|
||||||
replacements[')']='_';
|
replacements[')']='_';
|
||||||
|
replacements['[']='_';
|
||||||
|
replacements[']']='_';
|
||||||
while [[ $# > 0 ]]; do
|
while [[ $# > 0 ]]; do
|
||||||
replacements["$1"]="$2";
|
replacements["$1"]="$2";
|
||||||
shift 2;
|
shift 2;
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
sshMount () {
|
sshMount () {
|
||||||
|
serverUser=$1;
|
||||||
|
serverHost=$2;
|
||||||
|
shift 2;
|
||||||
args=($@)
|
args=($@)
|
||||||
args=(${args[@]:2})
|
|
||||||
for ((i=0; i < ${#args[@]}; i=i + 2)); do
|
for ((i=0; i < ${#args[@]}; i=i + 2)); do
|
||||||
sshfs $1@$2:/citadel/${args[$i]}/ /home/fabian/${args[$i + 1]}/ -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=8
|
sshfs ${serverUser}@${serverHost}:/citadel/${args[$i]}/ $HOME/${args[$i + 1]}/ -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=8
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ set -euo pipefail
|
|||||||
dir="$(pwd)"
|
dir="$(pwd)"
|
||||||
dest=${dir%/*}/${dir##*/}_reencode
|
dest=${dir%/*}/${dir##*/}_reencode
|
||||||
if [[ !(-d $dest) ]]; then
|
if [[ !(-d $dest) ]]; then
|
||||||
mkdir $dest
|
mkdir "$dest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in ./*.$1; do
|
for file in ./*.$1; do
|
||||||
|
@ -21,7 +21,7 @@ fi
|
|||||||
dir="$(pwd)"
|
dir="$(pwd)"
|
||||||
dest=${dir%/*}/${dir##*/}_reencode
|
dest=${dir%/*}/${dir##*/}_reencode
|
||||||
if [[ !(-d $dest) ]]; then
|
if [[ !(-d $dest) ]]; then
|
||||||
mkdir $dest
|
mkdir "$dest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in ./*.m4a; do
|
for file in ./*.m4a; do
|
||||||
|
25
scripts/transcode_flac.sh
Executable file
25
scripts/transcode_flac.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# evaluate options through given arguments
|
||||||
|
file_suffix='wav'
|
||||||
|
map=
|
||||||
|
while [[ $# > 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
-t | --type) file_suffix=$2; shift 2;;
|
||||||
|
-map ) map='-map 0:0'; shift;;
|
||||||
|
* ) break ;; # Anything else stops command line processing.
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# ensure existence of destination folder
|
||||||
|
dir="$(pwd)"
|
||||||
|
dest=${dir%/*}/${dir##*/}_flac
|
||||||
|
if [[ !(-d $dest) ]]; then
|
||||||
|
mkdir "$dest"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in ./*.$file_suffix; do
|
||||||
|
echo "ffmpeg -i '$file' -c:a flac $map '$dest/${file%$file_suffix}flac'";
|
||||||
|
ffmpeg -i "$file" -c:a flac $map "$dest/${file%$file_suffix}flac";
|
||||||
|
done
|
@ -16,7 +16,7 @@ done
|
|||||||
dir="$(pwd)"
|
dir="$(pwd)"
|
||||||
dest=${dir%/*}/${dir##*/}_ogg
|
dest=${dir%/*}/${dir##*/}_ogg
|
||||||
if [[ !(-d $dest) ]]; then
|
if [[ !(-d $dest) ]]; then
|
||||||
mkdir $dest
|
mkdir "$dest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in ./*.$file_suffix; do
|
for file in ./*.$file_suffix; do
|
||||||
|
Reference in New Issue
Block a user