fix: stuff

This commit is contained in:
Strix 2024-06-04 14:43:05 +02:00
parent dd70dd0ad4
commit ba52a96a60
8 changed files with 39 additions and 121 deletions

View file

@ -1 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= raine@ryuk
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= strix@ryuk

View file

@ -4,6 +4,6 @@ describe="Setup git"
scripts="@distro @self"
apply() {
git config --global user.name Raine
git config --global user.email raine@ixvd.net
git config --global user.name Strix
git config --global user.email strix@saluco.nl
}

View file

@ -1,8 +0,0 @@
#!/bin/sh
apply() {
echo "------------ WARNING ------------"
echo "BACKUPS ARE NOT SETUP ON DEBIAN! "
echo " PLEASE SETUP MANUALLY "
echo "---------------------------------"
}

View file

@ -1,4 +0,0 @@
#!/bin/sh
describe="Setup restic backups"
scripts="@distro" # only distro

View file

@ -1,41 +0,0 @@
#!/bin/bash
HOSTNAME=${HOSTNAME:-$(hostname)}
log() {
echo "log: $@"
if [ -f "/var/backups/ntfy.env" ]; then
. /var/backups/ntfy.env
curl \
-s \
-d "$@" \
${NTFY_URL:-https://push.ixvd.net/logs}
fi
}
log starting backup for $HOSTNAME
restic \
-r /var/backups/$HOSTNAME \
-p /var/backups/$HOSTNAME.secret \
backup \
--tag auto \
--exclude-caches \
--exclude dist \
--exclude target \
--exclude node_modules \
--exclude bin \
--exclude .cache \
--exclude '.config/*/cache' \
--exclude '.config/*/Cache' \
--exclude .cargo/git \
--exclude .cargo/registry \
--exclude '.rustup' \
--exclude '.local' \
--exclude '.var' \
--exclude Steam \
--exclude '.config/Code' \
--exclude '.config/Code - OSS' \
--exclude 'code/linux' \
--exclude Downloads \
/srv /home /etc
log backup finished with $?

View file

@ -1,10 +0,0 @@
#!/bin/sh
HOSTNAME=${HOSTNAME:-$(hostname)}
[ -d "/var/backups" ] || mkdir -p /var/backups
[ -f "/var/backups/$HOSTNAME.secret" ] || openssl rand -hex 64 > /var/backups/$HOSTNAME.secret
restic init \
-r /var/backups/$HOSTNAME \
-p /var/backups/$HOSTNAME.secret

View file

@ -1,11 +0,0 @@
#!/bin/bash
# sync backup to *the* external
HOSTNAME=${HOSTNAME:-$(hostname)}
set -e
rsync \
--info=progress2 \
-avzylu \

48
dot
View file

@ -26,21 +26,6 @@ func() {
is_function $2 && $2
}
get_command() {
case $1 in
a*)
printf "apply"
;;
u*)
printf "undo"
;;
*)
echo "err: not supported" >&2
exit 1
;;
esac
}
# only run this *in crate dir*
run_crate() {
enabled=1
@ -51,7 +36,7 @@ run_crate() {
if [ $enabled -ne 1 ]; then
return
fi
cmd=$(get_command $1)
cmd=$1
scripts=${scripts:-"@self @distro"}
for s in $scripts; do
echo "exec($(basename $PWD)): $s/$cmd"
@ -80,18 +65,25 @@ echo "# user: $USER (${UID:-$(id -u)})"
echo "# groups: $(groups)"
echo "# distro: $(curr_distro)"
if [ $# -eq 2 ]; then
[ -d crates/*$1 ] || exit 1
cd crates/*$1
run_crate $2
cd ../..
cmd=$1
if [ -z "$cmd" ]; then
echo "usage: $0 <command> [...args]"
exit 1
else
[ $# -eq 0 ] && exit 2
for crate in $(find ./crates -mindepth 1 -maxdepth 1 -type d | sort); do
cd $crate
run_crate $1
cd ../..
done
shift
fi
for c in ${@:-$(ls crates)}; do
[ -d crates/*$c ] || exit 1
cd crates/*$c
case $cmd in
a | apply)
run_crate apply
;;
u | undo)
run_crate undo
;;
*) exit 1 ;;
esac
cd ../..
done