From 80e151659a8a0ef0421bdf4fb74ed1d89850fc89 Mon Sep 17 00:00:00 2001 From: WXbet Date: Sat, 30 Dec 2023 11:59:34 +0100 Subject: [PATCH] Support for multiple patch urls --- support/functions/_patch | 29 +++++++++++++++++++++-------- support/patches/no.patch | 0 support/patches/patch.url.template | 9 +++++++++ 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 support/patches/no.patch create mode 100644 support/patches/patch.url.template diff --git a/support/functions/_patch b/support/functions/_patch index 376e4cb8..6528b1aa 100644 --- a/support/functions/_patch +++ b/support/functions/_patch @@ -9,16 +9,29 @@ _get_patch(){ printf $C ologo printf $WH; - [ -f $PATCHNAME ] && printf "$Y $PATCHNAME $txt_found\n $txt_delete $P$PATCHNAME" && rm -f $PATCHNAME - printf $W"\n $txt_load $PATCHNAME" - - if [[ `wget -S --spider $PATCHURL 2>&1 | grep 'HTTP/1.1 200 OK'` ]] + if [ -f patch.url.template -a ! -f patch.url ] then - wget -q -O$PATCHNAME $PATCHURL - [ -f $PATCHNAME ] && printf $G" ok$W\n\n" - else - printf $R"\n\n $PATCHURL\n\n >> $txt_not_found <<$W\n\n" + printf "${Y}To load custom patches,\nyou have to rename the file ${P}patch.url.template${Y} to ${G}patch.url${Y}\nand adjust accordingly.${W}\n\n" + exit fi + [ ! -z "$PATCHCOUNT" ] && loop="$(eval echo "{1..$PATCHCOUNT}")" + for c in '' $loop; do + DP="PATCHNAME$c"; PATCHNAME=${!DP} + DU="PATCHURL$c"; PATCHURL=${!DU} + if [ ! -z "$PATCHNAME" -a ! -z "$PATCHURL" ] + then + [ -f $PATCHNAME ] && printf "$Y $PATCHNAME $txt_found\n $txt_delete $P$PATCHNAME" && rm -f $PATCHNAME + printf $W"\n $txt_load $PATCHNAME" + + if [[ `wget -S --spider $PATCHURL 2>&1 | grep 'HTTP/1.1 200 OK'` ]] + then + wget -q -O$PATCHNAME $PATCHURL + [ -f $PATCHNAME ] && printf $G" ok$W\n\n" + else + printf $R"\n\n $PATCHURL\n\n >> $txt_not_found <<$W\n\n" + fi + fi + done } _streamboard_patch(){ diff --git a/support/patches/no.patch b/support/patches/no.patch new file mode 100644 index 00000000..e69de29b diff --git a/support/patches/patch.url.template b/support/patches/patch.url.template new file mode 100644 index 00000000..60eb00d3 --- /dev/null +++ b/support/patches/patch.url.template @@ -0,0 +1,9 @@ +PATCHURL="https://raw.githubusercontent.com/gorgone/s3_releases/master/support/patches/no.patch" +PATCHNAME="no.patch" +#PATCHCOUNT=3 +#PATCHURL1="https://raw.githubusercontent.com/gorgone/s3_releases/master/support/patches/no.patch" +#PATCHNAME1="no1.patch" +#PATCHURL2="https://raw.githubusercontent.com/gorgone/s3_releases/master/support/patches/no.patch" +#PATCHNAME2="no2.patch" +#PATCHURL3="https://raw.githubusercontent.com/gorgone/s3_releases/master/support/patches/no.patch" +#PATCHNAME3="no3.patch"