From 43b3db5c0c4c2f674ea55e5bef73c038c2b062fa Mon Sep 17 00:00:00 2001 From: Gabriel Adrian Samfira Date: Mon, 26 Feb 2024 17:41:04 +0000 Subject: [PATCH] Use user service Signed-off-by: Gabriel Adrian Samfira --- test/integration/config/garm.service | 2 +- test/integration/scripts/setup-garm.sh | 7 ++++--- test/integration/scripts/taredown_garm.sh | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/integration/config/garm.service b/test/integration/config/garm.service index 92b1d279..9015947e 100644 --- a/test/integration/config/garm.service +++ b/test/integration/config/garm.service @@ -10,4 +10,4 @@ Restart=always RestartSec=5s [Install] -WantedBy=multi-user.target +WantedBy=default.target diff --git a/test/integration/scripts/setup-garm.sh b/test/integration/scripts/setup-garm.sh index 6de7926d..7a3f68f4 100755 --- a/test/integration/scripts/setup-garm.sh +++ b/test/integration/scripts/setup-garm.sh @@ -89,11 +89,12 @@ sudo cp $CONFIG_DIR_PROV/* ${GARM_CONFIG_DIR}/test-provider sudo mv $BINARIES_DIR/* /usr/local/bin/ mkdir -p $HOME/.local/share/systemd/user/ -cat $CONFIG_DIR/garm.service| envsubst | tee $HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service > /dev/null +cat $CONFIG_DIR/garm.service| envsubst | sudo tee /lib/systemd/system/${GARM_SERVICE_NAME}@.service > /dev/null sudo chown -R $RUN_USER:$RUN_USER ${GARM_CONFIG_DIR} -systemctl --user daemon-reload -systemctl --user restart ${GARM_SERVICE_NAME} +sudo systemctl daemon-reload +sudo systemctl enable ${GARM_SERVICE_NAME}@${RUN_USER} +sudo systemctl restart ${GARM_SERVICE_NAME}@${RUN_USER} wait_open_port 127.0.0.1 ${GARM_PORT} echo "GARM is up and running" diff --git a/test/integration/scripts/taredown_garm.sh b/test/integration/scripts/taredown_garm.sh index 7f080324..c7b80a69 100755 --- a/test/integration/scripts/taredown_garm.sh +++ b/test/integration/scripts/taredown_garm.sh @@ -15,8 +15,10 @@ if [ -z $GARM_SERVICE_NAME ]; then fi if [ -f "$HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service" ];then - systemctl --user stop $GARM_SERVICE_NAME.service - rm $HOME/.local/share/systemd/user/${GARM_SERVICE_NAME}.service + sudo systemctl stop $GARM_SERVICE_NAME@${RUN_USER} + sudo systemctl disable $GARM_SERVICE_NAME@${RUN_USER} + sudo rm /lib/systemd/system/${GARM_SERVICE_NAME}@.service + sudo systemctl daemon-reload fi if [ -d "$GARM_CONFIG_DIR" ] && [ -f "$GARM_CONFIG_DIR/config.toml" ] && [ -f "$GARM_CONFIG_DIR/garm-provider-lxd.toml" ];then