clean up for termux installations

This commit is contained in:
Daniel Sommer 2025-04-09 12:44:13 +02:00
parent 0145b7684c
commit b35f3046b4
25 changed files with 11 additions and 952 deletions

View file

@ -1,20 +0,0 @@
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

View file

@ -1,50 +0,0 @@
# 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

@ -1,49 +0,0 @@
# 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

View file

@ -1,10 +0,0 @@
# 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"

View file

@ -1,70 +0,0 @@
#
# $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,53 +0,0 @@
#!/usr/bin/env zsh
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# usage:
# notify.sh <topic> <payload> [options]
# documentation @ https://docs.ntfy.sh/publish
url="https://notify.velvettear.de"
user="velvettear"
password="\$Velvet90"
[[ -z "$1" ]] && printf "error: no topic specified\n" 1>&2 && exit 1
[[ -z "$2" ]] && printf "error: no payload specified\n" 1>&2 && exit 1
url="$url/$1"
payload="$2"
# check if payload is a file
if [[ -e "$payload" ]]; then
args+=("-T" "$(realpath $payload)" "-H" "Filename: $(basename $payload)")
else
args+=("-d" "$payload")
fi
# check for valid priority level
function checkPriority() {
prio="$(printf "$1" | tr '[:upper:]' '[:lower:]')"
if [[ "$prio" == "min" ]] || [[ "$prio" == "low" ]] || [[ "$prio" == "default" ]] || [[ "$prio" == "high" ]] || [[ "$prio" == "max" ]] || [[ "$prio" == "urgent" ]]; then
args+=("-H" "Priority: $prio")
fi
}
# check arguments
index=1
for arg in "$@"; do
((index++))
value="${@[$index]}"
case "$arg" in
-e|--emoji|-i|--icon)
args+=("-H" "Tags: $value")
;;
-p|--priority)
checkPriority "$value"
;;
-t|--title)
args+=("-H" "Title: $value")
;;
esac
done
curl -s -u $user:$password ${args[@]} $url

View file

@ -1,80 +0,0 @@
#!/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,35 +0,0 @@
#!/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"

View file

@ -1,26 +0,0 @@
#!/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"

View file

@ -1,35 +0,0 @@
#!/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"
)

View file

@ -1,48 +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 which action to execute
[[ -n "$1" ]] && action="$1" || action="backup"
# check if script exists
script="$(dirname $(realpath "$0"))/$action.sh"
[[ ! -x "$script" ]] && printf "error: script '"$script"' does not exist or is not executable!\n" >&2 && exit 1
# get the "home" directory
home="$(dirname $(realpath "$0"))"
# setup restic
export RESTIC_USER="$(whoami)"
export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000"
export RESTIC_PASSWORD="\$Velvet90"
export RESTIC_COMPRESSION="auto"
export RESTIC_CACHE_DIR="/var/cache/restic"
export RESTIC_LOG="/var/log/restic-$action.log"
# check if .env file exists and source it
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 "$script" > >(tee "$RESTIC_LOG") 2>&1
# execute "post" action if defined
[[ -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

View file

@ -1,39 +0,0 @@
#!/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

View file

@ -1,11 +0,0 @@
#!/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"

View file

@ -1,27 +0,0 @@
#!/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"

View file

@ -1,26 +1,20 @@
#!/usr/bin/env zsh
#!/data/data/com.termux/files/usr/bin/bash
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# author: Daniel Sommer <daniel.sommer@velvettear.de>
# license: MIT
# exit on ctrl-c
trap 'printf ""$font_colored_bold"\n>> system update aborted after "$SECONDS" seconds!"$font_default"\n" && exit 1' SIGINT
# termux update script
# 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
for arg in "$@"; do
case "$arg" in
-n|--noconfirm)
noconfirm="true"
;;
-r|--reboot)
reboot="true"
;;
esac
done
@ -34,19 +28,13 @@ printf ""$font_colored"> cleaning cache..."$font_default"\n"
rm -rf "/var/cache//usr/bin/apt-get/*"
[[ "$noconfirm" ]] && /usr/bin/apt-get clean -y || /usr/bin/apt-get clean
printf ""$font_colored"> updating 'pfetch'..."$font_default"\n"
[[ ! -d "$HOME/.pfetch" ]] && mkdir "$HOME/.pfetch"
curl -L -s "https://raw.githubusercontent.com/dylanaraps/pfetch/master/pfetch" > "$HOME/.pfetch/pfetch"
chmod +x "$HOME/.pfetch/pfetch"
[[ ! -f "/data/data/com.termux/files/usr/bin/pfetch" ]] && ln -s "$HOME/.pfetch/pfetch" "/data/data/com.termux/files/usr/bin/pfetch"
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_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n"
[[ -z "$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"
systemctl reboot

View file

@ -1,60 +0,0 @@
#!/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

View file

@ -1,74 +0,0 @@
#!/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

View file

@ -1,41 +0,0 @@
#!/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

@ -1,47 +0,0 @@
#!/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,21 +0,0 @@
#!/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,11 +0,0 @@
[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,50 +0,0 @@
#!/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

View file

@ -1,48 +0,0 @@
#!/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

View file

@ -1,21 +0,0 @@
#!/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

@ -31,10 +31,7 @@ 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
alias update='$HOME/.dots/scripts/update.sh'
# ----- root ----- #
[[ "$EUID" != "0" ]] && return