Compare commits

...

3 commits
dot2 ... main

Author SHA1 Message Date
Strix
ba52a96a60 fix: stuff 2024-06-04 14:43:05 +02:00
dd70dd0ad4 fix: url 2024-06-04 14:30:25 +02:00
f9907d9a71 cleanup 2024-06-04 14:29:51 +02:00
10 changed files with 41 additions and 150 deletions

View file

@ -1,27 +0,0 @@
name = "example" #*
description = "hello"
author = ":$3"
# [ LINKS ]
# This defines what links should be made.
# vars:
# "$CRATE" expands to path of directory of this file.
# "$CROOT" expands to base directory / cwd from the runner
# prefixes:
# "#" - system root
# "~" - home of user or user defined in options
# "%" - temp directory
[links]
"$CRATE/system.sh" = { name = "/etc/system_boot", su = "true" }
"$CRATE/system2.sh" = "#/etc/system_boot.sh" # same as above
# [ COPIES ]
# basically the same as links but copies
[copies]
"$CRATE/system3.sh" = "#/etc/system_boot.sh" # same as above
# [ SCRIPTS ]
# Run stuff
[scripts]
"$CRATE/system/net_config.sh" = 1
"$CRATE/system/net_config2.sh" = { su = "false" }

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" scripts="@distro @self"
apply() { apply() {
git config --global user.name Raine git config --global user.name Strix
git config --global user.email raine@ixvd.net 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 \

50
dot
View file

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

View file

@ -3,12 +3,12 @@
# this script is meant to be ran when .dotfiles is not present. # this script is meant to be ran when .dotfiles is not present.
# #
# example: # example:
# curl https://git.ixvd.net/raine/dotfiles/raw/branch/main/remote_script.sh | sh # curl https://git.saluco.nl/strix/dotfiles/raw/branch/main/remote_script.sh | sh
set -e set -e
HOME=${HOME:-/home/${USER:-$(whomai)}} HOME=${HOME:-/home/${USER:-$(whomai)}}
[ -d "$HOME/.dotfiles" ] || git clone https://git.ixvd.net/raine/dotfiles $HOME/.dotfiles [ -d "$HOME/.dotfiles" ] || git clone https://git.saluco.nl/strix/dotfiles $HOME/.dotfiles
cd $HOME/.dotfiles cd $HOME/.dotfiles
./dot a ./dot a