neb/tools/server-setup.sh

39 lines
708 B
Bash
Raw Normal View History

2023-10-20 00:10:39 +02:00
#!/bin/sh
# setup server
## PREFLIGHT
ORIGIN_PWD="$PWD"
2023-10-22 17:49:57 +02:00
if ! [ "$(id -u)" = "0" ]; then
2023-10-20 00:10:39 +02:00
echo "please perform as root, attempting to escalate privileges..."
exec sudo $(cat /proc/$$/cmdline | sed 's/\x00/ /g')
exit 1
fi
echo "testing git connection..."
2023-10-20 15:44:39 +02:00
if ! ssh -Tq git@git.ixvd.net &>/dev/null; then
2023-10-20 00:10:39 +02:00
echo "can't connect to git, please setup ssh"
exit 1
fi
## MAIN
set -e
2023-10-20 15:44:39 +02:00
if [ -d "servers/$HOSTNAME/setup.d" ]; then
echo "running server specific setup scripts..."
cd servers/$HOSTNAME
for s in setup.d/*; do
echo "running (servers/$HOSTNAME/)$s..."
2023-10-20 15:44:39 +02:00
sh $s
done
cd -
2023-10-20 15:44:39 +02:00
fi
for s in tools/server-setup.d/*; do
2023-10-20 00:10:39 +02:00
echo "running $s..."
sh $s
2023-10-20 15:44:39 +02:00
done