38 lines
708 B
Bash
Executable file
38 lines
708 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# setup server
|
|
|
|
## PREFLIGHT
|
|
|
|
ORIGIN_PWD="$PWD"
|
|
|
|
if ! [ "$(id -u)" = "0" ]; then
|
|
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..."
|
|
if ! ssh -Tq git@git.ixvd.net &>/dev/null; then
|
|
echo "can't connect to git, please setup ssh"
|
|
exit 1
|
|
fi
|
|
|
|
## MAIN
|
|
|
|
set -e
|
|
|
|
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..."
|
|
sh $s
|
|
done
|
|
cd -
|
|
fi
|
|
|
|
for s in tools/server-setup.d/*; do
|
|
echo "running $s..."
|
|
sh $s
|
|
done
|