Include download updates capability

main
sigonasr2, Sig, Sigo 3 years ago
parent 56b64c6804
commit 2a36025c72
  1. 4
      utils/define.sh
  2. 4
      utils/md5
  3. 23
      utils/search.sh

@ -6,9 +6,11 @@ function define() {
eval "$1"='$value' eval "$1"='$value'
} }
if [[ $(pwd) == *"SigScript" ]]; then if [[ $(pwd) != *"SigScript" ]]; then
source utils/search.sh source utils/search.sh
find . -type f -name md5 -delete
#Check for hashes #Check for hashes
FILES=$(ls -d */) FILES=$(ls -d */)
for f in $FILES for f in $FILES

@ -1,3 +1,3 @@
a137a2465efff1c5c1ac2e59ccddb20b - 5e7a21b710475f173906085c01bd2205 -
548480c89fb8d6668a83ee9e534eb2dd - 548480c89fb8d6668a83ee9e534eb2dd -
96a6812a735b48efe890a65c344bdf33 - 779fe40a9c39138048d635e6ad0b3c20 -

@ -8,7 +8,11 @@ function search() {
search $1$g/ search $1$g/
else else
echo "$1$g is a file" 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 fi
done done
} }
@ -16,11 +20,17 @@ function search() {
function check() { function check() {
echo "Check $1" echo "Check $1"
FILES2=$(ls $1) FILES2=$(ls $1)
MD5_EXISTS=false REDOWNLOAD=false
if [ -f "$1/md5" ]; if [ -f "$1/md5" ];
then then
echo " md5: $MD5_EXISTS - 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 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 fi
for g in $FILES2 for g in $FILES2
do do
@ -28,6 +38,11 @@ function check() {
then then
echo "$1$g is a directory" echo "$1$g is a directory"
check $1$g/ 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 fi
done done
} }
Loading…
Cancel
Save