From 926c83cbd746f61493c3f513647d9382d5cf9a4c Mon Sep 17 00:00:00 2001 From: Mohammed Goder Date: Sun, 24 Mar 2024 00:27:45 -0500 Subject: [PATCH] Update grs.sh --- grs.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/grs.sh b/grs.sh index b48e118..acb379c 100644 --- a/grs.sh +++ b/grs.sh @@ -29,13 +29,25 @@ for repository in *; do echo "$log" >> "$logPath" if [ "$gitOutput" == "" ]; then - log=$(echo [$(date +"%Y-%m-%d %H:%M:%S")] Unable to check for updates to \"$repository\") - echo "$log" - echo "$log" >> "$logPath" - echo >> "$logPath" + cd "repositories/$repository" + gitURL=$(git config --get remote.origin.url) + cd .. + rm -rf "$repository" + gitOutput=$(git clone --recursive $gitURL) + cd .. + if [ "$gitOutput" == "" ]; then + log=$(echo [$(date +"%Y-%m-%d %H:%M:%S")] Unable to check for updates to \"$repository\") + echo "$log" + echo "$log" >> "$logPath" + echo >> "$logPath" - cd repositories - continue; + cp -rf "snapshots/$repository" repositories + + cd repositories + continue; + fi + + echo "$gitOutput" fi echo "$gitOutput" >> "$logPath"