Compare commits

..

34 commits

Author SHA1 Message Date
ee6362c5b8 fix 'PAGER' setup 2025-05-15 11:06:47 +02:00
0145b7684c use update script for debian on raspbian 2025-01-29 10:38:40 +01:00
54c7b09524 fix update script (specifically for debian) 2024-12-10 09:39:19 +01:00
6d0919cb6f Merge branch 'master' of https://git.velvettear.de/velvettear/.dots 2024-12-10 09:16:31 +01:00
3ea5eee6bc fix syntax and change shebang to 'zsh' 2024-12-10 09:16:00 +01:00
a745f5f98f move podman control script to repository 'compose-stacks' 2024-11-28 16:54:14 +01:00
380ada85ac add podman control script 2024-11-28 14:02:31 +01:00
3ca7eea87d change compression to 'auto' 2024-11-05 16:34:19 +01:00
4d6c30d30a merge remote changes 2024-11-05 16:33:30 +01:00
32f8ce1c55 fix alpine update script 2024-11-05 16:27:47 +01:00
4c0fd1c103 fix alpine update script to use shared cache 2024-11-05 16:12:57 +01:00
9ceae1e7f1 modify script 2024-11-05 15:44:12 +01:00
9d912f5fee fix update script for archlinux 2024-11-05 15:43:50 +01:00
720cfd75b2 fix script to be posix compliant 2024-10-28 13:57:14 +01:00
379b0529cf add restic scripts 2024-10-28 13:42:07 +01:00
aa4d8b6c64 change shebang line 2024-10-28 13:26:03 +01:00
3248acdbe2 extend 'snappymail' update script 2024-10-28 12:59:32 +01:00
10d7a78891 update 'xu4q' aliases, add nut script 2024-10-16 15:50:26 +02:00
c5c1a95a34 add notification script 2024-10-11 15:19:31 +02:00
4e0071d93a remove zsh config for 'docker' 2024-10-02 16:14:35 +02:00
92934e48fe update zsh configs 2024-10-02 16:10:18 +02:00
cd8e274705 update 'xu4q' config 2024-10-02 16:06:16 +02:00
f1a5d217fc update 'fujitsu' config 2024-10-02 16:01:26 +02:00
8b2ef3da50 fix minor zsh bugs 2024-10-02 15:56:50 +02:00
a0241ad8bd add zsh config for 'xu4q' 2024-10-02 11:55:40 +02:00
9b55aabb93 set pager to 'less' if 'bat' is unavailable 2024-10-02 11:18:39 +02:00
e9740ecf56 fix minor issues 2024-09-26 13:45:53 +02:00
26c70398ef fix files for different hosts 2024-09-26 12:18:47 +02:00
b99c26fbfa (re)move host specific aliases 2024-09-26 11:42:28 +02:00
78e78ceb84 suppress error message 2024-09-26 11:18:17 +02:00
8ae771f5b4 add systemd subfolder 2024-09-26 11:14:05 +02:00
9356a41f0e fix ascii art 2024-09-26 11:12:32 +02:00
9a081f6816 add basic files 2024-09-26 11:05:50 +02:00
b4f587ce1c clean repository 2024-08-28 15:24:03 +02:00
45 changed files with 810 additions and 317 deletions

View file

@ -1,3 +1,8 @@
# .dots
### personal dot files for proxmox based hosts
```
_ _
| | | |
__| | ___ | |_ ___
/ _` |/ _ \| __/ __|
| (_| | (_) | |_\__ \
(_)__,_|\___/ \__|___/
```

20
config/kitty/colors.conf Normal file
View 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
View 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

View 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
View 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
View 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

View file

@ -1,18 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# exit on error
set -e
# check permissions
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
# check if script exists
script="$(dirname $(realpath "$0"))/$(hostname).sh"
[[ ! -x "$script" ]] && printf "error: script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
# execute script
printf ">> executing script '"$script"'...\n"
. "$script"

View file

@ -1,7 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
hdparm -S 1 -y /dev/sdc
hdparm -S 1 -y /dev/sdd

View file

@ -1,22 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# merge files from two folders and cleanup the source
# get and check variables
[[ -z "$1" ]] && printf "error: no source directory specified!\n" >&2 && exit 1
[[ -z "$2" ]] && printf "error: no destination directory specified!\n" >&2 && exit 1
source="$(realpath $1)"
destination="$(realpath $2)"
[[ ! -d "$source" ]] && printf "error: source '"$source"' is not a valid or existing directory!\n" >&2 && exit 1
[[ ! -d "$destination" ]] && printf "error: destination '"$destination"' is not a valid or existing directory!\n" >&2 && exit 1
printf ">> merging directory '"$source"' into '"$destination"' with rsync...\n"
rsync -avh --remove-source-files --progress "$source/" "$destination"
find "$source" -mindepth 1 -type d -empty -delete
printf ">> merge finished after "$SECONDS" seconds!\n"

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
@ -36,7 +36,7 @@ function checkPriority() {
index=1
for arg in "$@"; do
((index++))
value="${!index}"
value="${@[$index]}"
case "$arg" in
-e|--emoji|-i|--icon)
args+=("-H" "Tags: $value")
@ -50,9 +50,4 @@ for arg in "$@"; do
esac
done
echo "user: $user"
echo "pw: $password"
echo "url: $url"
echo "args: ${args[@]}"
curl -s -u $user:$password "${args[@]}" $url
curl -s -u $user:$password ${args[@]} $url

80
scripts/nut.sh Executable file
View 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

View file

@ -1,9 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
echo '0' > '/proc/sys/kernel/nmi_watchdog';
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';
echo 'disabled' > '/sys/bus/usb/devices/2-3/power/wakeup';
echo 'disabled' > '/sys/bus/usb/devices/2-4/power/wakeup';

View file

@ -1,8 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
echo '0' > '/proc/sys/kernel/nmi_watchdog';
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';
echo 'auto' > '/sys/bus/usb/devices/3-7.3/power/control';

View file

@ -1,18 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# exit on error
set -e
# check permissions
[[ "$EUID" != 0 ]] && printf "error: permission denied!\n" >&2 && exit 1
# check if script exists
script="$(dirname $(realpath "$0"))/$(hostname).sh"
[[ ! -x "$script" ]] && printf "error: script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
# execute script
printf ">> executing script '"$script"'...\n"
. "$script"

View file

@ -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"

View file

@ -25,7 +25,7 @@ printf ">> starting restic backup to repository '"$RESTIC_REPOSITORY"'...\n"
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 "$directory"
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

View file

@ -1,15 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# define title and icon for the notification
export RESTIC_NTFY_TITLE="$(hostname)"
export RESTIC_NTFY_ICON="green_circle"
# define directories to backup
export RESTIC_DIRECTORIES=(
"/etc"
"/root"
"/home/velvettear"
)

View file

@ -1,15 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# define title and icon for the notification
export RESTIC_NTFY_TITLE="$(hostname)"
export RESTIC_NTFY_ICON="green_circle"
# define directories to backup
export RESTIC_DIRECTORIES=(
"/etc"
"/root"
"/home/velvettear"
)

View file

@ -10,12 +10,15 @@
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
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"

View file

@ -15,7 +15,7 @@ export RESTIC_BACKUP_POST="printf '\n> unmounting remote storage...\n' && umount
# define pre and post prune actions
export RESTIC_PRUNE_PRE=""
export RESTIC_PRUNE_POST="printf '\n> fixing ownership of repository...\n' && chown -R restic:restic $RESTIC_REPOSITORY"
export RESTIC_PRUNE_POST=""
# define title and icon for the notification
export RESTIC_NTFY_TITLE="storage"
@ -30,6 +30,6 @@ export RESTIC_DIRECTORIES=(
"/mnt/n100/images"
"/mnt/n100/music"
"/mnt/n100/software"
"/mnt/n100/immich"
"/mnt/n100/syncthing"
"/mnt/n100/videos"
)

View file

@ -23,7 +23,7 @@ home="$(dirname $(realpath "$0"))"
export RESTIC_USER="$(whoami)"
export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000"
export RESTIC_PASSWORD="\$Velvet90"
export RESTIC_COMPRESSION="max"
export RESTIC_COMPRESSION="auto"
export RESTIC_CACHE_DIR="/var/cache/restic"
export RESTIC_LOG="/var/log/restic-$action.log"
@ -45,4 +45,4 @@ source "$script" > >(tee "$RESTIC_LOG") 2>&1
[[ -n "$RESTIC_ACTION_POST" ]] && eval "$RESTIC_ACTION_POST"
# send a notification
/home/velvettear/.dots/scripts/notify.sh "restic" "$RESTIC_LOG" --title "$RESTIC_NTFY_TITLE" --icon "$RESTIC_NTFY_ICON" > /dev/null
/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
View 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
View 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
View 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
View 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
View 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
View 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"

View 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"

View file

@ -1,19 +1,17 @@
#!/usr/bin/env bash
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# debian update script
# 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_default="\e[0m"
font_colored="\e[32;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
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"
/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"
rm -rf "/var/cache//usr/bin/apt-get/*"
@ -39,17 +37,9 @@ rm -rf "/var/cache//usr/bin/apt-get/*"
printf ""$font_colored"> removing orphaned packages..."$font_default"\n"
[[ "$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
if [[ "$(which restic &> /dev/null)" ]]; then
printf ""$font_colored"> updating restic..."$font_default"\n"
restic self-update
fi
printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"
[[ ! "$reboot" ]] && exit 0
[[ -z "$reboot" ]] && exit 0
timeout="5"
printf ""$font_colored"> rebooting system in "

21
scripts/update/update.sh Executable file
View 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

View file

@ -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"

View file

@ -1,9 +0,0 @@
[Unit]
Description=set cpu governor to %i
[Service]
Type=oneshot
ExecStart=cpupower frequency-set -g %i
[Install]
WantedBy=multi-user.target

View file

@ -1,9 +0,0 @@
[Unit]
Description=put various drives in standby mode and set their spin-down timer
[Service]
Type=oneshot
ExecStart=/home/velvettear/.dots/scripts/hdparm/hdparm.sh
[Install]
WantedBy=multi-user.target

View file

@ -1,9 +0,0 @@
[Unit]
Description=enable various powersaving modes
[Service]
Type=oneshot
ExecStart=/home/velvettear/.dots/scripts/powertop/powertop.sh
[Install]
WantedBy=multi-user.target

View file

@ -1,11 +0,0 @@
[Unit]
Description=filesystem preparation
Before=pveproxy.service
Before=nginx.service
[Service]
Type=oneshot
ExecStart=/home/velvettear/.dots/scripts/prepare-fs.sh
[Install]
WantedBy=multi-user.target

View file

@ -1,9 +0,0 @@
[Unit]
Description=restic backup
[Service]
Type=oneshot
ExecStart=/home/velvettear/.dots/scripts/restic/restic.sh
[Install]
WantedBy=multi-user.target

View file

@ -1,8 +0,0 @@
[Unit]
Description=restic backup
[Timer]
OnCalendar=*-*-* 00:03:00
[Install]
WantedBy=timers.target

11
systemd/wol@.service Normal file
View 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

View file

@ -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

View file

@ -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
View 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
View 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
View 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"

View file

@ -1,72 +1,39 @@
#!/usr/bin/env zsh
# __ _ _
# / _(_) |
# _____ __ _ __ ___ | |_ _| | ___
# |_ / '_ \| '__/ _ \| _| | |/ _ \
# _ / /| |_) | | | (_) | | | | | __/
# (_)___| .__/|_| \___/|_| |_|_|\___|
# | |
# |_|
#
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# export environment variables
# set .dots directory
export VELVETTEAR_DOTS="$HOME/.dots"
# set prompt
# ----- prompt ----- #
export PROMPT="%(!.%F{red}.)%n@%m > %/%(!.#.$) %f"
# set general variables
# ------ general ----- #
export USER="$(whoami)"
export HOST="$(hostname)"
export HOSTNAME="$HOST"
export TMP="/tmp"
export TEMP="/tmp"
export TMPDIR="/tmp"
# set nvim as default editor
export EDITOR="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 SAVEHIST="100"
export SAVEHIST="10000"
export HISTSIZE="10000"
export HISTTIMEFORMAT="%d.%m.%Y %H:%M:%S"
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"
alias merge="$VELVETTEAR_DOTS/scripts/merge.sh"

View file

@ -1,10 +1,40 @@
#!/usr/bin/env zsh
# _
# | |
# _______| |__ _ __ ___
# |_ / __| '_ \| '__/ __|
# _ / /\__ \ | | | | | (__
# (_)___|___/_| |_|_| \___|
#
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# share zsh history
# ----- keybindings ----- #
bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word
# ----- history ----- #
setopt SHARE_HISTORY
# exit if user is not root
# ----- 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