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
|
||||
|
||||
ORIGIN_PWD="$PWD"
|
||||
|
||||
if ! [ "$UID" = "0" ]; then
|
||||
echo "please perform as root, attempting to escalate privileges..."
|
||||
exec sudo $0
|
||||
exec sudo $(cat /proc/$$/cmdline | sed 's/\x00/ /g')
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -25,8 +27,22 @@ if ! [ -d "/neb" ]; then
|
|||
/neb
|
||||
fi
|
||||
|
||||
if ! [ -d "/etc/cron.d/restic.crontab" ]; then
|
||||
echo "setting up restic cron"
|
||||
mkdir -p /etc/cron.d/
|
||||
cp /neb/common/restic/restic.crontab /etc/cron.d/restic.crontab
|
||||
if ! [ -f "/root/.ssh/authorized_keys" ]; then
|
||||
echo "importing authorized_keys..."
|
||||
mkdir -p /root/.ssh
|
||||
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
|
||||
|
||||
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