diff --git a/crates/01-ssh/files/authorized_keys b/crates/01-ssh/files/authorized_keys index b8f3fd6..7115b29 100644 --- a/crates/01-ssh/files/authorized_keys +++ b/crates/01-ssh/files/authorized_keys @@ -1 +1 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= raine@ryuk \ No newline at end of file +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCeNQfnbyyF3sht43vH5BcXDPca8nWu6bKPVGvAlWBOq4Av8ME2IQgwVe9nJ05r73ZY02/Vdqc01a8wyK5Hmw0XlPL0Cn6wc9QoiscOvq5lMUK87S2tr3EVLGkgl8o7nmVuWgLewyojiORjM02P1PZEiFhKPXVEQFxU0dFz9QtpAdm0u78Xn2HTukHpXSv44R3XDDMFZ3Ek/XRuS6J9dZVxGkgCLQhK8kpfbxuiYxaRC7MHgGlYuxjLuZ6P4i+V+SSSShfCGdm6U9bgeIAwftN6a8Pc9+OsBeZGSUrGjZjRlD35q0a7fbpoS8pKTfbwgf/ijYeu3JmAQUlY+H959mIpg4H9XOgRrKVJSYwx5/BGuhmWgVy6HIYpXCQfEbLE7QDmwC2C430KzAH6jCcrRNyurIUCuO4iq9dwoQTzboMccOK79S2Z+1B5fYgS3BZgaiTUBSME2G2FriM6utgleiBnvFu/p7oH2I8ZHL/aVcSWAw0gbzsr7ADywAuiDNZk18c= strix@ryuk \ No newline at end of file diff --git a/crates/40-git/crate.sh b/crates/40-git/crate.sh index 0579e1f..e9376ac 100644 --- a/crates/40-git/crate.sh +++ b/crates/40-git/crate.sh @@ -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 } diff --git a/crates/90-backups/crate.debian.sh b/crates/90-backups/crate.debian.sh deleted file mode 100644 index e49c6e4..0000000 --- a/crates/90-backups/crate.debian.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -apply() { - echo "------------ WARNING ------------" - echo "BACKUPS ARE NOT SETUP ON DEBIAN! " - echo " PLEASE SETUP MANUALLY " - echo "---------------------------------" -} \ No newline at end of file diff --git a/crates/90-backups/crate.sh b/crates/90-backups/crate.sh deleted file mode 100644 index 98297e4..0000000 --- a/crates/90-backups/crate.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -describe="Setup restic backups" -scripts="@distro" # only distro \ No newline at end of file diff --git a/crates/90-backups/scripts/backup.sh b/crates/90-backups/scripts/backup.sh deleted file mode 100644 index 850c168..0000000 --- a/crates/90-backups/scripts/backup.sh +++ /dev/null @@ -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 $? \ No newline at end of file diff --git a/crates/90-backups/scripts/setup.sh b/crates/90-backups/scripts/setup.sh deleted file mode 100644 index d4a598d..0000000 --- a/crates/90-backups/scripts/setup.sh +++ /dev/null @@ -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 \ No newline at end of file diff --git a/crates/90-backups/scripts/sync.sh b/crates/90-backups/scripts/sync.sh deleted file mode 100644 index 6b58e5f..0000000 --- a/crates/90-backups/scripts/sync.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# sync backup to *the* external - -HOSTNAME=${HOSTNAME:-$(hostname)} - -set -e - -rsync \ - --info=progress2 \ - -avzylu \ \ No newline at end of file diff --git a/dot b/dot index 17ee37d..6a0f50d 100755 --- a/dot +++ b/dot @@ -3,7 +3,7 @@ ask=0 is_function() { - type "$1" 2> /dev/null | sed "s/$1//" | grep -qwi function + type "$1" 2>/dev/null | sed "s/$1//" | grep -qwi function } curr_distro() { @@ -23,22 +23,7 @@ func() { [ "$(id -u)" = "0" ] && sh -c "$ecmd" || sudo sh -c "$ecmd" unset ecmd fi - is_function $2 && $2 -} - -get_command() { - case $1 in - a*) - printf "apply" - ;; - u*) - printf "undo" - ;; - *) - echo "err: not supported" >&2 - exit 1 - ;; - esac + is_function $2 && $2 } # only run this *in crate dir* @@ -51,25 +36,25 @@ run_crate() { if [ $enabled -ne 1 ]; then return fi - cmd=$(get_command $1) + cmd=$1 scripts=${scripts:-"@self @distro"} - for s in $scripts; do + for s in $scripts; do echo "exec($(basename $PWD)): $s/$cmd" case $s in - @self) - func ./crate.sh $cmd + @self) + func ./crate.sh $cmd ;; - @distro) - unset -f super_$cmd - unset -f $cmd - include ./crate.$(curr_distro).sh - func ./crate.$(curr_distro).sh $cmd - unset -f super_$cmd - unset -f $cmd - include ./crate.sh + @distro) + unset -f super_$cmd + unset -f $cmd + include ./crate.$(curr_distro).sh + func ./crate.$(curr_distro).sh $cmd + unset -f super_$cmd + unset -f $cmd + include ./crate.sh ;; - *) - sh $s + *) + sh $s ;; esac done @@ -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 ../.. -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 +cmd=$1 +if [ -z "$cmd" ]; then + echo "usage: $0 [...args]" + exit 1 +else + shift fi - \ No newline at end of file +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