2021-12-21 13:48:28 +01:00
#!/bin/bash
### Note: Currently not complete, needs some features before useable for production
2022-01-04 15:26:34 +01:00
if ! ./prerequisites.sh; then
echo "Prerequisites failed, exiting"
exiting
fi
2021-12-21 13:48:28 +01:00
source site.conf
echo "Installing bridgehead"
2022-01-08 09:46:45 +01:00
if [ -z " $BRIDGEHEAD_PATH " ] ; then
2022-01-04 15:26:34 +01:00
echo " BRIDGEHEAD_PATH= ${ PWD } " >> /etc/environment
echo "Please reboot the system to properly set the enviroment"
exit
fi
2022-01-10 14:29:12 +01:00
_systemd_path = /etc/systemd/system/
2021-12-21 13:48:28 +01:00
echo "Installing bridgehead\@.service in systemd ..."
2022-01-10 14:29:12 +01:00
sudo cp convenience/bridgehead\@ .service $_systemd_path
2021-12-21 13:48:28 +01:00
echo "Installing bridgehead\@.update.service in systemd ..."
2022-01-10 14:29:12 +01:00
sudo cp convenience/bridgehead-update\@ .service $_systemd_path
sudo cp convenience/bridgehead-update\@ .timer $_systemd_path
2021-12-21 13:48:28 +01:00
2021-12-23 14:54:35 +01:00
echo "Loading the bridgehead definitions in systemd"
2021-12-21 13:48:28 +01:00
sudo systemctl daemon-reload
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 "
2021-12-23 14:54:35 +01:00
exit
2021-12-21 13:48:28 +01:00
fi
sudo systemctl is-active --quiet bridgehead@" ${ project } "
if [ ! $? -eq 0 ] ; then
echo " Starting bridgehead@ ${ project } service ... "
sudo systemctl start bridgehead@" ${ project } "
echo " Enabling autostart of bridgehead@ ${ project } .service "
sudo systemctl enable bridgehead@" ${ project } "
echo " Enabling nightly updates for bridgehead@ ${ project } .service ... "
sudo systemctl enable --now bridgehead-update@" ${ project } " .timer
fi
# Switch back to execution directory;
cd -
# TODO: Configuration of the different modules