diff --git a/run/server.sh b/run/server.sh index a47eeb4..9c96951 100644 --- a/run/server.sh +++ b/run/server.sh @@ -14,8 +14,8 @@ trap 'stop' EXIT SIGINT SIGTERM SIGHUP html() { local h="VirtualDSM" - h="${h} " + h="${h} " h="${h}

$1

" echo "$h" @@ -26,7 +26,8 @@ if [[ "$2" != "/"* ]]; then BODY="$2" if [[ "$BODY" == "install" ]]; then - BODY="Please wait while Virtual DSM is installing..." + BODY="Please wait while Virtual DSM is being installed..." + BODY="$BODY" fi HTML=$(html "$BODY") @@ -44,14 +45,15 @@ else BODY="The location of DSM is http://\${IP}:\${PORT}" + WAIT="Please wait while discovering IP..." HTML=$(html "xxx") { echo "#!/bin/bash" - echo "INFO=\$(curl -s -m 5 -S http://127.0.0.1:2210/read?command=10 2>/dev/null)" + echo "INFO=\$(curl -s -m 2 -S http://127.0.0.1:2210/read?command=10 2>/dev/null)" echo "rest=\${INFO#*http_port}; rest=\${rest#*:}; rest=\${rest%%,*}; PORT=\${rest%%\\\"*}" echo "rest=\${INFO#*eth0}; rest=\${rest#*ip}; rest=\${rest#*:}; rest=\${rest#*\\\"}; IP=\${rest%%\\\"*}" - echo "HTML=\"$HTML\"; BODY=\"$BODY\"; HTML=\${HTML/xxx/\$BODY}" + echo "HTML=\"$HTML\"; [ -z \"\${IP}\" ] && BODY=\"$BODY\" || BODY=\"$WAIT\"; HTML=\${HTML/xxx/\$BODY}" echo "printf '%b' \"HTTP/1.1 200 OK\\nContent-Length: \${#HTML}\\nConnection: close\\n\\n\$HTML\"" } > "$TMP_FILE"