bridgehead/install-bridgehead.sh

38 lines
1007 B
Bash
Raw Normal View History

2021-12-21 13:48:28 +01:00
#!/bin/bash
### Note: Currently not complete, needs some features before useable for production
2022-01-10 15:31:07 +01:00
source lib/functions.sh
exitIfNotRoot
2022-01-10 14:45:52 +01:00
if ! ./lib/prerequisites.sh; then
echo "Prerequisites failed, exiting"
2022-01-10 15:11:57 +01:00
exit 1
fi
2021-12-21 13:48:28 +01:00
source site.conf
2022-01-10 14:29:12 +01:00
_systemd_path=/etc/systemd/system/
2021-12-21 13:48:28 +01:00
2022-01-10 16:31:48 +01:00
echo -e "\nInstalling systemd units ..."
2022-01-10 15:31:07 +01:00
cp -v \
2022-01-10 16:42:13 +01:00
lib/systemd/bridgehead\@.service \
lib/systemd/bridgehead-update\@.service \
lib/systemd/bridgehead-update\@.timer \
2022-01-10 16:31:48 +01:00
$_systemd_path
2021-12-21 13:48:28 +01:00
2022-01-10 15:31:07 +01:00
systemctl daemon-reload
2021-12-21 13:48:28 +01:00
2022-01-10 16:31:48 +01:00
echo
2021-12-21 13:48:28 +01:00
2022-01-10 16:31:48 +01:00
if ! systemctl is-active --quiet bridgehead@"${project}"; then
2021-12-21 13:48:28 +01:00
echo "Enabling autostart of bridgehead@${project}.service"
2022-01-10 15:31:07 +01:00
systemctl enable bridgehead@"${project}"
2021-12-21 13:48:28 +01:00
echo "Enabling nightly updates for bridgehead@${project}.service ..."
2022-01-10 15:31:07 +01:00
systemctl enable --now bridgehead-update@"${project}".timer
2022-01-10 16:31:48 +01:00
fi
echo -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${project}.service\nor by rebooting your machine."
2021-12-21 13:48:28 +01:00
# TODO: Configuration of the different modules