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
|
2022-01-11 14:40:16 +01:00
|
|
|
log "Prerequisites failed, exiting"
|
2022-01-10 15:11:57 +01:00
|
|
|
exit 1
|
2022-01-04 15:26:34 +01:00
|
|
|
fi
|
2021-12-21 13:48:28 +01:00
|
|
|
source site.conf
|
|
|
|
|
2022-01-11 14:40:16 +01:00
|
|
|
log -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-11 14:40:16 +01:00
|
|
|
/etc/systemd/system/
|
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
|
2022-01-11 14:40:16 +01:00
|
|
|
log "Enabling autostart of bridgehead@${project}.service"
|
2022-01-10 15:31:07 +01:00
|
|
|
systemctl enable bridgehead@"${project}"
|
2022-01-11 14:40:16 +01:00
|
|
|
log "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
|
|
|
|
|
2022-01-11 14:40:16 +01:00
|
|
|
log -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
|