clean repository
This commit is contained in:
parent
c754df18c2
commit
b4f587ce1c
15 changed files with 1 additions and 372 deletions
|
@ -1,3 +1,3 @@
|
|||
# .dots
|
||||
|
||||
### personal dot files for proxmox based hosts
|
||||
### personal dot files
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 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
|
||||
|
||||
echo "user: $user"
|
||||
echo "pw: $password"
|
||||
echo "url: $url"
|
||||
echo "args: ${args[@]}"
|
||||
|
||||
curl -u $user:$password "${args[@]}" $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"
|
|
@ -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"
|
|
@ -1,32 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
# exit on error
|
||||
|
||||
# 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
|
||||
|
||||
# get hostname
|
||||
host="$(hostname)"
|
||||
[[ -z "$host" ]] && host="$HOST"
|
||||
|
||||
# setup restic
|
||||
export RESTIC_REPOSITORY="rest:http://192.168.100.101:8000"
|
||||
export RESTIC_PASSWORD="\$Velvet90"
|
||||
export RESTIC_COMPRESSION="max"
|
||||
export RESTIC_CACHE_DIR="/var/cache/restic"
|
||||
|
||||
# setup log file
|
||||
log="/var/log/restic-"$(hostname)".log"
|
||||
|
||||
# source / execute restic script
|
||||
source "$script" 2>&1 | tee "$log"
|
||||
|
||||
# send a notification when finished
|
||||
/home/velvettear/.dots/scripts/notify.sh "backups" "$log" --title "$host" --icon "green_circle"
|
|
@ -1,63 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
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"> 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
|
||||
|
||||
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"
|
||||
|
||||
[[ ! "$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
|
|
@ -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
|
|
@ -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
|
71
zsh/zprofile
71
zsh/zprofile
|
@ -1,71 +0,0 @@
|
|||
#!/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
|
||||
export PROMPT="%(!.%F{red}.)%n@%m > %/%(!.#.$) %f"
|
||||
|
||||
# set general variables
|
||||
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"
|
||||
|
||||
# configure the shell history
|
||||
export HISTFILE="$HOME/.zhistory"
|
||||
export SAVEHIST="100"
|
||||
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"
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
||||
# license: MIT
|
||||
|
||||
# exit if user is not root
|
||||
[[ "$EUID" != "0" ]] && return
|
||||
echo "LOGIN AS ROOT"
|
Loading…
Reference in a new issue