fix: setup script up to date

This commit is contained in:
Strix 2023-10-18 18:08:05 +02:00
parent b5cebcd226
commit 9cbcd25bb8
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774

View file

@ -4,9 +4,11 @@
## PREFLIGHT ## PREFLIGHT
ORIGIN_PWD="$PWD"
if ! [ "$UID" = "0" ]; then if ! [ "$UID" = "0" ]; then
echo "please perform as root, attempting to escalate privileges..." echo "please perform as root, attempting to escalate privileges..."
exec sudo $0 exec sudo $(cat /proc/$$/cmdline | sed 's/\x00/ /g')
exit 1 exit 1
fi fi
@ -25,8 +27,22 @@ if ! [ -d "/neb" ]; then
/neb /neb
fi fi
if ! [ -d "/etc/cron.d/restic.crontab" ]; then if ! [ -f "/root/.ssh/authorized_keys" ]; then
echo "setting up restic cron" echo "importing authorized_keys..."
mkdir -p /etc/cron.d/ mkdir -p /root/.ssh
cp /neb/common/restic/restic.crontab /etc/cron.d/restic.crontab cp secrets/ssh/authorized_keys /root/.ssh/authorized_keys
fi else
if ! grep -q "# IXVD keys" /root/.ssh/authorized_keys; then
echo "importing authorized_keys..."
cat secrets/ssh/authorized_keys >> /root/.ssh/authorized_keys
fi
fi
mkdir -p /etc/cron.d
cd common/cron
for cronfile in *.crontab; do
[ -f "/etc/cron.d/$cronfile" ] && continue
echo "installing $cronfile..."
cp $cronfile /etc/cron.d/$cronfile
done
cd $ORIGIN_PWD