bridgehead/install-bridgehead.sh

49 lines
1.4 KiB
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
echo "Installing bridgehead"
2022-01-10 14:29:12 +01:00
_systemd_path=/etc/systemd/system/
2021-12-21 13:48:28 +01:00
2022-01-10 15:31:07 +01:00
echo "Installing systemd units ..."
cp -v \
convenience/bridgehead\@.service \
convenience/bridgehead-update\@.service \
convenience/bridgehead-update\@.timer \
$_systemd_path
2021-12-21 13:48:28 +01:00
echo "Loading the bridgehead definitions in systemd"
2022-01-10 15:31:07 +01:00
systemctl daemon-reload
2021-12-21 13:48:28 +01:00
echo "Starting Project ${project} "
if [ ! -f "/etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf" ]; then
echo "Can't find local configuration file for bridgehead@${project} service. Please ensure that the file /etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf exists"
exit
2021-12-21 13:48:28 +01:00
fi
2022-01-10 15:31:07 +01:00
systemctl is-active --quiet bridgehead@"${project}"
2021-12-21 13:48:28 +01:00
if [ ! $? -eq 0 ]; then
echo "Starting bridgehead@${project} service ..."
2022-01-10 15:31:07 +01:00
systemctl start bridgehead@"${project}"
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
2021-12-21 13:48:28 +01:00
fi
# Switch back to execution directory;
cd -
# TODO: Configuration of the different modules