diff --git a/utils/define.sh b/utils/define.sh index b1bce85..eba9bcd 100755 --- a/utils/define.sh +++ b/utils/define.sh @@ -6,9 +6,11 @@ function define() { eval "$1"='$value' } -if [[ $(pwd) == *"SigScript" ]]; then +if [[ $(pwd) != *"SigScript" ]]; then source utils/search.sh + find . -type f -name md5 -delete + #Check for hashes FILES=$(ls -d */) for f in $FILES diff --git a/utils/md5 b/utils/md5 index 9667d68..d3d6b59 100644 --- a/utils/md5 +++ b/utils/md5 @@ -1,3 +1,3 @@ -a137a2465efff1c5c1ac2e59ccddb20b - +5e7a21b710475f173906085c01bd2205 - 548480c89fb8d6668a83ee9e534eb2dd - -96a6812a735b48efe890a65c344bdf33 - +779fe40a9c39138048d635e6ad0b3c20 - diff --git a/utils/search.sh b/utils/search.sh index 448ef9f..7dcde7e 100644 --- a/utils/search.sh +++ b/utils/search.sh @@ -8,7 +8,11 @@ function search() { search $1$g/ else echo "$1$g is a file" - md5sum < $1$g >> $1md5 + if [ $g != "md5" ]; then + md5sum < $1$g >> $1md5 + else + echo " md5 file, ignoring..." + fi fi done } @@ -16,11 +20,17 @@ function search() { function check() { echo "Check $1" FILES2=$(ls $1) - MD5_EXISTS=false + REDOWNLOAD=false if [ -f "$1/md5" ]; then - echo " md5: $MD5_EXISTS - https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" - curl -s https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5 + echo " md5: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5" + curl -s https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1md5 --output /tmp/out + DIFF=$(diff $1/md5 /tmp/out) + if [ "$DIFF" != "" ] + then + echo " Differences detected!" + REDOWNLOAD=true + fi fi for g in $FILES2 do @@ -28,6 +38,11 @@ function check() { then echo "$1$g is a directory" check $1$g/ + else + if [ "$REDOWNLOAD" = "true" ]; then + echo "++Redownload $1$g..." + curl https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g --output $1$g + fi fi done } \ No newline at end of file