From 6d6d08c2a8ee0648bd0acd1a4fbfd9dcc165d15e Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 9 May 2023 01:50:16 +0200 Subject: [PATCH 1/3] Wait message --- run/install.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/run/install.sh b/run/install.sh index 7d42c51..043b733 100644 --- a/run/install.sh +++ b/run/install.sh @@ -1,12 +1,10 @@ #!/usr/bin/env bash set -Eeuo pipefail -# Display wait message on port 5000 HTML="Please wait while Virtual DSM is installing..." - -{ pkill -f server.sh || true; } 2>/dev/null + setTimeout(() => { document.location.reload(); }, 9999);" +# Display wait message on port 5000 /run/server.sh 80 "${HTML}" & /run/server.sh 5000 "${HTML}" & From 772a2e0b2506bfbba1a51d29dcb53987864ecaa3 Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 9 May 2023 01:54:13 +0200 Subject: [PATCH 2/3] Wait message --- run/install.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/run/install.sh b/run/install.sh index 043b733..e08ffbe 100644 --- a/run/install.sh +++ b/run/install.sh @@ -1,12 +1,9 @@ #!/usr/bin/env bash set -Eeuo pipefail -HTML="Please wait while Virtual DSM is installing..." - -# Display wait message on port 5000 -/run/server.sh 80 "${HTML}" & -/run/server.sh 5000 "${HTML}" & +# Display wait message +/run/server.sh 80 install & +/run/server.sh 5000 install & # Download the required files from the Synology website DL="https://global.synologydownload.com/download/DSM" From 20c46de69f0f1f043454fd4af37da6c07dbdd5ee Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 9 May 2023 02:01:38 +0200 Subject: [PATCH 3/3] Generate page --- run/server.sh | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/run/server.sh b/run/server.sh index 950c9a1..1b4431f 100644 --- a/run/server.sh +++ b/run/server.sh @@ -11,9 +11,29 @@ stop() { trap 'stop' EXIT SIGINT SIGTERM SIGHUP -if [[ "$2" == "/"* ]]; then +if [[ "$2" != "/"* ]]; then - if [[ "$2" == "/run/ip.sh" ]]; then + BODY="$2" + + if [[ "$BODY" == "install" ]]; then + + BODY="Please wait while Virtual DSM is installing..." + + fi + + HTML="VirtualDSM

$BODY

" + + echo -en "HTTP/1.1 200 OK\nContent-Length: ${#HTML}\nConnection: close\n\n$HTML" > "$TMP_FILE" + socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"cat ${TMP_FILE}" 2> /dev/null & wait $! + +else + + if [[ "$2" != "/run/ip.sh" ]]; then + + cp "$2" "$TMP_FILE" + + else { echo "#!/bin/bash" echo "INFO=\$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=10 2>/dev/null)" @@ -26,21 +46,9 @@ if [[ "$2" == "/"* ]]; then echo "echo -e \"\HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\"" } > "$TMP_FILE" - else - - cp "$2" "$TMP_FILE" - fi chmod +x "$TMP_FILE" socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"$TMP_FILE" 2> /dev/null & wait $! -else - - HTML="VirtualDSM

$2

" - - echo -en "HTTP/1.1 200 OK\nContent-Length: ${#HTML}\nConnection: close\n\n$HTML" > "$TMP_FILE" - socat TCP4-LISTEN:"${1:-5000}",reuseaddr,fork,crlf SYSTEM:"cat ${TMP_FILE}" 2> /dev/null & wait $! - fi