From 6989ac396a8fc813e3b6903db540b3cfafbc83ad Mon Sep 17 00:00:00 2001 From: Botspot Date: Thu, 9 Sep 2021 15:20:41 -0500 Subject: [PATCH] manage: Forcibly re-download repo if github repository is over 3 months out of date --- manage | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/manage b/manage index 78ae10a..3c7bf62 100755 --- a/manage +++ b/manage @@ -35,6 +35,16 @@ source "${DIRECTORY}/api" || error "failed to source ${DIRECTORY}/api" EOF ) &>/dev/null +#Forcibly re-download repo if github repository is over 3 months out of date +{ +if [ $(date +%s) -gt $(($(cd "$DIRECTORY"; git show -s --format=%ct) + 7776000)) ];then + echo "Your Pi-Apps github repository is somehow 3 months out-of-date. Downloading fresh version of pi-apps..." 1>&2 + cd $HOME + rm -rf ~/pi-apps-forced-update + git clone "$(cat "${DIRECTORY}/etc/git_url")" pi-apps-forced-update && mv -f "${DIRECTORY}/data" ~/pi-apps-forced-update/data && rm -rf "$DIRECTORY" && mv -f ~/pi-apps-forced-update "${DIRECTORY}/data" +fi +} + mkdir -p "${DIRECTORY}/data/status" "${DIRECTORY}/data/update-status" "${DIRECTORY}/logs" #remove week-old logfiles