From 996e8dbd1bb7e6b5c5497916e259592c66bb121b Mon Sep 17 00:00:00 2001 From: Torben Brenner Date: Mon, 26 Sep 2022 10:54:46 +0200 Subject: [PATCH] refactor: Remove unused Bridgehead Scripts --- install-bridgehead.sh | 32 -------------------------------- start-bridgehead.sh | 18 ------------------ stop-bridgehead.sh | 8 -------- uninstall-bridgehead.sh | 10 ---------- update-bridgehead.sh | 38 -------------------------------------- 5 files changed, 106 deletions(-) delete mode 100755 install-bridgehead.sh delete mode 100755 start-bridgehead.sh delete mode 100755 stop-bridgehead.sh delete mode 100755 uninstall-bridgehead.sh delete mode 100755 update-bridgehead.sh diff --git a/install-bridgehead.sh b/install-bridgehead.sh deleted file mode 100755 index 389354a..0000000 --- a/install-bridgehead.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -### Note: Currently not complete, needs some features before useable for production - -source lib/functions.sh - -exitIfNotRoot - -if ! ./lib/prerequisites.sh; then - log "Prerequisites failed, exiting" - exit 1 -fi -source site.conf - -./lib/generate.sh - -echo -e "\nInstalling systemd units ..." -cp -v \ - lib/systemd/bridgehead\@.service \ - lib/systemd/bridgehead-update\@.service \ - lib/systemd/bridgehead-update\@.timer \ - /etc/systemd/system/ - -systemctl daemon-reload - -if ! systemctl is-active --quiet bridgehead@"${project}"; then - echo "Enabling autostart of bridgehead@${project}.service" - systemctl enable bridgehead@"${project}" - echo "Enabling nightly updates for bridgehead@${project}.service ..." - systemctl enable --now bridgehead-update@"${project}".timer -fi - -echo -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${project}.service\nor by rebooting your machine." \ No newline at end of file diff --git a/start-bridgehead.sh b/start-bridgehead.sh deleted file mode 100755 index b658c93..0000000 --- a/start-bridgehead.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -### Note: Currently not complete, needs some features before useable for production - -source lib/functions.sh - -if ! lib/prerequisites.sh; then - log "Prerequisites failed, exiting" - exit -fi -source site.conf - -./lib/generate.sh - -log "Starting bridgehead" - -docker-compose -f <(docker run --rm --volume ${pwd}/${project}/:/tmp/workdir/ samply/templer /tmp/workdir/docker-compose.yml TEST="TEST_0 TEST_1") config - -log "The bridgehead should be in online in a few seconds" diff --git a/stop-bridgehead.sh b/stop-bridgehead.sh deleted file mode 100755 index 6da0228..0000000 --- a/stop-bridgehead.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -e - -source lib/functions.sh -source site.conf - -log "Stopping bridgehead" - -docker-compose -f ${project}/docker-compose.yml --env-file site-config/${project}.env down diff --git a/uninstall-bridgehead.sh b/uninstall-bridgehead.sh deleted file mode 100755 index 877ca01..0000000 --- a/uninstall-bridgehead.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -e - -source site.conf -source lib/functions.sh - -echo "Stopping systemd services and removing bridgehead ..." - -systemctl disable --now bridgehead@${project}.service bridgehead-update@${project}.timer bridgehead-update@${project}.service - -rm -v /etc/systemd/system/{bridgehead\@.service,bridgehead-update\@.timer,bridgehead-update\@.service} diff --git a/update-bridgehead.sh b/update-bridgehead.sh deleted file mode 100755 index 330d303..0000000 --- a/update-bridgehead.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -service="bridgehead" - -source lib/functions.sh - -if ! lib/prerequisites.sh; then - log "Prerequisites failed, exiting" - exit -fi - -log "INFO" "Checking for updates of $service" -# check prerequisites - -# check if updates are available -old_git_hash="$(git rev-parse --verify HEAD)" -git fetch 2>&1 -git pull 2>&1 -new_git_hash="$(git rev-parse --verify HEAD)" -git_updated="false" -if [ "$old_git_hash" != "$new_git_hash" ]; then - log "INFO" "Pulled new changes from origin" - git_updated="true" -fi -docker_updated="false" -for image in $(docker ps --filter "name=$service" --format {{.Image}}); do - log "INFO" "Checking for Updates of Image: $image" - if docker pull $image | grep "Downloaded newer image"; then - log "INFO" "$image updated." - docker_updated="true" - fi -done -if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then - log "INFO" "Due to previous updates now restarting $service@$1" - systemctl restart "$service@$1.service" - ./lib/generate.sh -fi -log "INFO" "checking updates finished" -exit 0