fix: setup script up to date
This commit is contained in:
parent
b5cebcd226
commit
9cbcd25bb8
1 changed files with 22 additions and 6 deletions
26
setup.sh
26
setup.sh
|
@ -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
|
||||||
|
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
|
||||||
|
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
|
Loading…
Reference in a new issue