bridgehead/lib/setup-bridgehead-units.sh

33 lines
960 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
if ! ./lib/prerequisites.sh; then
log "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
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 \
/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
echo "Enabling autostart of bridgehead@${project}.service"
2022-01-10 15:31:07 +01:00
systemctl enable bridgehead@"${project}"
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