From 1e9b5ce21696f3f0aeb5d33ea2e0bd66744f4601 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Mon, 23 May 2022 19:58:32 +0000 Subject: [PATCH] use a filelist system for updates, remove configurable files from md5 Co-authored-by: sigonasr2 --- Java/scripts/filelist | 5 +++++ Java/scripts/md5 | 1 - scripts/filelist | 1 + utils/filelist | 5 +++++ utils/md5 | 3 +-- utils/search.sh | 47 ++++++++++++++++++++++++++++++++++++++----- 6 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 Java/scripts/filelist create mode 100644 scripts/filelist create mode 100644 utils/filelist diff --git a/Java/scripts/filelist b/Java/scripts/filelist new file mode 100644 index 0000000..0ddba96 --- /dev/null +++ b/Java/scripts/filelist @@ -0,0 +1,5 @@ +build.sh +clean.sh +commit.sh +jar.sh +version_info diff --git a/Java/scripts/md5 b/Java/scripts/md5 index 52b8c84..d4665a7 100644 --- a/Java/scripts/md5 +++ b/Java/scripts/md5 @@ -2,4 +2,3 @@ build.sh:55f0208b07ba384f45009d6f92fe88fe - clean.sh:96ce35f2d2dcb555421e00a6afda23ca - commit.sh:5e4448db9ad48e72ec3a1ff4f5763b41 - jar.sh:56f9b7c6dc8e85f28ffefe9ce82b1f07 - -version_info:e9b45e6c78d5fd34c3e1d398b5775a67 - diff --git a/scripts/filelist b/scripts/filelist new file mode 100644 index 0000000..47d6e3b --- /dev/null +++ b/scripts/filelist @@ -0,0 +1 @@ +commit.sh diff --git a/utils/filelist b/utils/filelist new file mode 100644 index 0000000..95ad5ff --- /dev/null +++ b/utils/filelist @@ -0,0 +1,5 @@ +.coauthors +define.sh +main.sh +search.sh +.updateDirectories diff --git a/utils/md5 b/utils/md5 index 36770fc..4f78427 100644 --- a/utils/md5 +++ b/utils/md5 @@ -1,5 +1,4 @@ -.coauthors:3785ad38663e5fc43e574914ad067294 - define.sh:74ea08fb12cab1053663f87007ddd29a - main.sh:909d8d53e71c87a4b5f0f5da9fa6baa2 - -search.sh:16d0a1eebbe03202019c7575d27ec3e1 - +search.sh:2a471ffc3daa12f96157e613873f589d - .updateDirectories:0ede00461e947494545e694040787b3f - diff --git a/utils/search.sh b/utils/search.sh index 0f3664b..73885b0 100644 --- a/utils/search.sh +++ b/utils/search.sh @@ -8,11 +8,14 @@ function search() { search $1$g/ else echo "$1$g is a file" - if [ $g != "md5" ]; then - SUM=$(md5sum < $1$g) - echo "$g:$SUM" >> $1md5 + if [ $g != "md5" ] && [ $g != "filelist" ]; then + if [ $g != ".coauthors" ] && [ $g != "version_info" ]; then + SUM=$(md5sum < $1$g) + echo "$g:$SUM" >> $1md5 + fi + echo "$g" >> $1filelist else - echo " md5 file, ignoring..." + echo " ignoring $g..." fi fi done @@ -35,7 +38,41 @@ function check() { IFS=':' read -ra split <<< $line g="${split[0]}" echo "LINE -- $g" - if [ "$g" != "md5" ]; then + if [ "$g" != "md5" ] && [ "$g" != "filelist" ]; then + if [ -f $1$g ]; + then + if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then + echo "++Redownload $1$g..." + if [ -f "$1$g" ]; then + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + else + echo "===Could not find directory, assuming regular scripts directory exists." + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $LANGUAGE/scripts/$g + fi + fi + else + echo "++==Downloading $1$g..." + curl -H 'Cache-Control: no-cache, no-store' "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1$g" --output $1$g + fi + fi + done < /tmp/out + fi + fi + if [ -f "$1/filelist" ]; + then + echo " filelist: https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist" + curl -H 'Cache-Control: no-cache, no-store' -s "https://raw.githubusercontent.com/sigonasr2/SigScript/main/$1filelist" --output /tmp/out + cmp -s $1/filelist /tmp/out + if [ "$?" -ne 0 ] + then + echo " Differences detected!" + cat /tmp/out + while IFS= read -r line + do + IFS=':' read -ra split <<< $line + g="${split[0]}" + echo "LINE -- $g" + if [ "$g" != "md5" ] && [ "$g" != "filelist" ]; then if [ -f $1$g ]; then if [ "$g" != ".coauthors" ] && [ "$g" != "version_info" ]; then