From 80e5a30c3f6d903ff9a437add6f3332a99e8b448 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Fri, 6 Jun 2025 15:00:35 +0100 Subject: [PATCH] install/uninstall/update/restart scripts --- install.sh | 13 +++++++++++++ restart.sh | 9 +++++++++ uninstall.sh | 6 ++++++ update_and_restart.sh | 12 ++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 install.sh create mode 100644 restart.sh create mode 100644 uninstall.sh create mode 100644 update_and_restart.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..51edcea --- /dev/null +++ b/install.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eux +cd /lib +sudo git clone https://git.joeac.net/joeac/joeac.net.git +cd joeac.net +sudo chmod +x uninstall.sh update_and_restart.sh restart.sh +sudo echo << EOF >> /etc/cron.d/joeacnet +@reboot /lib/joeac.net/restart.sh +10 * * * * /lib/joeac.net/update_and_restart.sh +EOF +sudo systemctl restart crond.service + diff --git a/restart.sh b/restart.sh new file mode 100644 index 0000000..f4ca564 --- /dev/null +++ b/restart.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -eux + +cd /lib/joeac.net +podman-compose build +podman-compose down +podman-compose up -d + diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..2583eaf --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +sudo rm /etc/cron.d/joeacnet +sudo rm -rd /lib/joeac.net +sudo systemctl restart crond.service + diff --git a/update_and_restart.sh b/update_and_restart.sh new file mode 100644 index 0000000..4d83802 --- /dev/null +++ b/update_and_restart.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -eux + +cd /lib/joeac.net +sudo git fetch origin main +if [[ -z "$(git diff origin/main main)" ]] +then + sudo git pull + ./restart.sh +fi +