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"