Compare commits
34 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ee6362c5b8 | |||
| 0145b7684c | |||
| 54c7b09524 | |||
| 6d0919cb6f | |||
| 3ea5eee6bc | |||
| a745f5f98f | |||
| 380ada85ac | |||
| 3ca7eea87d | |||
| 4d6c30d30a | |||
| 32f8ce1c55 | |||
| 4c0fd1c103 | |||
| 9ceae1e7f1 | |||
| 9d912f5fee | |||
| 720cfd75b2 | |||
| 379b0529cf | |||
| aa4d8b6c64 | |||
| 3248acdbe2 | |||
| 10d7a78891 | |||
| c5c1a95a34 | |||
| 4e0071d93a | |||
| 92934e48fe | |||
| cd8e274705 | |||
| f1a5d217fc | |||
| 8b2ef3da50 | |||
| a0241ad8bd | |||
| 9b55aabb93 | |||
| e9740ecf56 | |||
| 26c70398ef | |||
| b99c26fbfa | |||
| 78e78ceb84 | |||
| 8ae771f5b4 | |||
| 9356a41f0e | |||
| 9a081f6816 | |||
| b4f587ce1c |
36 changed files with 926 additions and 235 deletions
11
README.md
11
README.md
|
|
@ -1,3 +1,8 @@
|
||||||
# .dots
|
```
|
||||||
|
_ _
|
||||||
### personal dot files for proxmox based hosts
|
| | | |
|
||||||
|
__| | ___ | |_ ___
|
||||||
|
/ _` |/ _ \| __/ __|
|
||||||
|
| (_| | (_) | |_\__ \
|
||||||
|
(_)__,_|\___/ \__|___/
|
||||||
|
```
|
||||||
|
|
|
||||||
20
config/kitty/colors.conf
Normal file
20
config/kitty/colors.conf
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
foreground #fffff6
|
||||||
|
background #0E111C
|
||||||
|
cursor #fffff6
|
||||||
|
|
||||||
|
color0 #0E111C
|
||||||
|
color8 #1e253d
|
||||||
|
color1 #EEDCA1
|
||||||
|
color9 #ffffb4
|
||||||
|
color2 #C7C7C6
|
||||||
|
color10 #ffffe4
|
||||||
|
color3 #EED277
|
||||||
|
color11 #ffff83
|
||||||
|
color4 #7C7E83
|
||||||
|
color12 #909cba
|
||||||
|
color5 #ADADAF
|
||||||
|
color13 #cacafa
|
||||||
|
color6 #BFC0C2
|
||||||
|
color14 #dff1ff
|
||||||
|
color7 #eeebdf
|
||||||
|
color15 #fffff6
|
||||||
50
config/kitty/kitty.conf
Normal file
50
config/kitty/kitty.conf
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# https://sw.kovidgoyal.net/kitty/overview/#configuring-kitty
|
||||||
|
|
||||||
|
# pointer settings
|
||||||
|
default_pointer_shape arrow
|
||||||
|
|
||||||
|
# background and color settings
|
||||||
|
background_opacity 0.9
|
||||||
|
include ./colors.conf
|
||||||
|
|
||||||
|
# font settings
|
||||||
|
font_family Fira Code Nerd Font
|
||||||
|
bold_font auto
|
||||||
|
italic_font auto
|
||||||
|
bold_italic_font auto
|
||||||
|
font_size 12
|
||||||
|
|
||||||
|
# cursor settings
|
||||||
|
shell_integration no-cursor
|
||||||
|
cursor_shape underline
|
||||||
|
cursor_blink_interval 1
|
||||||
|
cursor_underline_thickness 1.0
|
||||||
|
|
||||||
|
# tab settings
|
||||||
|
tab_bar_edge bottom
|
||||||
|
tab_bar_align left
|
||||||
|
tab_bar_style powerline
|
||||||
|
tab_powerline_style slanted
|
||||||
|
|
||||||
|
# url settings
|
||||||
|
detect_urls yes
|
||||||
|
url_color #f6d66e
|
||||||
|
url_style dashed
|
||||||
|
|
||||||
|
# bell settings
|
||||||
|
enable_audio_bell no
|
||||||
|
|
||||||
|
# refresh settings
|
||||||
|
sync_to_monitor yes
|
||||||
|
|
||||||
|
# scrollback settings
|
||||||
|
scrollback_lines 10000
|
||||||
|
|
||||||
|
# keyboard shortcuts
|
||||||
|
map ctrl+shift+c no_op
|
||||||
|
map ctrl+shift+v no_op
|
||||||
|
map ctrl+alt+c copy_to_clipboard
|
||||||
|
map ctrl+alt+v paste_from_clipboard
|
||||||
49
config/kitty/kitty.conf.bak
Normal file
49
config/kitty/kitty.conf.bak
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# https://sw.kovidgoyal.net/kitty/overview/#configuring-kitty
|
||||||
|
|
||||||
|
# pointer settings
|
||||||
|
default_pointer_shape arrow
|
||||||
|
|
||||||
|
# background and color settings
|
||||||
|
background_opacity 0.9
|
||||||
|
|
||||||
|
# font settings
|
||||||
|
font_family Fira Code Nerd Font
|
||||||
|
bold_font auto
|
||||||
|
italic_font auto
|
||||||
|
bold_italic_font auto
|
||||||
|
font_size 12
|
||||||
|
|
||||||
|
# cursor settings
|
||||||
|
shell_integration no-cursor
|
||||||
|
cursor_shape underline
|
||||||
|
cursor_blink_interval 1
|
||||||
|
cursor_underline_thickness 1.0
|
||||||
|
|
||||||
|
# tab settings
|
||||||
|
tab_bar_edge bottom
|
||||||
|
tab_bar_align left
|
||||||
|
tab_bar_style powerline
|
||||||
|
tab_powerline_style slanted
|
||||||
|
|
||||||
|
# url settings
|
||||||
|
detect_urls yes
|
||||||
|
url_color #aa0000
|
||||||
|
url_style dashed
|
||||||
|
|
||||||
|
# bell settings
|
||||||
|
enable_audio_bell no
|
||||||
|
|
||||||
|
# refresh settings
|
||||||
|
sync_to_monitor yes
|
||||||
|
|
||||||
|
# scrollback settings
|
||||||
|
scrollback_lines 10000
|
||||||
|
|
||||||
|
# keyboard shortcuts
|
||||||
|
map ctrl+shift+c no_op
|
||||||
|
map ctrl+shift+v no_op
|
||||||
|
map ctrl+alt+c copy_to_clipboard
|
||||||
|
map ctrl+alt+v paste_from_clipboard
|
||||||
10
config/psd/.psd.conf
Normal file
10
config/psd/.psd.conf
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Automatically generated file; DO NOT EDIT!
|
||||||
|
# The purpose is to snapshot the settings used when psd was activated.
|
||||||
|
# Any edits to the live config: /home/velvettear/.config/psd/psd.conf
|
||||||
|
# will be applied the _next_ time psd is activated.
|
||||||
|
#
|
||||||
|
USE_OVERLAYFS="yes"
|
||||||
|
USE_SUSPSYNC=""
|
||||||
|
BROWSERS="firefox"
|
||||||
|
USE_BACKUPS="yes"
|
||||||
|
BACKUP_LIMIT="1"
|
||||||
70
config/psd/psd.conf
Normal file
70
config/psd/psd.conf
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
#
|
||||||
|
# $XDG_CONFIG_HOME/psd/psd.conf
|
||||||
|
#
|
||||||
|
# For documentation, refer man 1 psd or to the wiki page
|
||||||
|
# https://wiki.archlinux.org/index.php/Profile-sync-daemon
|
||||||
|
|
||||||
|
## NOTE the following:
|
||||||
|
## To protect data from corruption, in the event that you do make an edit while
|
||||||
|
## psd is active, any changes made will be applied the next time you start psd.
|
||||||
|
|
||||||
|
# Uncomment and set to "yes" to use overlayfs instead of a full copy to reduce
|
||||||
|
# the memory costs and to improve sync/unsync operations. Note that your kernel
|
||||||
|
# MUST have this module available in order to use this mode.
|
||||||
|
#
|
||||||
|
USE_OVERLAYFS="yes"
|
||||||
|
|
||||||
|
# Uncomment and set to "yes" to resync on suspend to reduce potential data loss.
|
||||||
|
# Note that your system MUST have gdbus from glib2 installed to use this mode.
|
||||||
|
#
|
||||||
|
#USE_SUSPSYNC="no"
|
||||||
|
|
||||||
|
# List any browsers in the array below to have managed by psd. Useful if you do
|
||||||
|
# not wish to have all possible browser profiles managed which is the default if
|
||||||
|
# this array is left commented.
|
||||||
|
#
|
||||||
|
# Possible values:
|
||||||
|
# chromium
|
||||||
|
# chromium-dev
|
||||||
|
# conkeror.mozdev.org
|
||||||
|
# epiphany
|
||||||
|
# falkon
|
||||||
|
# firefox
|
||||||
|
# firefox-trunk
|
||||||
|
# google-chrome
|
||||||
|
# google-chrome-beta
|
||||||
|
# google-chrome-unstable
|
||||||
|
# heftig-aurora
|
||||||
|
# icecat
|
||||||
|
# inox
|
||||||
|
# luakit
|
||||||
|
# midori
|
||||||
|
# opera
|
||||||
|
# opera-beta
|
||||||
|
# opera-developer
|
||||||
|
# opera-legacy
|
||||||
|
# otter-browser
|
||||||
|
# qupzilla
|
||||||
|
# qutebrowser
|
||||||
|
# palemoon
|
||||||
|
# rekonq
|
||||||
|
# seamonkey
|
||||||
|
# surf
|
||||||
|
# vivaldi
|
||||||
|
# vivaldi-snapshot
|
||||||
|
#
|
||||||
|
BROWSERS=("firefox")
|
||||||
|
|
||||||
|
# Uncomment and set to "no" to completely disable the crash recovery feature.
|
||||||
|
#
|
||||||
|
# The default is to create crash recovery backups if the system is ungracefully
|
||||||
|
# powered-down due to a kernel panic, hitting the reset switch, battery going
|
||||||
|
# dead, etc. Some users keep very diligent backups and don't care to have this
|
||||||
|
# feature enabled.
|
||||||
|
USE_BACKUPS="yes"
|
||||||
|
|
||||||
|
# Uncomment and set to an integer that is the maximum number of crash recovery
|
||||||
|
# snapshots to keep (the oldest ones are deleted first).
|
||||||
|
#
|
||||||
|
# The default is to save the most recent 5 crash recovery snapshots.
|
||||||
|
BACKUP_LIMIT=1
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
@ -36,7 +36,7 @@ function checkPriority() {
|
||||||
index=1
|
index=1
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
((index++))
|
((index++))
|
||||||
value="${!index}"
|
value="${@[$index]}"
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
-e|--emoji|-i|--icon)
|
-e|--emoji|-i|--icon)
|
||||||
args+=("-H" "Tags: $value")
|
args+=("-H" "Tags: $value")
|
||||||
|
|
@ -50,9 +50,4 @@ for arg in "$@"; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "user: $user"
|
curl -s -u $user:$password ${args[@]} $url
|
||||||
echo "pw: $password"
|
|
||||||
echo "url: $url"
|
|
||||||
echo "args: ${args[@]}"
|
|
||||||
|
|
||||||
curl -u $user:$password "${args[@]}" $url
|
|
||||||
|
|
|
||||||
80
scripts/nut.sh
Executable file
80
scripts/nut.sh
Executable file
|
|
@ -0,0 +1,80 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
url="https://notify.velvettear.de/ups"
|
||||||
|
user="velvettear"
|
||||||
|
password="\$Velvet90"
|
||||||
|
|
||||||
|
[[ -z "$1" ]] && printf "error: no argument specified\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
ups="eaton"
|
||||||
|
|
||||||
|
charge="$(upsc $ups battery.charge 2> /dev/null)"
|
||||||
|
time="$(upsc $ups battery.runtime 2> /dev/null)"
|
||||||
|
time="$(date -d@$time -u '+%H:%M:%S')"
|
||||||
|
|
||||||
|
title="$(printf "$1" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
prio="default"
|
||||||
|
|
||||||
|
if [[ "$title" == "online" ]]; then
|
||||||
|
msg="$ups is running on line power
|
||||||
|
battery @ $charge% | $time"
|
||||||
|
emoji="electric_plug"
|
||||||
|
elif [[ "$title" == "onbatt" ]]; then
|
||||||
|
msg="$ups is running on battery
|
||||||
|
battery @ $charge% | $time"
|
||||||
|
prio="high"
|
||||||
|
emoji="battery"
|
||||||
|
elif [[ "$title" == "lowbatt" ]]; then
|
||||||
|
msg="$ups's battery is running low battery @ $charge% | $time"
|
||||||
|
prio="max"
|
||||||
|
emoji="exclamation"
|
||||||
|
elif [[ "$title" == "fsd" ]]; then
|
||||||
|
msg="forced shutdown in progress"
|
||||||
|
prio="max"
|
||||||
|
emoji="bangbang"
|
||||||
|
elif [[ "$title" == "commok" ]]; then
|
||||||
|
msg="communication with $ups established"
|
||||||
|
emoji="heavy_check_mark"
|
||||||
|
elif [[ "$title" == "commbad" ]]; then
|
||||||
|
msg="communication with $ups lost"
|
||||||
|
prio="high"
|
||||||
|
emoji="x"
|
||||||
|
elif [[ "$title" == "shutdown" ]]; then
|
||||||
|
msg="shutdown in progress"
|
||||||
|
prio="max"
|
||||||
|
emoji="bangbang"
|
||||||
|
elif [[ "$title" == "replbatt" ]]; then
|
||||||
|
msg="$ups's battery is dying and needs to be replaced"
|
||||||
|
prio="urgent"
|
||||||
|
emoji="skull_and_crossbones"
|
||||||
|
elif [[ "$title" == "nocomm" ]]; then
|
||||||
|
msg="$ups is currently unavailable"
|
||||||
|
prio="high"
|
||||||
|
emoji="interrobang"
|
||||||
|
elif [[ "$title" == "noparent" ]]; then
|
||||||
|
msg="upsmon parent process died and no further actions are possible"
|
||||||
|
prio="high"
|
||||||
|
emoji="skull"
|
||||||
|
elif [[ "$title" == "cal" ]]; then
|
||||||
|
msg="$ups is currently calibrating"
|
||||||
|
emoji="gear"
|
||||||
|
elif [[ "$title" == "off" ]]; then
|
||||||
|
msg="$ups is administratively off or asleep"
|
||||||
|
emoji="grey_exclamation"
|
||||||
|
elif [[ "$title" == "notoff" ]]; then
|
||||||
|
msg="$ups is no longer administratively off or asleep"
|
||||||
|
emoji="grey_exclamation"
|
||||||
|
elif [[ "$title" == "bypass" ]]; then
|
||||||
|
msg="$ups is currently bypassed"
|
||||||
|
emoji="grey_exclamation"
|
||||||
|
elif [[ "$title" == "notbypass" ]]; then
|
||||||
|
msg="$ups is no longer bypassed"
|
||||||
|
emoji="grey_exclamation"
|
||||||
|
else
|
||||||
|
printf "error: argument unknown\n" 1>&2 && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -u $user:$password -d "$msg" -H "Title: $title" -H "Priority: $prio" -H "Tags: $emoji" $url
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
# this script is used in a systemd service file (wanted by other services)
|
|
||||||
|
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" && exit 1
|
|
||||||
|
|
||||||
printf "preparing filesystem...\n"
|
|
||||||
|
|
||||||
if [[ ! -d "/var/log/pveproxy" ]]; then
|
|
||||||
printf "creating directory '/var/log/pveproxy' with owner 'www-data'...\n"
|
|
||||||
mkdir -p /var/log/pveproxy
|
|
||||||
chown -R www-data:www-data /var/log/pveproxy
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d "/var/log/nginx" ]]; then
|
|
||||||
printf "creating directory '/var/log/nginx' with owner 'www-data'...\n"
|
|
||||||
mkdir -p /var/log/nginx
|
|
||||||
chown -R www-data:www-data /var/log/nginx
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "finished preparing the filesystem!\n"
|
|
||||||
35
scripts/restic/backup.sh
Executable file
35
scripts/restic/backup.sh
Executable file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# check if we're running in a subshell, forbid direct execution
|
||||||
|
[[ "$ZSH_EVAL_CONTEXT" == "toplevel" ]] && printf "error: direct execution of this script is forbidden!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
# get the "home" directory
|
||||||
|
home="$(dirname $(realpath "$0"))"
|
||||||
|
|
||||||
|
# check if .env file exists and source it
|
||||||
|
env="$home/$(hostname).env"
|
||||||
|
[[ ! -r "$env" ]] && printf "error: config file '"$env"' does not exist!\n" >&2 && exit 1
|
||||||
|
source "$env"
|
||||||
|
|
||||||
|
# check if backup directories are defined
|
||||||
|
[[ -z "$RESTIC_DIRECTORIES" ]] && printf "error: config file '"$env"' does not define any backup directories!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
printf ">> starting restic backup to repository '"$RESTIC_REPOSITORY"'...\n"
|
||||||
|
|
||||||
|
# execute "pre" action if defined
|
||||||
|
[[ -n "$RESTIC_BACKUP_PRE" ]] && eval "$RESTIC_BACKUP_PRE"
|
||||||
|
|
||||||
|
for directory in ${RESTIC_DIRECTORIES[@]}; do
|
||||||
|
seconds="$SECONDS"
|
||||||
|
printf "\n> backing up '"$directory"'...\n"
|
||||||
|
sudo --preserve-env -u "$RESTIC_USER" restic backup --verbose --no-scan --retry-lock 3h --no-cache "$directory"
|
||||||
|
printf "> backup of '"$directory"' finished after "$(( $SECONDS - $seconds ))" seconds!\n"
|
||||||
|
done
|
||||||
|
|
||||||
|
# execute "post" action if defined
|
||||||
|
[[ -n "$RESTIC_BACKUP_POST" ]] && eval "$RESTIC_BACKUP_POST"
|
||||||
|
|
||||||
|
printf "\n>> restic backup finished after "$SECONDS" seconds!\n"
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
|
|
||||||
|
|
||||||
directories=(
|
|
||||||
"/etc"
|
|
||||||
)
|
|
||||||
|
|
||||||
printf ">> starting restic backup...\n"
|
|
||||||
|
|
||||||
for directory in ${directories[@]}; do
|
|
||||||
seconds="$SECONDS"
|
|
||||||
printf "> backing up '"$directory"'...\n"
|
|
||||||
restic backup --verbose --no-scan --retry-lock 3h "$directory"
|
|
||||||
printf "> backup of '"$directory"' finished after "$(( $SECONDS - $seconds ))" seconds!\n"
|
|
||||||
done
|
|
||||||
|
|
||||||
printf ">> restic backup finished after "$SECONDS" seconds!\n"
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
|
|
||||||
|
|
||||||
directories=(
|
|
||||||
"/etc"
|
|
||||||
"/mnt/storage/audiobooks"
|
|
||||||
"/mnt/storage/comics"
|
|
||||||
"/mnt/storage/documents"
|
|
||||||
"/mnt/storage/ebooks"
|
|
||||||
"/mnt/storage/images"
|
|
||||||
"/mnt/storage/music"
|
|
||||||
"/mnt/storage/software"
|
|
||||||
"/mnt/storage/syncthing"
|
|
||||||
"/mnt/storage/videos"
|
|
||||||
)
|
|
||||||
|
|
||||||
printf ">> starting restic backup...\n"
|
|
||||||
|
|
||||||
for directory in ${directories[@]}; do
|
|
||||||
seconds="$SECONDS"
|
|
||||||
printf "\n> backing up '"$directory"'...\n"
|
|
||||||
restic backup --verbose --no-scan --retry-lock 3h "$directory"
|
|
||||||
printf "> backup of '"$directory"' finished after "$(( $SECONDS - $seconds ))" seconds!\n"
|
|
||||||
done
|
|
||||||
|
|
||||||
printf ">> restic backup finished after "$SECONDS" seconds!\n"
|
|
||||||
26
scripts/restic/prune.sh
Executable file
26
scripts/restic/prune.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# check if we're running in a subshell, forbid direct execution
|
||||||
|
[[ "$ZSH_EVAL_CONTEXT" == "toplevel" ]] && printf "error: direct execution of this script is forbidden!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
# define title and icon for the notification
|
||||||
|
export RESTIC_NTFY_TITLE="prune"
|
||||||
|
export RESTIC_NTFY_ICON="red_circle"
|
||||||
|
|
||||||
|
# clear cache directory
|
||||||
|
rm -rf "/var/cache/restic"
|
||||||
|
|
||||||
|
printf ">> pruning repository '"$RESTIC_REPOSITORY"'...\n\n"
|
||||||
|
|
||||||
|
# execute "pre" action if defined
|
||||||
|
[[ -n "$RESTIC_PRUNE_PRE" ]] && eval "$RESTIC_PRUNE_PRE"
|
||||||
|
|
||||||
|
sudo --preserve-env -u "$RESTIC_USER" restic forget --keep-daily 7 --keep-weekly 1 --keep-monthly 1 --prune --retry-lock 3h --no-cache
|
||||||
|
|
||||||
|
# execute "post" action if defined
|
||||||
|
[[ -n "$RESTIC_PRUNE_POST" ]] && eval "$RESTIC_PRUNE_POST"
|
||||||
|
|
||||||
|
printf "\n>> repository pruned after "$SECONDS" seconds!\n"
|
||||||
35
scripts/restic/restic.env
Normal file
35
scripts/restic/restic.env
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# define user
|
||||||
|
export RESTIC_USER="restic"
|
||||||
|
|
||||||
|
# override default repository
|
||||||
|
export RESTIC_REPOSITORY="/mnt/restic"
|
||||||
|
|
||||||
|
# define pre and post backup actions
|
||||||
|
export RESTIC_BACKUP_PRE="printf '\n> mounting remote storage...\n' && mount -t nfs -o vers=4,soft,noatime,nolock,retrans=1,timeo=10 192.168.100.1:/mnt/storage /mnt/n100"
|
||||||
|
export RESTIC_BACKUP_POST="printf '\n> unmounting remote storage...\n' && umount /mnt/n100"
|
||||||
|
|
||||||
|
# define pre and post prune actions
|
||||||
|
export RESTIC_PRUNE_PRE=""
|
||||||
|
export RESTIC_PRUNE_POST=""
|
||||||
|
|
||||||
|
# define title and icon for the notification
|
||||||
|
export RESTIC_NTFY_TITLE="storage"
|
||||||
|
export RESTIC_NTFY_ICON="yellow_circle"
|
||||||
|
|
||||||
|
# define backup directories
|
||||||
|
export RESTIC_DIRECTORIES=(
|
||||||
|
"/mnt/n100/audiobooks"
|
||||||
|
"/mnt/n100/comics"
|
||||||
|
"/mnt/n100/documents"
|
||||||
|
"/mnt/n100/ebooks"
|
||||||
|
"/mnt/n100/images"
|
||||||
|
"/mnt/n100/music"
|
||||||
|
"/mnt/n100/software"
|
||||||
|
"/mnt/n100/syncthing"
|
||||||
|
"/mnt/n100/videos"
|
||||||
|
)
|
||||||
|
|
@ -1,32 +1,48 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
# exit on error
|
# exit on error
|
||||||
|
set -e
|
||||||
|
|
||||||
# check permissions
|
# check permissions
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
|
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
# check which action to execute
|
||||||
|
[[ -n "$1" ]] && action="$1" || action="backup"
|
||||||
|
|
||||||
# check if script exists
|
# check if script exists
|
||||||
script="$(dirname $(realpath "$0"))/$(hostname).sh"
|
script="$(dirname $(realpath "$0"))/$action.sh"
|
||||||
[[ ! -x "$script" ]] && printf "error: script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
|
[[ ! -x "$script" ]] && printf "error: script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
|
||||||
|
|
||||||
# get hostname
|
# get the "home" directory
|
||||||
host="$(hostname)"
|
home="$(dirname $(realpath "$0"))"
|
||||||
[[ -z "$host" ]] && host="$HOST"
|
|
||||||
|
|
||||||
# setup restic
|
# setup restic
|
||||||
|
export RESTIC_USER="$(whoami)"
|
||||||
export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000"
|
export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000"
|
||||||
export RESTIC_PASSWORD="\$Velvet90"
|
export RESTIC_PASSWORD="\$Velvet90"
|
||||||
export RESTIC_COMPRESSION="max"
|
export RESTIC_COMPRESSION="auto"
|
||||||
export RESTIC_CACHE_DIR="/var/cache/restic"
|
export RESTIC_CACHE_DIR="/var/cache/restic"
|
||||||
|
export RESTIC_LOG="/var/log/restic-$action.log"
|
||||||
|
|
||||||
# setup log file
|
# check if .env file exists and source it
|
||||||
log="/var/log/restic-"$(hostname)".log"
|
env="$home/$(hostname).env"
|
||||||
|
[[ -r "$env" ]] && source "$env"
|
||||||
|
|
||||||
|
# set default values for the notification if undefined
|
||||||
|
[[ -z "$RESTIC_NTFY_TITLE" ]] && RESTIC_NTFY_TITLE="$(hostname)"
|
||||||
|
[[ -z "$RESTIC_NTFY_ICON" ]] && RESTIC_NTFY_ICON="white_circle"
|
||||||
|
|
||||||
|
# execute "pre" action if defined
|
||||||
|
[[ -n "$RESTIC_ACTION_PRE" ]] && eval "$RESTIC_ACTION_PRE"
|
||||||
|
|
||||||
# source / execute restic script
|
# source / execute restic script
|
||||||
source "$script" 2>&1 | tee "$log"
|
source "$script" > >(tee "$RESTIC_LOG") 2>&1
|
||||||
|
|
||||||
# send a notification when finished
|
# execute "post" action if defined
|
||||||
/home/velvettear/.dots/scripts/notify.sh "backups" "$log" --title "$host" --icon "green_circle"
|
[[ -n "$RESTIC_ACTION_POST" ]] && eval "$RESTIC_ACTION_POST"
|
||||||
|
|
||||||
|
# send a notification
|
||||||
|
/etc/velvettear/scripts/notify.sh "restic" "$RESTIC_LOG" --title "$RESTIC_NTFY_TITLE" --icon "$RESTIC_NTFY_ICON" > /dev/null
|
||||||
|
|
|
||||||
39
scripts/scan/batch-scan.sh
Executable file
39
scripts/scan/batch-scan.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
trap 'printf "\n>> batch scan aborted after $SECONDS seconds!\n" && exit 0' SIGINT
|
||||||
|
|
||||||
|
directory="$1"
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
[[ -z "$directory" ]] && directory="$tmp"
|
||||||
|
|
||||||
|
mkdir -p "$directory"
|
||||||
|
[[ ! -d "$directory" ]] && printf "error: directory '"$directory"' does not exist and can not be created!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
printf ">> batch scan started...\n"
|
||||||
|
|
||||||
|
postprocess() {
|
||||||
|
ocr="$(/home/velvettear/.dots/scripts/ocr.sh "$file")"
|
||||||
|
printf "> #"$3": ocr for file '"$file"' finished!\n"
|
||||||
|
printf "$ocr" > "$file.ocr"
|
||||||
|
if [[ "$directory" != "$tmp" ]]; then
|
||||||
|
mv "$file" "$directory"
|
||||||
|
mv "$file.ocr" "$directory"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
counter=1
|
||||||
|
while true; do
|
||||||
|
sleep 1
|
||||||
|
file="$tmp/$(date '+%Y-%m-%d_%H%M%S.png')"
|
||||||
|
scanimage --format="png" --output-file "$file" --resolution "300" --mode "Color" 2> /dev/null
|
||||||
|
if [[ "$?" != "0" ]]; then
|
||||||
|
rm -rf "$file" 2> /dev/null
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
printf "> #"$counter": scanning to '"$file"' finished!\n"
|
||||||
|
#postprocess "$file" "$directory" "$counter"
|
||||||
|
((counter++))
|
||||||
|
done
|
||||||
11
scripts/scan/ocr.sh
Executable file
11
scripts/scan/ocr.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
[[ ! -f "$file" ]] && printf "error: specified file '"$file"' does not exist!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
export OMP_THREAD_LIMIT=1
|
||||||
|
|
||||||
|
tesseract "$file" - -l "deu+eng"
|
||||||
27
scripts/scan/scan.sh
Executable file
27
scripts/scan/scan.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
name="$1"
|
||||||
|
directory="$2"
|
||||||
|
[[ -z "$directory" ]] && directory="$(mktemp -d)"
|
||||||
|
|
||||||
|
[[ -z "$name" ]] && name="$(date '+%Y-%m-%d_%H%M%S').png"
|
||||||
|
[[ "$name" != *".png" ]] && name="$name.png"
|
||||||
|
|
||||||
|
mkdir -p "$directory"
|
||||||
|
[[ ! -d "$directory" ]] && printf "error: directory '"$directory"' does not exist and can not be created!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
output="$directory/$name"
|
||||||
|
|
||||||
|
scanimage --format="png" --output-file "$output" --resolution "300" --mode "Color" 2> /dev/null
|
||||||
|
|
||||||
|
[[ ! -e "$output" ]] && printf "error: no document was scanned!\n" >&2 && exit 1
|
||||||
|
if [[ "$(du "$output" | awk '{print $1}')" == "0" ]]; then
|
||||||
|
printf "error: scanned document '"$output"' is empty!\n" >&2
|
||||||
|
rm -rf "$output"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "$output\n"
|
||||||
60
scripts/update/alpine.sh
Executable file
60
scripts/update/alpine.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/usr/bin/env ash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# exit on ctrl-c
|
||||||
|
trap 'printf ""$font_colored_bold"\n>> system update aborted!"$font_default"\n" && exit 1' SIGINT
|
||||||
|
|
||||||
|
# font styles & colors
|
||||||
|
font_default="\e[0m"
|
||||||
|
font_colored="\e[32;1m"
|
||||||
|
font_colored_bold="\e[31;1m"
|
||||||
|
|
||||||
|
[[ "$(id -u)" != "0" ]] && printf ""$font_colored_bold">> error: permission denied!"$font_default"\n" && exit 1
|
||||||
|
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
-n|--noconfirm)
|
||||||
|
noconfirm="true"
|
||||||
|
;;
|
||||||
|
-r|--reboot)
|
||||||
|
reboot="true"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
printf ""$font_colored_bold">> system update started..."$font_default"\n"
|
||||||
|
|
||||||
|
printf ""$font_colored"> updating packages..."$font_default"\n"
|
||||||
|
[[ "$noconfirm" ]] && apk --update-cache upgrade --progress || apk --update-cache upgrade --progress --interactive
|
||||||
|
|
||||||
|
orphans="$(apk list --orphaned | awk '{print $1}' 2> /dev/null)"
|
||||||
|
if [[ "$orphans" ]]; then
|
||||||
|
orphans="$(printf "$orphans" | tr '\n' ' ')"
|
||||||
|
printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
|
||||||
|
[[ "$noconfirm" ]] && apk del --purge --progress $orphans || apk del --purge --progress --interactive $orphans
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -f "/etc/motd" ]] && printf ""$font_colored"> removing '/etc/motd'..."$font_default"\n" && rm -f "/etc/motd"
|
||||||
|
|
||||||
|
script="$(dirname $(realpath $0))/conf.d/$(hostname).sh"
|
||||||
|
[[ -x "$script" ]] && printf ""$font_colored"> executing script "$script"..."$font_default"\n" && (. "$script")
|
||||||
|
|
||||||
|
printf ""$font_colored"> cleaning cache..."$font_default"\n"
|
||||||
|
apk cache clean &> /dev/null
|
||||||
|
rm -rf "/var/cache/apk/*"
|
||||||
|
|
||||||
|
printf ""$font_colored_bold">> system updated finished!"$font_default"\n"
|
||||||
|
|
||||||
|
[[ ! "$reboot" ]] && exit 0
|
||||||
|
|
||||||
|
timeout="5"
|
||||||
|
printf ""$font_colored"> rebooting system in "
|
||||||
|
while [[ "$timeout" -gt "0" ]]; do
|
||||||
|
printf "$timeout... "
|
||||||
|
timeout="$(( timeout - 1 ))"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
printf "now!"$font_default"\n"
|
||||||
|
reboot
|
||||||
74
scripts/update/arch.sh
Executable file
74
scripts/update/arch.sh
Executable file
|
|
@ -0,0 +1,74 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# font styles & colors
|
||||||
|
DEFAULT=$(tput sgr0)
|
||||||
|
BOLD=$(tput bold)
|
||||||
|
RED=$(tput setaf 1)
|
||||||
|
GREEN=$(tput setaf 2)
|
||||||
|
YELLOW=$(tput setaf 3)
|
||||||
|
|
||||||
|
# exit on ctr-c
|
||||||
|
trap 'printf ""${BOLD}${RED}"\n>> system update aborted after "$SECONDS" seconds!"${DEFAULT}"\n" && exit 1' SIGINT
|
||||||
|
|
||||||
|
# parse arguments
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
-n|--noconfirm)
|
||||||
|
noconfirm="--noconfirm"
|
||||||
|
;;
|
||||||
|
-r|--reboot)
|
||||||
|
reboot="true"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# sudo
|
||||||
|
sudo id -u 2&> /dev/null
|
||||||
|
|
||||||
|
printf "${BOLD}${YELLOW}>> starting system update...${DEFAULT}\n"
|
||||||
|
|
||||||
|
# upgrade installed packages
|
||||||
|
printf "${YELLOW}> upgrading packages...${DEFAULT}\n"
|
||||||
|
paru -Syu --sudoloop --combinedupgrade --devel --cleanafter $noconfirm
|
||||||
|
[[ "$?" != "0" ]] && printf "${RED}>> encountered an error upgrading packages!${DEFAULT}\n" && exit 1
|
||||||
|
printf "${GREEN}> packages successfully upgraded!${DEFAULT}\n"
|
||||||
|
|
||||||
|
# remove unused packages
|
||||||
|
unused="$(paru -Qtdq --sudoloop)"
|
||||||
|
if [[ -n "$unused" ]]; then
|
||||||
|
printf "${YELLOW}> removing unused packages...${DEFAULT}\n"
|
||||||
|
paru -Rns --sudoloop --devel --cleanafter $noconfirm $unused
|
||||||
|
[[ "$?" != "0" ]] && printf "${RED}>> encountered an error removing unused packages!${DEFAULT}\n" && exit 1
|
||||||
|
printf "${GREEN}> successfully removed unused packages!${DEFAULT}\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clean the pacman cache
|
||||||
|
printf "${YELLOW}> cleaning pacman & paru cache directories...${DEFAULT}\n"
|
||||||
|
sudo rm -rf "/var/cache/pacman/*"
|
||||||
|
sudo rm -rf "$HOME/.cache/paru"
|
||||||
|
[[ "$?" != "0" ]] && printf "${RED}>> encountered an error cleaning the pacman & paru cache directories!${DEFAULT}\n" && exit 1
|
||||||
|
printf "${GREEN}> successfully cleaned the pacman & paru cache directories!${DEFAULT}\n"
|
||||||
|
|
||||||
|
printf "${BOLD}${YELLOW}>> system updated finished after "$SECONDS" seconds!${DEfAULT}\n"
|
||||||
|
|
||||||
|
[[ -z "$reboot" ]] && exit 0
|
||||||
|
|
||||||
|
# reboot the system
|
||||||
|
timeout="5"
|
||||||
|
while [[ "$timeout" -gt "0" ]]; do
|
||||||
|
if [[ "$timeout" -gt "3" ]]; then
|
||||||
|
color="${GREEN}"
|
||||||
|
elif [[ "$timeout" -gt "1" ]]; then
|
||||||
|
color="${YELLOW}"
|
||||||
|
else
|
||||||
|
color="${RED}"
|
||||||
|
fi
|
||||||
|
printf "\r${color}> system reboot in ${BOLD}$timeout${DEFAULT} seconds..."
|
||||||
|
timeout="$((timeout - 1))"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
printf "\r${color}> system going down for reboot ${BOLD}NOW!${DEFAULT}\n"
|
||||||
|
sudo systemctl reboot 2> /dev/null
|
||||||
41
scripts/update/conf.d/aria.sh
Executable file
41
scripts/update/conf.d/aria.sh
Executable file
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
ariang="/srv/ariang"
|
||||||
|
user="nginx"
|
||||||
|
|
||||||
|
[[ ! -e "$ariang" ]] && printf "> error: directory '"$ariang"' does not exist\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
file="$(find $ariang -type f -iname 'aria-ng*.min.js' -exec realpath {} \;)"
|
||||||
|
[[ -z "$file" ]] && printf "> error: could not determine file to extract the current version from\n" 1>&2 && exit 1
|
||||||
|
current_version="$(awk -F'buildVersion:"|\",buildCommit' '{print $2}' "$file" | xargs | cut -d "v" -f2)"
|
||||||
|
[[ -z "$current_version" ]] && printf "> error: could not determine current version\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
latest_release="$(curl -s -L https://api.github.com/repos/mayswind/AriaNg/releases/latest | grep tag_name | cut -d "\"" -f4 | cut -d "v" -f2)"
|
||||||
|
[[ -z "$latest_release" ]] && printf "> error: could not determine latest release\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
[[ "$current_version" == "$latest_release" ]] && printf "> current version '"$current_version"' is already up to date\n" && exit 0
|
||||||
|
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
printf "> downloading latest release '"$latest_release"' to temporary directory '"$tmp"'..."
|
||||||
|
curl -s -L -o "$tmp/ariang-$latest_release.zip" "https://github.com/mayswind/AriaNg/releases/download/$latest_release/AriaNg-$latest_release.zip" &> /dev/null
|
||||||
|
[[ "$?" != "0" ]] && printf " error!\n" 1>&2 && exit 1
|
||||||
|
printf " done!\n"
|
||||||
|
|
||||||
|
printf "> extracting downloaded archive..."
|
||||||
|
cd "$tmp"
|
||||||
|
unzip "ariang-$latest_release.zip" &> /dev/null
|
||||||
|
[[ "$?" != "0" ]] && printf " error!\n" 1>&2 && exit 1
|
||||||
|
rm -rf "ariang-$latest_release.zip" &> /dev/null
|
||||||
|
printf " done!\n"
|
||||||
|
|
||||||
|
printf "> moving extracted files..."
|
||||||
|
rm -rf "$ariang" &> /dev/null
|
||||||
|
mv "$tmp" "$ariang" &> /dev/null
|
||||||
|
printf " done!\n"
|
||||||
|
|
||||||
|
printf "> setting correct permissions..."
|
||||||
|
chown -R "$user":"$user" "$ariang"
|
||||||
|
printf " done!\n"
|
||||||
47
scripts/update/conf.d/snappymail.sh
Executable file
47
scripts/update/conf.d/snappymail.sh
Executable file
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
snappymail="/srv/snappymail"
|
||||||
|
user="nginx"
|
||||||
|
|
||||||
|
[[ ! -e "$snappymail" ]] && printf "> error: directory '"$snappymail"' does not exist\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
current_version="$(ls -ltr "$snappymail/snappymail/v" | tail -n 1 | awk '{print $NF}')"
|
||||||
|
[[ -z "$current_version" ]] && printf "> error: could not determine current version\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
latest_release="$(curl -s -L https://api.github.com/repos/the-djmaze/snappymail/releases/latest | grep tag_name | cut -d "\"" -f4 | cut -d "v" -f2)"
|
||||||
|
[[ -z "$latest_release" ]] && printf "> error: could not determine latest release\n" 1>&2 && exit 1
|
||||||
|
|
||||||
|
[[ "$current_version" == "$latest_release" ]] && printf "> current version '"$current_version"' is already up to date\n" && exit 0
|
||||||
|
|
||||||
|
printf "> updating snappymail...\n"
|
||||||
|
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
printf "> downloading latest release '"$latest_release"' to temporary directory '"$tmp"'..."
|
||||||
|
curl -s -L -o "$tmp/snappymail-$latest_release.tar.gz" "https://github.com/the-djmaze/snappymail/releases/download/v$latest_release/snappymail-$latest_release.tar.gz" &> /dev/null
|
||||||
|
[[ "$?" != "0" ]] && printf " error!\n" 1>&2 && exit 1
|
||||||
|
printf " done!\n"
|
||||||
|
|
||||||
|
printf "> extracting downloaded archive..."
|
||||||
|
tar -xzf "$tmp/snappymail-$latest_release.tar.gz" -C "$snappymail" --overwrite &> /dev/null
|
||||||
|
[[ "$?" != "0" ]] && printf " error!\n" 1>&2 && exit 1
|
||||||
|
printf " done!\n"
|
||||||
|
|
||||||
|
printf "> getting custom themes..."
|
||||||
|
git clone "https://git.velvettear.de/velvettear/snappymail-themes.git" "/tmp/snappymail-themes"
|
||||||
|
themes="$(find "$snappymail/snappymail/v/$latest_release" -type d -iname "themes")"
|
||||||
|
find "/tmp/snappymail-themes" -mindepth 1 -maxdepth 1 ! -iname ".git" -type d -exec mv {} "$themes/" \;
|
||||||
|
rm -rf "/tmp/snappymail-themes"
|
||||||
|
|
||||||
|
printf "> setting correct permissions..."
|
||||||
|
find "$snappymail" -type d -exec chmod 755 {} \;
|
||||||
|
find "$snappymail" -type f -exec chmod 644 {} \;
|
||||||
|
chown -R "$user":"$user" "$snappymail"
|
||||||
|
printf " done!\n"
|
||||||
|
|
||||||
|
printf "> cleaning up..."
|
||||||
|
find "$snappymail/snappymail/v" -type d -maxdepth 1 ! -iname "v" ! -iname "$latest_release" -exec rm -rf {} \; &> /dev/null
|
||||||
|
rm -rf "$tmp"
|
||||||
|
printf " done!\n"
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
# debian update script
|
|
||||||
|
|
||||||
# exit on ctrl-c
|
# exit on ctrl-c
|
||||||
trap 'printf ""$font_colored_bold"\n>> stopping system update after "$SECONDS" seconds..."$font_default"\n" && exit 1' SIGINT
|
trap 'printf ""$font_colored_bold"\n>> system update aborted after "$SECONDS" seconds!"$font_default"\n" && exit 1' SIGINT
|
||||||
|
|
||||||
# font styles & colors
|
# font styles & colors
|
||||||
font_default="\e[0m"
|
font_default="\e[0m"
|
||||||
font_colored="\e[32;1m"
|
font_colored="\e[32;1m"
|
||||||
font_colored_bold="\e[31;1m"
|
font_colored_bold="\e[31;1m"
|
||||||
|
|
||||||
[[ "$EUID" != "0" ]] && printf ""$font_colored_bold">> error: permission denied!"$font_default"\n" && exit 1
|
[[ "$EUID" != "0" ]] && printf ""$font_colored_bold">> error: permission denied"$font_default"\n" && exit 1
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
|
|
@ -30,7 +28,7 @@ printf ""$font_colored_bold">> system update started..."$font_default"\n"
|
||||||
|
|
||||||
printf ""$font_colored"> updating packages..."$font_default"\n"
|
printf ""$font_colored"> updating packages..."$font_default"\n"
|
||||||
/usr/bin/apt-get update
|
/usr/bin/apt-get update
|
||||||
[[ "$noconfirm" ]] && /usr/bin/apt-get dist-upgrade -y || /usr/bin/apt-get dist-upgrade
|
[[ "$noconfirm" ]] && /usr/bin/apt-get upgrade -y || /usr/bin/apt-get upgrade
|
||||||
|
|
||||||
printf ""$font_colored"> cleaning cache..."$font_default"\n"
|
printf ""$font_colored"> cleaning cache..."$font_default"\n"
|
||||||
rm -rf "/var/cache//usr/bin/apt-get/*"
|
rm -rf "/var/cache//usr/bin/apt-get/*"
|
||||||
|
|
@ -39,18 +37,9 @@ rm -rf "/var/cache//usr/bin/apt-get/*"
|
||||||
printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
|
printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
|
||||||
[[ "$noconfirm" ]] && /usr/bin/apt-get autoremove --purge -y || /usr/bin/apt-get autoremove --purge
|
[[ "$noconfirm" ]] && /usr/bin/apt-get autoremove --purge -y || /usr/bin/apt-get autoremove --purge
|
||||||
|
|
||||||
printf ""$font_colored"> removing \"no valid subscription\" message..."$font_default"\n"
|
|
||||||
sed -i.bak "s/data.status.* !== 'ACTIVE'/false/I" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
|
|
||||||
|
|
||||||
printf ""$font_colored"> updating restic..."$font_default"\n"
|
|
||||||
restic self-update
|
|
||||||
|
|
||||||
#printf ""$font_colored"> installing dark theme..."$font_default"\n"
|
|
||||||
#bash <(curl -s https://raw.githubusercontent.com/Weilbyte/PVEDiscordDark/master/PVEDiscordDark.sh ) install
|
|
||||||
|
|
||||||
printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"
|
printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"
|
||||||
|
|
||||||
[[ ! "$reboot" ]] && exit 0
|
[[ -z "$reboot" ]] && exit 0
|
||||||
|
|
||||||
timeout="5"
|
timeout="5"
|
||||||
printf ""$font_colored"> rebooting system in "
|
printf ""$font_colored"> rebooting system in "
|
||||||
21
scripts/update/update.sh
Executable file
21
scripts/update/update.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# get distro and update script path
|
||||||
|
distro="$(grep "^ID=" /etc/*release | cut -d "=" -f2)"
|
||||||
|
if [[ "$distro" == "raspbian" ]]; then
|
||||||
|
distro="debian"
|
||||||
|
fi
|
||||||
|
script="$(dirname $(realpath $0))/$distro.sh"
|
||||||
|
|
||||||
|
# check if update script exists
|
||||||
|
[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
|
||||||
|
|
||||||
|
# execute update script
|
||||||
|
if [[ "$(id -u)" -eq 0 ]] || [[ "$distro" == "arch" ]]; then
|
||||||
|
"$script" $@
|
||||||
|
else
|
||||||
|
sudo "$script" $@
|
||||||
|
fi
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
||||||
# license: MIT
|
|
||||||
|
|
||||||
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" && exit 1
|
|
||||||
|
|
||||||
printf "scrubbing all available zfs pools...\n"
|
|
||||||
|
|
||||||
mapfile -t pools < <(zpool list | tail -n +2 | awk '{print $1}')
|
|
||||||
for pool in "${pools[@]}"; do
|
|
||||||
timestamp="$SECONDS"
|
|
||||||
printf "scrubbing zfs pool '"$pool"'...\n"
|
|
||||||
zpool scrub -w "$pool"
|
|
||||||
printf "scrubbing zfs pool '"$pool"' finished after $(( $SECONDS - $timestamp )) seconds!\n"
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "scrubbing all available zfs pools finished after $SECONDS seconds!\n"
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=filesystem preparation
|
|
||||||
Before=pveproxy.service
|
|
||||||
Before=nginx.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/etc/velvettear/scripts/prepare-fs.sh
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=restic backup
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/home/velvettear/.dots/scripts/restic/restic.sh
|
|
||||||
ExecStartPost=/home/velvettear/.dots/scripts/notify.sh "backups" "/var/log/restic-%i.log" --title "%i" --icon "green_circle"
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=restic backup
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=*-*-* 00:03:00
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
11
systemd/wol@.service
Normal file
11
systemd/wol@.service
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Wake-on-LAN for %i
|
||||||
|
Requires=network.target
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/ethtool -s %i wol g
|
||||||
|
Type=oneshot
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=scrub all available zfs pools
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/etc/velvettear/scripts/zfs-scrub.sh
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=scrub all available zfs pools weekly
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnCalendar=Sun *-*-* 08:00:00
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
50
zsh/conf.d/fujitsu
Executable file
50
zsh/conf.d/fujitsu
Executable file
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# __ _ _ _
|
||||||
|
# / _| (_|_) |
|
||||||
|
# | |_ _ _ _ _| |_ ___ _ _
|
||||||
|
# | _| | | | | | __/ __| | | |
|
||||||
|
# | | | |_| | | | |_\__ \ |_| |
|
||||||
|
# |_| \__,_| |_|\__|___/\__,_|
|
||||||
|
# _/ |
|
||||||
|
# |__/
|
||||||
|
#
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# ----- general aliases ----- #
|
||||||
|
alias eza='eza --icons --group --time-style long-iso --octal-permissions --git'
|
||||||
|
alias ls='eza'
|
||||||
|
alias ll='eza --long'
|
||||||
|
alias la='eza --all'
|
||||||
|
alias lla='eza --long --all'
|
||||||
|
alias df='duf'
|
||||||
|
alias du='gdu'
|
||||||
|
alias grep='rg -P'
|
||||||
|
alias grepa='rg -P --hidden'
|
||||||
|
alias find='fd'
|
||||||
|
alias findf='fd --type file'
|
||||||
|
alias findd='fd --type directory'
|
||||||
|
alias findl='fd --type symlink'
|
||||||
|
alias finds='fd --type socket'
|
||||||
|
alias findp='fd --type pipe'
|
||||||
|
alias findx='fd --type executable'
|
||||||
|
alias finde='fd --type empty'
|
||||||
|
alias bat='bat --style header-filename,header-filesize,grid,snip,changes,numbers'
|
||||||
|
alias cat='bat'
|
||||||
|
alias batp='bat --style plain'
|
||||||
|
alias catp='batp'
|
||||||
|
alias pfetch='printf "\n" && pfetch'
|
||||||
|
alias fetch='pfetch'
|
||||||
|
alias stats='pfetch'
|
||||||
|
alias icat='kitten icat'
|
||||||
|
|
||||||
|
# ----- non-ssh aliases ----- #
|
||||||
|
if [[ -z "$SSH_TTY" ]]; then
|
||||||
|
alias ssh='kitty +kitten ssh'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ----- pfetch ----- #
|
||||||
|
export PF_INFO="ascii title host kernel memory wm shell editor pkgs uptime palette"
|
||||||
|
|
||||||
|
# ----- kde ----- #
|
||||||
|
[[ -z "${DISPLAY}" ]] && [[ "${XDG_VTNR}" -eq 1 ]] && exec /usr/lib/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland &> /dev/null
|
||||||
48
zsh/conf.d/n97
Executable file
48
zsh/conf.d/n97
Executable file
|
|
@ -0,0 +1,48 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# _____ ______
|
||||||
|
# | _ ||___ /
|
||||||
|
# _ __ | |_| | / /
|
||||||
|
# | '_ \ \____ | / /
|
||||||
|
# | | | |.___/ /./ /
|
||||||
|
# |_| |_|\____/ \_/
|
||||||
|
#
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# ----- general aliases ----- #
|
||||||
|
alias eza='eza --icons --group --time-style long-iso --octal-permissions --git'
|
||||||
|
alias ls='eza'
|
||||||
|
alias ll='eza --long'
|
||||||
|
alias la='eza --all'
|
||||||
|
alias lla='eza --long --all'
|
||||||
|
alias df='duf'
|
||||||
|
alias du='gdu'
|
||||||
|
alias grep='rg -P'
|
||||||
|
alias grepa='rg -P --hidden'
|
||||||
|
alias find='fd'
|
||||||
|
alias findf='fd --type file'
|
||||||
|
alias findd='fd --type directory'
|
||||||
|
alias findl='fd --type symlink'
|
||||||
|
alias finds='fd --type socket'
|
||||||
|
alias findp='fd --type pipe'
|
||||||
|
alias findx='fd --type executable'
|
||||||
|
alias finde='fd --type empty'
|
||||||
|
alias bat='bat --style header-filename,header-filesize,grid,snip,changes,numbers'
|
||||||
|
alias cat='bat'
|
||||||
|
alias batp='bat --style plain'
|
||||||
|
alias catp='batp'
|
||||||
|
alias pfetch='printf "\n" && pfetch'
|
||||||
|
alias fetch='pfetch'
|
||||||
|
alias stats='pfetch'
|
||||||
|
alias icat='kitten icat'
|
||||||
|
|
||||||
|
# ----- non-ssh aliases ----- #
|
||||||
|
if [[ -z "$SSH_TTY" ]]; then
|
||||||
|
alias ssh='kitty +kitten ssh'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ----- pfetch ----- #
|
||||||
|
export PF_INFO="ascii title host kernel memory wm shell editor pkgs uptime palette"
|
||||||
|
|
||||||
|
# ----- kde ----- #
|
||||||
|
[[ -z "${DISPLAY}" ]] && [[ "${XDG_VTNR}" -eq 1 ]] && exec /usr/lib/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland &> /dev/null
|
||||||
21
zsh/conf.d/xu4q
Executable file
21
zsh/conf.d/xu4q
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# ___
|
||||||
|
# / |
|
||||||
|
# __ ___ _ / /| | __ _
|
||||||
|
# \ \/ / | | / /_| |/ _` |
|
||||||
|
# > <| |_| \___ | (_| |
|
||||||
|
# /_/\_\\__,_| |_/\__, |
|
||||||
|
# | |
|
||||||
|
# |_|
|
||||||
|
#
|
||||||
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
|
# license: MIT
|
||||||
|
|
||||||
|
# ----- general aliases ----- #
|
||||||
|
alias pfetch='printf "\n" && pfetch'
|
||||||
|
alias fetch='pfetch'
|
||||||
|
alias stats='pfetch'
|
||||||
|
alias icat='kitten icat'
|
||||||
|
|
||||||
|
# ----- pfetch ----- #
|
||||||
|
export PF_INFO="ascii title host kernel memory wm shell editor pkgs uptime palette"
|
||||||
72
zsh/zprofile
72
zsh/zprofile
|
|
@ -1,71 +1,39 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
# __ _ _
|
||||||
|
# / _(_) |
|
||||||
|
# _____ __ _ __ ___ | |_ _| | ___
|
||||||
|
# |_ / '_ \| '__/ _ \| _| | |/ _ \
|
||||||
|
# _ / /| |_) | | | (_) | | | | | __/
|
||||||
|
# (_)___| .__/|_| \___/|_| |_|_|\___|
|
||||||
|
# | |
|
||||||
|
# |_|
|
||||||
|
#
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
# export environment variables
|
# ----- prompt ----- #
|
||||||
|
|
||||||
# set .dots directory
|
|
||||||
export VELVETTEAR_DOTS="$HOME/.dots"
|
|
||||||
|
|
||||||
# set prompt
|
|
||||||
export PROMPT="%(!.%F{red}.)%n@%m > %/%(!.#.$) %f"
|
export PROMPT="%(!.%F{red}.)%n@%m > %/%(!.#.$) %f"
|
||||||
|
|
||||||
# set general variables
|
# ------ general ----- #
|
||||||
export USER="$(whoami)"
|
export USER="$(whoami)"
|
||||||
export HOST="$(hostname)"
|
export HOST="$(hostname)"
|
||||||
export HOSTNAME="$HOST"
|
export HOSTNAME="$HOST"
|
||||||
export TMP="/tmp"
|
export TMP="/tmp"
|
||||||
export TEMP="/tmp"
|
export TEMP="/tmp"
|
||||||
export TMPDIR="/tmp"
|
export TMPDIR="/tmp"
|
||||||
|
|
||||||
# set nvim as default editor
|
|
||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
export VISUAL="nvim"
|
export VISUAL="nvim"
|
||||||
export PAGER="less"
|
which bat &> /dev/null
|
||||||
|
if [[ "$?" == "0" ]]; then
|
||||||
|
echo "BAT FOUND!"
|
||||||
|
export PAGER="bat"
|
||||||
|
else
|
||||||
|
export PAGER="less"
|
||||||
|
fi
|
||||||
|
|
||||||
# configure the shell history
|
# ----- history ----- #
|
||||||
export HISTFILE="$HOME/.zhistory"
|
export HISTFILE="$HOME/.zhistory"
|
||||||
export SAVEHIST="100"
|
export SAVEHIST="10000"
|
||||||
export HISTSIZE="10000"
|
export HISTSIZE="10000"
|
||||||
export HISTTIMEFORMAT="%d.%m.%Y %H:%M:%S"
|
export HISTTIMEFORMAT="%d.%m.%Y %H:%M:%S"
|
||||||
export HISTCONTROL="ignoredups"
|
export HISTCONTROL="ignoredups"
|
||||||
|
|
||||||
# set all kinds of aliases
|
|
||||||
|
|
||||||
# file and directory listings
|
|
||||||
alias ls="ls --color=auto"
|
|
||||||
alias la="ls -a --color=auto"
|
|
||||||
alias ll="ls -l --color=auto"
|
|
||||||
alias lla="ls -la --color=auto"
|
|
||||||
|
|
||||||
# grep
|
|
||||||
alias grep="grep --color=auto"
|
|
||||||
alias fgrep="fgrep --color=auto"
|
|
||||||
alias egrep="egrep --color=auto"
|
|
||||||
|
|
||||||
# diff
|
|
||||||
alias diff="diff --color=auto"
|
|
||||||
|
|
||||||
# tar
|
|
||||||
alias tarp="tar -I pigz -cf -v"
|
|
||||||
alias untarp="tar -I pigz -xf"
|
|
||||||
|
|
||||||
# general
|
|
||||||
alias ..="cd .."
|
|
||||||
alias whereami="realpath ."
|
|
||||||
alias c="clear"
|
|
||||||
|
|
||||||
# create / delete / copy / move
|
|
||||||
alias rmr="rm -r"
|
|
||||||
alias rmrf="rm -rf"
|
|
||||||
alias cpr="cp -R"
|
|
||||||
alias cprf="cp -Rf"
|
|
||||||
alias mkdirp="mkdir -p"
|
|
||||||
|
|
||||||
# applications
|
|
||||||
alias vi="nvim"
|
|
||||||
alias vim="nvim"
|
|
||||||
|
|
||||||
# scripts
|
|
||||||
alias update="sudo $VELVETTEAR_DOTS/scripts/update.sh"
|
|
||||||
|
|
|
||||||
38
zsh/zshrc
38
zsh/zshrc
|
|
@ -1,8 +1,40 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
# _
|
||||||
|
# | |
|
||||||
|
# _______| |__ _ __ ___
|
||||||
|
# |_ / __| '_ \| '__/ __|
|
||||||
|
# _ / /\__ \ | | | | | (__
|
||||||
|
# (_)___|___/_| |_|_| \___|
|
||||||
|
#
|
||||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||||
# license: MIT
|
# license: MIT
|
||||||
|
|
||||||
# exit if user is not root
|
# ----- keybindings ----- #
|
||||||
|
bindkey "^[[1;3C" forward-word
|
||||||
|
bindkey "^[[1;3D" backward-word
|
||||||
|
|
||||||
|
# ----- history ----- #
|
||||||
|
setopt SHARE_HISTORY
|
||||||
|
|
||||||
|
# ----- aliases ----- #
|
||||||
|
alias c='clear'
|
||||||
|
alias ..='cd ..'
|
||||||
|
alias whereami='realpath .'
|
||||||
|
alias ll='ls -l'
|
||||||
|
alias la='ls -a'
|
||||||
|
alias lla='ls -la'
|
||||||
|
alias rmr='rm -r'
|
||||||
|
alias rmrf='rm -rf'
|
||||||
|
alias cpr='cp -R'
|
||||||
|
alias cprf='cp -Rf'
|
||||||
|
alias mkdirp='mkdir -p'
|
||||||
|
alias vi='nvim'
|
||||||
|
alias vim='nvim'
|
||||||
|
alias diff='diff --color=auto'
|
||||||
|
alias update='$HOME/.dots/scripts/update/update.sh'
|
||||||
|
|
||||||
|
# ----- conf.d ----- #
|
||||||
|
. "$HOME/.dots/zsh/conf.d/$(hostname)" &> /dev/null
|
||||||
|
|
||||||
|
# ----- root ----- #
|
||||||
[[ "$EUID" != "0" ]] && return
|
[[ "$EUID" != "0" ]] && return
|
||||||
echo "LOGIN AS ROOT"
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue