Compare commits
78 Commits
586f3ea533
...
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 | |||
3d740f1c3b | |||
647831e860 | |||
8358af1077 | |||
4cab17e726 | |||
452fd7600d | |||
d84d9e6933 | |||
12e5c3e2b1 | |||
49335145fd | |||
0aeb3b770f | |||
aaf96cd5c7 | |||
976100ec25 | |||
571e03680f | |||
ec5a09da64 | |||
ec5815b10b | |||
daf4250a7e | |||
13446c6d89 | |||
f501c081df | |||
7accc4c185 | |||
ad1cfc5344 | |||
bb277234ea | |||
c4e3c60eec | |||
2d4027379b | |||
a73cf71925 | |||
d59183ad63 | |||
43607cba6e | |||
2233d47782 | |||
1d3d82aa5b | |||
d6cc45381e | |||
0b57ddfaaf | |||
de22a1668e | |||
c8d95342e2 | |||
6c283839fb | |||
e7464580c2 | |||
682dc5f18a | |||
1acf2a2305 | |||
16de7c94da | |||
ea7c081bd4 | |||
3337e168c7 | |||
e43b887413 | |||
5881642a40 | |||
844fe85d6d |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
/backup
|
||||
output.txt
|
||||
.bash_aliases_local
|
||||
/.sublime
|
||||
|
@ -1,10 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$TERM" == 'xterm-kitty' ]; then
|
||||
alias ssh='kitty +kitten ssh'
|
||||
alias diff='kitty +kitten diff'
|
||||
fi
|
||||
|
||||
DEFAULT_RSYNC='--verbose --recursive --progress --delay-updates --human-readable --links --hard-links --perms'
|
||||
DEFAULT_RSYNC='--info=ALL --recursive --delay-updates --human-readable --links --hard-links --perms'
|
||||
|
||||
alias l='ls -l -v --all --human-readable --classify --group-directories-first' # -lvahF --group-directories-first
|
||||
alias lt=='l --time-style=long-iso'
|
||||
alias r='reset'
|
||||
alias ..='cd ..'
|
||||
alias refresh_bashrc='. ~/.bashrc' # alternatively: 'source ~/.bashrc'
|
||||
@ -12,13 +16,13 @@ alias rsync_default="rsync $DEFAULT_RSYNC --checksum"
|
||||
# source /usr/share/bash-completion/completions/rsync
|
||||
# complete -F _rsync rsync_default
|
||||
alias rsync_backup="rsync $DEFAULT_RSYNC --checksum --times --group --owner --delete"
|
||||
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_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 nnn='nnn -dHrR'
|
||||
alias nn='n -dHrR'
|
||||
alias finds='find $* 2>/dev/null'
|
||||
alias c='clear'
|
||||
alias sort_dirs_by_size='du --block-size=1K --human-readable --max-depth=1 | sort --human-numeric-sort --reverse' # 'du -kh --max-depth=1 | sort -hr'
|
||||
alias sd='sudo ' # alias, so sudo can use aliases: "If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion."
|
||||
@ -26,16 +30,56 @@ alias mountdrive='udisksctl mount -b'
|
||||
alias unmountdrive='udisksctl unmount -b'
|
||||
alias fssizes='df -kh --output=size,used,avail,pcent,target | 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() {
|
||||
noconfirm=
|
||||
if [[ $1 == "-y" ]]; then
|
||||
noconfirm="--assumeyes";
|
||||
fi
|
||||
executeAndNotify "doUpdateFlatpak $noconfirm" "flatpaks updated" "flatpak update failed";
|
||||
}
|
||||
|
||||
|
||||
doUpdateFlatpak() {
|
||||
flatpak update $1;
|
||||
flatpak remove --unused $1;
|
||||
}
|
||||
|
||||
|
||||
# executes command and notifies upon failure
|
||||
execute() {
|
||||
dir="$(pwd)";
|
||||
dir=${dir##*/};
|
||||
if [ -n "$2" ]; then
|
||||
errLog=$2
|
||||
if [[ -n "$2" ]]; then
|
||||
errLog=$2;
|
||||
else
|
||||
errLog="execution of \"$1\" failed"
|
||||
errLog="execution of \"$1\" failed";
|
||||
fi
|
||||
|
||||
if ! $1; then
|
||||
@ -48,34 +92,33 @@ execute() {
|
||||
# executes command and notifies upon success or failure
|
||||
executeAndNotify () {
|
||||
dir="$(pwd)";
|
||||
dir=${dir##*/};
|
||||
if [ -n "$2" ]; then
|
||||
winLog=$2
|
||||
dir=${dir##*/}; # cut off previous path (/path/to/foo.txt -> foo.txt)
|
||||
if [[ -n "$2" ]]; then
|
||||
winLog=$2;
|
||||
else
|
||||
winLog="execution of \"$1\" succeeded"
|
||||
winLog="execution of \"$1\" succeeded";
|
||||
fi
|
||||
|
||||
if ! execute "$1" "$3"; then # arguments in quotes so they are interpreted as ONE argument each by execute()
|
||||
return 1;
|
||||
fi
|
||||
notifyInfo "$dir: $winLog"
|
||||
notifyInfo "$dir: $winLog";
|
||||
}
|
||||
|
||||
|
||||
# find file but don't print errors (e.g. can't access directory etc.)
|
||||
: 'seems to be working as alias as well:
|
||||
finds () {
|
||||
find $* 2>/dev/null
|
||||
}'
|
||||
find $* 2>/dev/null;
|
||||
}
|
||||
|
||||
|
||||
# sends a desktop-notification with an icon signalling an error
|
||||
notifyError () {
|
||||
notify-send "$1" --icon=data-warning
|
||||
notify-send "$1" --icon=data-warning;
|
||||
}
|
||||
|
||||
|
||||
# sends a desktop-notification with an icon signalling a simple information
|
||||
notifyInfo () {
|
||||
notify-send "$1" --icon=preferences-desktop-notification
|
||||
notify-send "$1" --icon=preferences-desktop-notification;
|
||||
}
|
||||
|
21
home_external/.bash_aliases_branched
Normal file
21
home_external/.bash_aliases_branched
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
updatePackages() {
|
||||
noconfirm=
|
||||
if [[ $1 == "-y" ]]; then
|
||||
noconfirm="--assume-yes"
|
||||
fi
|
||||
full=
|
||||
if [[ $2 == "--full" ]]; then
|
||||
full="full-"
|
||||
fi
|
||||
executeAndNotify "doUpdatePackages $noconfirm $full" "system updated" "system update failed";
|
||||
}
|
||||
|
||||
|
||||
doUpdatePackages() {
|
||||
sudo apt update;
|
||||
sudo apt ${2}upgrade $1;
|
||||
sudo apt autoremove $1;
|
||||
}
|
@ -2,6 +2,9 @@
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
set -o pipefail
|
||||
# set -u
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
if [[ $- != *i* ]]; then
|
||||
return
|
||||
@ -43,6 +46,8 @@ shopt -s checkwinsize
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
shopt -s globstar
|
||||
|
||||
shopt -s dotglob
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
if [ -x /usr/bin/lesspipe ]; then
|
||||
eval "$(SHELL=/bin/sh lesspipe)"
|
||||
@ -181,26 +186,29 @@ colours() {
|
||||
|
||||
# ex - archive extractor
|
||||
# usage: ex <file>
|
||||
ex ()
|
||||
{
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
ex() {
|
||||
if [[ ! -f "$1" ]]; then
|
||||
echo "'$1' is not a valid file"
|
||||
return 1;
|
||||
fi
|
||||
# FIXME 7z kann (theoretisch) tar
|
||||
outdir=${1%.*}
|
||||
case "$1" in
|
||||
*.tar.bz2 | *.tbz | *.tbz2)
|
||||
tar xjf $1 -C $outdir;;
|
||||
*.tar.gz | *.tgz)
|
||||
tar xzf $1 -C $outdir;;
|
||||
*.tar)
|
||||
tar xf $1 -C $outdir;;
|
||||
*.7z | *.zip | *.gz | *.bz | *.bz2)
|
||||
7z x -o$outdir $1;;
|
||||
*.rar)
|
||||
unrar x $1;;
|
||||
*.Z)
|
||||
uncompress $1;;
|
||||
*)
|
||||
echo "'$1' cannot be extracted via ex()";;
|
||||
esac
|
||||
}
|
||||
|
||||
# BEGIN_KITTY_SHELL_INTEGRATION
|
||||
|
@ -139,13 +139,13 @@ configuration {
|
||||
/* me-select-entry: "MousePrimary";*/
|
||||
/* me-accept-entry: "MouseDPrimary";*/
|
||||
/* me-accept-custom: "Control+MouseDPrimary";*/
|
||||
timeout {
|
||||
/* timeout {
|
||||
action: "kb-cancel";
|
||||
delay: 0;
|
||||
}
|
||||
filebrowser {
|
||||
directories-first: true;
|
||||
sorting-method: "name";
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@theme "/usr/share/rofi/themes/Arc-Dark.rasi"
|
||||
|
@ -44,4 +44,5 @@
|
||||
"use_tab_stops": false,
|
||||
"word_wrap": true,
|
||||
"wrap_width": 120,
|
||||
"index_files": true,
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
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
|
||||
# some PAM modules and threads)
|
||||
# FIXME! outdated/ replaced by KbdInteractiveAuthentication?
|
||||
ChallengeResponseAuthentication no
|
||||
|
||||
# Change to no to disable s/key passwords
|
||||
KbdInteractiveAuthentication no
|
||||
|
||||
# Kerberos options
|
||||
@ -86,7 +82,7 @@ KbdInteractiveAuthentication no
|
||||
# be allowed through the KbdInteractiveAuthentication and
|
||||
# PasswordAuthentication. Depending on your PAM configuration,
|
||||
# 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
|
||||
# PAM authentication, then enable this but set PasswordAuthentication
|
||||
# and KbdInteractiveAuthentication to 'no'.
|
||||
@ -122,10 +118,10 @@ PrintMotd no # pam does that
|
||||
AcceptEnv LANG LC_*
|
||||
|
||||
# override default of no subsystems
|
||||
# DEACTIVATED because no need for sftp and differences between debian and arch
|
||||
# debian
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
# arch
|
||||
# DEACTIVATED because no need for sftp and differences between debian and arch
|
||||
# Subsystem sftp /usr/lib/ssh/sftp-server
|
||||
|
||||
# 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,10 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source /sync/scripts/backup_resources.sh
|
||||
# FSFIXME expand_aliases still needed?
|
||||
shopt -s expand_aliases # make aliases work
|
||||
REL_HOME=$HOME
|
||||
source $REL_HOME/.bash_aliases
|
||||
|
||||
sd rsync_backup -e "ssh -i $REL_HOME/.ssh/id_ed25519" ./ fabian@garrus:/citadel/backup/edi/
|
||||
###############################
|
||||
### update local backup dir ###
|
||||
###############################
|
||||
|
||||
sd rsync_backup --link-dest="/etc/ssh/" /etc/ssh/ ssh/
|
||||
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/
|
||||
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 ###
|
||||
#####################
|
||||
|
||||
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" /home/edi/docker/ fabian@garrus:/citadel/backup/edi/home/docker/
|
||||
echo "Note: remember to keep /citadel in sync!"
|
||||
|
@ -1,10 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source /sync/scripts/backup_resources.sh
|
||||
# FSFIXME expand_aliases still needed?
|
||||
shopt -s expand_aliases # make aliases work
|
||||
REL_HOME=$HOME
|
||||
source $REL_HOME/.bash_aliases
|
||||
|
||||
sd rsync_backup -e "ssh -i $REL_HOME/.ssh/id_ed25519" ./ fabian@garrus:/citadel/backup/garrus/
|
||||
###############################
|
||||
### update local backup dir ###
|
||||
###############################
|
||||
|
||||
sd rsync_backup --link-dest="/etc/ssh/" /etc/ssh/ ssh/
|
||||
BACKUP_DIR=/sync/backup
|
||||
ensureDirectory $BACKUP_DIR
|
||||
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
||||
ensureDirectory $BACKUP_DIR_HOME
|
||||
|
||||
BACKUP_DIR_ROOT=$BACKUP_DIR/root/etc
|
||||
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
|
||||
|
||||
backupRootDirectory /etc/ssh/ $BACKUP_DIR_ROOT/ssh/
|
||||
|
||||
#####################
|
||||
### upload backup ###
|
||||
#####################
|
||||
|
||||
echo 'upload of backup still manual for now.\nplease execute the following commands:'
|
||||
echo 'su garrus'
|
||||
echo "sd rsync_backup $BACKUP_DIR/ /citadel/backup/garrus/"
|
||||
exit 0
|
||||
|
||||
su garrus
|
||||
sd rsync_backup $BACKUP_DIR/ /citadel/backup/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
|
||||
}
|
27
scripts/backup_shepard.sh
Normal file → Executable file
27
scripts/backup_shepard.sh
Normal file → Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
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
|
||||
ensureDirectory $BACKUP_DIR
|
||||
BACKUP_DIR_HOME=$BACKUP_DIR/home
|
||||
ensureDirectory $BACKUP_DIR_HOME
|
||||
|
||||
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/
|
||||
|
@ -1,7 +0,0 @@
|
||||
cd /var/tmp/
|
||||
git clone https://aur.archlinux.org/ffmpeg-libfdk_aac.git
|
||||
cd ffmpeg-libfdk_aac/
|
||||
makepkg -csr
|
||||
pacman -Ud
|
||||
cd ..
|
||||
rm -r ffmpeg-libfdk_aac/
|
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
|
@ -8,6 +8,11 @@ declare -A replacements
|
||||
unset replacements[0]
|
||||
replacements[' ']='_';
|
||||
replacements[':']='_';
|
||||
replacements["'"]='_';
|
||||
replacements['(']='_';
|
||||
replacements[')']='_';
|
||||
replacements['[']='_';
|
||||
replacements[']']='_';
|
||||
while [[ $# > 0 ]]; do
|
||||
replacements["$1"]="$2";
|
||||
shift 2;
|
||||
|
@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# this script is supposed to apply changes in /sync/{home,root}_external to /sync/{home,root}_external and thus to / resp. ~/
|
||||
# FIXME!!! WIP
|
||||
# FIXME!!! syncing root stuff not yet implemented
|
||||
# FIXME!!! user name/ group name/ home dir hard coded for now...
|
||||
|
||||
externalDir=/sync/home_external/
|
||||
internalDir=/sync/home_internal/
|
||||
userHome=/home/fabian/
|
||||
user=fabian
|
||||
group=fabian
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Error. No file(s) for import given"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
file="$(find $internalDir -name $1)"
|
||||
|
||||
# if a file is merely changed, copy its content into the existing target directory
|
||||
if [[ -e "$file" ]]; then
|
||||
echo "copying file content of $1 to $file"
|
||||
cat $1 > $file
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# if a new file/ dir is created, copy it into the $internalDir retaining the relative path
|
||||
# after that, copy/ hard link it to the $userHome directory and assign the correct user/ group
|
||||
# NOTE: one could solve that by having the same user + group on every system
|
||||
relPath="$(realpath --relative-to=$externalDir $1)" # should also contain the leaf name
|
||||
echo "new file/dir. relative path: $relPath"
|
||||
if [[ -f "$1" ]]; then
|
||||
install -Dv $1 "$internalDir$relPath"
|
||||
else
|
||||
mkdir -pv "$internalDir$relPath"
|
||||
fi
|
||||
cp -lrv "$internalDir$relPath" $userHome
|
||||
chown -v "$user:$group" "$userHome$relPath"
|
||||
exit 0
|
6
scripts/mount_general.sh
Executable file → Normal file
6
scripts/mount_general.sh
Executable file → Normal file
@ -2,10 +2,12 @@
|
||||
set -euo pipefail
|
||||
|
||||
sshMount () {
|
||||
serverUser=$1;
|
||||
serverHost=$2;
|
||||
shift 2;
|
||||
args=($@)
|
||||
args=(${args[@]:2})
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
set -euo pipefail
|
||||
|
||||
# ensure existence of destination folder
|
||||
dest=../reencode
|
||||
dir="$(pwd)"
|
||||
dest=${dir%/*}/${dir##*/}_reencode
|
||||
if [[ !(-d $dest) ]]; then
|
||||
mkdir $dest
|
||||
mkdir "$dest"
|
||||
fi
|
||||
|
||||
for file in ./*.$1; do
|
||||
|
@ -6,9 +6,9 @@ map=
|
||||
vbr=
|
||||
while [[ $# > 0 ]]; do
|
||||
case $1 in
|
||||
-map) map='-map 0:0'; shift;;
|
||||
-vbr) vbr='libfdk_aac -profile:a aac_he -b:a 64k'; shift;;
|
||||
* ) break ;; # Anything else stops command line processing.
|
||||
-map) map='-map 0:0'; shift;;
|
||||
-vbr) vbr='aac_at -profile:a aac_he -b:a 64k'; shift;;
|
||||
* ) break ;; # Anything else stops command line processing.
|
||||
esac
|
||||
done
|
||||
|
||||
@ -18,9 +18,10 @@ if [[ -z $vbr ]]; then
|
||||
fi
|
||||
|
||||
# ensure existence of destination folder
|
||||
dest=../reencode
|
||||
dir="$(pwd)"
|
||||
dest=${dir%/*}/${dir##*/}_reencode
|
||||
if [[ !(-d $dest) ]]; then
|
||||
mkdir $dest
|
||||
mkdir "$dest"
|
||||
fi
|
||||
|
||||
for file in ./*.m4a; do
|
||||
|
@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
shopt -s expand_aliases
|
||||
source /sync/home_internal/.bash_aliases # FSCLEANUP -> zum besseren testen
|
||||
# source /sync/home_external/.bash_aliases
|
||||
|
||||
|
||||
sync () {
|
||||
dry_run=false
|
||||
home_or_root=
|
||||
update=true
|
||||
in_to_ex=
|
||||
while [[ $# > 0 ]]; do
|
||||
case $1 in
|
||||
-d | --dry ) dry_run=true; shift;;
|
||||
-c | --checksum ) update=false; shift;;
|
||||
--in-to-ex ) in_to_ex=true; shift;;
|
||||
--ex-to-in ) in_to_ex=false; shift;;
|
||||
--dir ) home_or_root=$2; shift 2;;
|
||||
* ) break ;; # Anything else stops command line processing.
|
||||
esac
|
||||
done
|
||||
|
||||
dir_external=/sync/${home_or_root}_external/
|
||||
dir_internal=/sync/${home_or_root}_internal/
|
||||
# dry-run
|
||||
if [[ "$dry_run" == true ]]; then
|
||||
ex_to_in=
|
||||
in_to_ex=
|
||||
update_or_default=
|
||||
if [[ "$update" == true ]]; then
|
||||
update_or_default='UPDATE'
|
||||
ex_to_in=$(rsync_update $dir_external $dir_internal --dry-run)
|
||||
in_to_ex=$(rsync_update $dir_internal $dir_external --dry-run)
|
||||
else
|
||||
update_or_default='DEFAULT'
|
||||
ex_to_in=$(rsync_default $dir_external $dir_internal --dry-run)
|
||||
in_to_ex=$(rsync_default $dir_internal $dir_external --dry-run)
|
||||
fi
|
||||
# use printf for displaying \n as newline correctly
|
||||
printf "RSYNC ${update_or_default}: external -> internal:\n\n$ex_to_in\n\nRSYNC ${update_or_default}: internal -> external:\n\n$in_to_ex\n"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# real deal
|
||||
if [[ -z "$in_to_ex" ]]; then
|
||||
echo "Error. No sync direction given."
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [[ "$update" == true ]]; then
|
||||
if [[ "$in_to_ex" == true ]]; then
|
||||
rsync_update $dir_internal $dir_external
|
||||
else
|
||||
rsync_update $dir_external $dir_internal
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
||||
if [[ "$in_to_ex" == true ]]; then
|
||||
rsync_default $dir_internal $dir_external
|
||||
else
|
||||
rsync_default $dir_external $dir_internal
|
||||
fi
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source /sync/scripts/sync_general.sh
|
||||
|
||||
sync --dir home $@
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source /sync/scripts/sync_general.sh
|
||||
|
||||
sync --dir root $@
|
@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
# evaluate options through given arguments
|
||||
file_suffix=
|
||||
file_suffix='wav'
|
||||
map=
|
||||
while [[ $# > 0 ]]; do
|
||||
case $1 in
|
||||
@ -13,12 +13,13 @@ while [[ $# > 0 ]]; do
|
||||
done
|
||||
|
||||
# ensure existence of destination folder
|
||||
dest=../transcode_m4a
|
||||
dir="$(pwd)"
|
||||
dest=${dir%/*}/${dir##*/}_flac
|
||||
if [[ !(-d $dest) ]]; then
|
||||
mkdir $dest
|
||||
mkdir "$dest"
|
||||
fi
|
||||
|
||||
for file in ./*.$file_suffix; do
|
||||
echo "ffmpeg -i '$file' -c:a libfdk_aac -profile:a aac_he -b:a 64k $map -movflags +faststart '$dest/${file%$file_suffix}m4a'";
|
||||
ffmpeg -i "$file" -c:a libfdk_aac -profile:a aac_he -b:a 64k $map -movflags +faststart "$dest/${file%$file_suffix}m4a";
|
||||
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
|
26
scripts/transcode_opus.sh
Executable file
26
scripts/transcode_opus.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# evaluate options through given arguments
|
||||
file_suffix=
|
||||
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##*/}_ogg
|
||||
if [[ !(-d $dest) ]]; then
|
||||
mkdir "$dest"
|
||||
fi
|
||||
|
||||
for file in ./*.$file_suffix; do
|
||||
# `-vbr on -application audio` should be default, but let's be sure
|
||||
echo "ffmpeg -i '$file' -c:a libopus -b:a 64k -vbr on -application audio $map '$dest/${file%$file_suffix}ogg'";
|
||||
ffmpeg -i "$file" -c:a libopus -b:a 64k -vbr on -application audio $map "$dest/${file%$file_suffix}ogg";
|
||||
done
|
Reference in New Issue
Block a user