From 5e4dc753ff3b283e819780d23fdf7ea9cf9a917e Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Sun, 8 Jun 2025 08:31:04 +0100 Subject: [PATCH] refactor install.sh --- install.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 10956d8..a5f26bf 100755 --- a/install.sh +++ b/install.sh @@ -1,12 +1,22 @@ #!/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 +clone_repository () +{ + 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 +} + +add_cron_services () +{ + 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 + EOF +} + +set -eux +clone_repository +add_cron_services ./restart.sh