diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..c8bc83d --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -eux +cd ${LIB_DIR:-/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 >> ${CRONTABS_DIR:-/etc/cron.d}/joeacnet +@reboot ${LIB_DIR:-/lib}/joeac.net/restart.sh +10 * * * * ${LIB_DIR:-/lib}/joeac.net/update_and_restart.sh +EOF +sudo systemctl restart ${CRON_SERVICE:-crond.service} diff --git a/restart.sh b/restart.sh new file mode 100755 index 0000000..35dfd29 --- /dev/null +++ b/restart.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -eux + +cd ${JOEACNET_DIR:-/lib/joeac.net} +podman-compose build +podman-compose down +podman-compose up -d diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..2de6306 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -eux +sudo rm ${CRONTABS_DIR:-/etc/cron.d}/joeacnet +sudo rm -rd ${LIB_DIR:-/lib}/joeac.net +sudo systemctl restart ${CRON_SERVICE:-crond.service} diff --git a/update_and_restart.sh b/update_and_restart.sh new file mode 100755 index 0000000..2790679 --- /dev/null +++ b/update_and_restart.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eux + +cd ${LIB_DIR:-/lib}/joeac.net +sudo git fetch origin main +if [[ -z "$(git diff origin/main main)" ]] +then + sudo git pull + ./restart.sh +fi