From c264c3a3e78910d706a25b5c50e5421ba30326b2 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 16 May 2023 21:47:35 +0200 Subject: [PATCH 1/2] Fallback for installer --- run/install.sh | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/run/install.sh b/run/install.sh index df9eaa6..2a27c81 100644 --- a/run/install.sh +++ b/run/install.sh @@ -15,6 +15,13 @@ if [ -z "$URL" ]; then fi +# Check if running with interactive TTY or redirected to docker log +if [ -t 1 ]; then + PROGRESS="--progress=bar:noscroll" +else + PROGRESS="--progress=dot:giga" +fi + BASE=$(basename "$URL" .pat) rm -f "$STORAGE"/"$BASE".pat @@ -32,16 +39,33 @@ rm -rf "$TMP" && mkdir -p "$TMP" if [ ! -f "${RDC}" ]; then RD="$TMP/rd.gz" - info "Install: Downloading installer..." + info "Install: Downloading installer..." LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" { curl -r 65627648-71021836 -sfk -o "$RD" "$LOC"; rc=$?; } || : (( rc != 0 )) && error "Failed to download $LOC, reason: $rc" && exit 60 SUM=$(md5sum "$RD" | cut -f 1 -d " ") + VERIFY="ab399db750f88ac7aa88f608f2b8651c" + + if [ "$SUM" != "$VERIFY" ]; then + + PAT="/dsm.pat" + rm "$RD" + rm -f "$PAT" + + { wget "$LOC" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : + (( rc != 0 )) && error "Failed to download $LOC, reason: $rc" && exit 60 + + tar --extract --file="$PAT" --directory="$TMP/." rd.gz + rm "$PAT" + + SUM=$(md5sum "$RD" | cut -f 1 -d " ") + + if [ "$SUM" != "$VERIFY" ]; then + error "Invalid download location (checksum $SUM)" && exit 61 + fi - if [ "$SUM" != "ab399db750f88ac7aa88f608f2b8651c" ]; then - error "Invalid download location (checksum $SUM)" && exit 61 fi cp "$RD" "$RDC" @@ -68,13 +92,6 @@ info "Install: Downloading $(basename "$URL")..." PAT="/$BASE.pat" rm -f "$PAT" -# Check if running with interactive TTY or redirected to docker log -if [ -t 1 ]; then - PROGRESS="--progress=bar:noscroll" -else - PROGRESS="--progress=dot:giga" -fi - { wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : (( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 69 From a57bb7fb7ef869c0c870c436ff72c7e562efb272 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 16 May 2023 22:14:43 +0200 Subject: [PATCH 2/2] Fallback --- run/install.sh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/run/install.sh b/run/install.sh index 2a27c81..3661743 100644 --- a/run/install.sh +++ b/run/install.sh @@ -15,7 +15,7 @@ if [ -z "$URL" ]; then fi -# Check if running with interactive TTY or redirected to docker log +# Check if output is to interactive TTY if [ -t 1 ]; then PROGRESS="--progress=bar:noscroll" else @@ -42,15 +42,15 @@ if [ ! -f "${RDC}" ]; then info "Install: Downloading installer..." LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" - { curl -r 65627648-71021836 -sfk -o "$RD" "$LOC"; rc=$?; } || : + { curl -r 65627648-71021835 -sfk -o "$RD" "$LOC"; rc=$?; } || : (( rc != 0 )) && error "Failed to download $LOC, reason: $rc" && exit 60 SUM=$(md5sum "$RD" | cut -f 1 -d " ") - VERIFY="ab399db750f88ac7aa88f608f2b8651c" + VERIFY="b4215a4b213ff5154db0488f92c87864" if [ "$SUM" != "$VERIFY" ]; then - PAT="/dsm.pat" + PAT="/install.pat" rm "$RD" rm -f "$PAT" @@ -60,12 +60,6 @@ if [ ! -f "${RDC}" ]; then tar --extract --file="$PAT" --directory="$TMP/." rd.gz rm "$PAT" - SUM=$(md5sum "$RD" | cut -f 1 -d " ") - - if [ "$SUM" != "$VERIFY" ]; then - error "Invalid download location (checksum $SUM)" && exit 61 - fi - fi cp "$RD" "$RDC"