Loading src/install.sh +17 −1 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ RDC="$STORAGE/dsm.rd" if [ ! -f "$RDC" ]; then MSG="Downloading installer..." PRG="Downloading installer ([P])..." info "Install: $MSG" && html "$MSG" RD="$TMP/rd.gz" Loading @@ -112,7 +113,11 @@ if [ ! -f "$RDC" ]; then VERIFY="b4215a4b213ff5154db0488f92c87864" LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" rm -f "$RD" /run/progress.sh "$RD" "$PRG" & { curl -r "$POS" -sfk -S -o "$RD" "$LOC"; rc=$?; } || : fKill "progress.sh" (( rc != 0 )) && error "Failed to download $LOC, reason: $rc" && exit 60 SUM=$(md5sum "$RD" | cut -f 1 -d " ") Loading @@ -123,7 +128,11 @@ if [ ! -f "$RDC" ]; then rm "$RD" rm -f "$PAT" html "$MSG" /run/progress.sh "$PAT" "$PRG" & { wget "$LOC" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : fKill "progress.sh" (( rc != 0 )) && error "Failed to download $LOC , reason: $rc" && exit 60 tar --extract --file="$PAT" --directory="$(dirname "$RD")"/. "$(basename "$RD")" Loading Loading @@ -175,7 +184,10 @@ fi rm -rf "$TMP" && mkdir -p "$TMP" info "Install: Downloading $BASE.pat..." html "Install: Downloading DSM from Synology..." MSG="Downloading DSM..." PRG="Downloading DSM ([P])..." html "$MSG" PAT="/$BASE.pat" rm -f "$PAT" Loading @@ -186,7 +198,11 @@ if [[ "$URL" == "file://"* ]]; then else /run/progress.sh "$PAT" "$PRG" & { wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : fKill "progress.sh" (( rc != 0 )) && error "Failed to download $URL , reason: $rc" && exit 69 fi Loading src/progress.sh 0 → 100644 +32 −0 Original line number Diff line number Diff line #!/usr/bin/env bash set -Eeuo pipefail escape () { local s s=${1//&/\&} s=${s//</\<} s=${s//>/\>} s=${s//'"'/\"} printf -- %s "$s" return 0 } file="$1" body=$(escape "$2") info="/run/shm/msg.html" if [[ "$body" == *"..." ]]; then body="<p class=\"loading\">${body/.../}</p>" fi while true do if [ -f "$file" ]; then bytes=$(du -sb "$file" | cut -f1) if (( bytes > 1000 )); then size=$(echo "$bytes" | numfmt --to=iec --suffix=B | sed -r 's/([A-Z])/ \1/') echo "${body//(\[P\])/($size)}"> "$info" fi fi sleep 1 done Loading
src/install.sh +17 −1 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ RDC="$STORAGE/dsm.rd" if [ ! -f "$RDC" ]; then MSG="Downloading installer..." PRG="Downloading installer ([P])..." info "Install: $MSG" && html "$MSG" RD="$TMP/rd.gz" Loading @@ -112,7 +113,11 @@ if [ ! -f "$RDC" ]; then VERIFY="b4215a4b213ff5154db0488f92c87864" LOC="$DL/release/7.0.1/42218/DSM_VirtualDSM_42218.pat" rm -f "$RD" /run/progress.sh "$RD" "$PRG" & { curl -r "$POS" -sfk -S -o "$RD" "$LOC"; rc=$?; } || : fKill "progress.sh" (( rc != 0 )) && error "Failed to download $LOC, reason: $rc" && exit 60 SUM=$(md5sum "$RD" | cut -f 1 -d " ") Loading @@ -123,7 +128,11 @@ if [ ! -f "$RDC" ]; then rm "$RD" rm -f "$PAT" html "$MSG" /run/progress.sh "$PAT" "$PRG" & { wget "$LOC" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : fKill "progress.sh" (( rc != 0 )) && error "Failed to download $LOC , reason: $rc" && exit 60 tar --extract --file="$PAT" --directory="$(dirname "$RD")"/. "$(basename "$RD")" Loading Loading @@ -175,7 +184,10 @@ fi rm -rf "$TMP" && mkdir -p "$TMP" info "Install: Downloading $BASE.pat..." html "Install: Downloading DSM from Synology..." MSG="Downloading DSM..." PRG="Downloading DSM ([P])..." html "$MSG" PAT="/$BASE.pat" rm -f "$PAT" Loading @@ -186,7 +198,11 @@ if [[ "$URL" == "file://"* ]]; then else /run/progress.sh "$PAT" "$PRG" & { wget "$URL" -O "$PAT" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : fKill "progress.sh" (( rc != 0 )) && error "Failed to download $URL , reason: $rc" && exit 69 fi Loading
src/progress.sh 0 → 100644 +32 −0 Original line number Diff line number Diff line #!/usr/bin/env bash set -Eeuo pipefail escape () { local s s=${1//&/\&} s=${s//</\<} s=${s//>/\>} s=${s//'"'/\"} printf -- %s "$s" return 0 } file="$1" body=$(escape "$2") info="/run/shm/msg.html" if [[ "$body" == *"..." ]]; then body="<p class=\"loading\">${body/.../}</p>" fi while true do if [ -f "$file" ]; then bytes=$(du -sb "$file" | cut -f1) if (( bytes > 1000 )); then size=$(echo "$bytes" | numfmt --to=iec --suffix=B | sed -r 's/([A-Z])/ \1/') echo "${body//(\[P\])/($size)}"> "$info" fi fi sleep 1 done