From e1518fbf86b30bb7c23763c7ace120fa9b1827b7 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 17 May 2022 19:31:01 +0000 Subject: [PATCH] Move redownload logic to accomplish before recursing directories --- utils/md5 | 2 +- utils/search.sh | 37 +++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/utils/md5 b/utils/md5 index 08004ff..4314b24 100644 --- a/utils/md5 +++ b/utils/md5 @@ -1,3 +1,3 @@ 5e7a21b710475f173906085c01bd2205 - 548480c89fb8d6668a83ee9e534eb2dd - -03061acd7af07b0d1295509234ff99b7 - +d51f3526991522d890ca2ebd3f735b75 - diff --git a/utils/search.sh b/utils/search.sh index 668df87..0028a6f 100644 --- a/utils/search.sh +++ b/utils/search.sh @@ -20,7 +20,6 @@ function search() { function check() { echo "Check $1" FILES2=$(ls $1) - REDOWNLOAD=false if [ -f "$1/md5" ]; then echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" @@ -29,7 +28,25 @@ function check() { if [ "$DIFF" != "" ] then echo " Differences detected!" - REDOWNLOAD=true + for g in $FILES2 + do + if [ -f $1$g ]; + then + echo "++Redownload $1$g..." + if [ -f "$1$g" ]; then + #Read the 2nd line and see if it has a special directory. + CHECKLINE=$(sed -n '2{p;q;}' $1$g) + if [ "${CHECKLINE:0:1}" = "#" ]; then + curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/${CHECKLINE:1}/$1$g --output $1$g + else + curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g + fi + else + echo "===Could not find directory, assuming regular scripts directory exists." + curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output scripts/$g + fi + fi + done fi fi for g in $FILES2 @@ -38,22 +55,6 @@ function check() { then echo "$1$g is a directory" check $1$g/ - else - if [ "$REDOWNLOAD" = "true" ]; then - echo "++Redownload $1$g..." - if [ -f "$1$g" ]; then - #Read the 2nd line and see if it has a special directory. - CHECKLINE=$(sed -n '2{p;q;}' $1$g) - if [ "${CHECKLINE:0:1}" = "#" ]; then - curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/${CHECKLINE:1}/$1$g --output $1$g - else - curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g - fi - else - echo "===Could not find directory, assuming regular scripts directory exists." - curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output scripts/$g - fi - fi fi done } \ No newline at end of file