Unverified Commit b1621f51 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Webserver updates

parents 3dc8f243 bac6f943
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
set -eu

# Display wait message on port 5000
/run/server.sh 5000 > /dev/null &
/run/server.sh 5000 "Please wait while Virtual DSM is installing..." > /dev/null &

DL="https://global.synologydownload.com/download/DSM"

+3 −0
Original line number Diff line number Diff line
@@ -179,6 +179,9 @@ else
  # Configuration for DHCP IP
  configureDHCP

  # Display the received IP on port 5000
  /run/server.sh 5000 "The location of DSM is http://${DHCP_IP}:5000" > /dev/null &

fi

NET_OPTS="${NET_OPTS} -device virtio-net-pci,romfile=,netdev=hostnet0,mac=${VM_NET_MAC},id=net0"
+17 −4
Original line number Diff line number Diff line
#!/usr/bin/env bash
set -eu
trap exit SIGINT SIGTERM

HTML="<HTML><BODY><H1><CENTER>Please wait while Virtual DSM is installing...</CENTER></H1></BODY></HTML>"
RESPONSE="HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n$HTML\r\n"
# Close any previous instances
script_name=${BASH_SOURCE[0]}

while { echo -en "$RESPONSE"; } | nc -lN "${1:-8080}"; do
  echo "================================================"
for pid in $(pidof -x $script_name); do
  if [ $pid != $$ ]; then
    kill -15 $pid 2> /dev/null
    wait $pid 2> /dev/null
  fi
done

# Serve the page
HTML="<HTML><HEAD><STYLE>body {  color: white; background-color: #00BFFF; } </STYLE></HEAD><BODY><BR><BR><H1><CENTER>$2</CENTER></H1></BODY></HTML>"
LENGTH="${#HTML}"

RESPONSE="HTTP/1.1 200 OK\nContent-Length: ${LENGTH}\nConnection: close\n\n$HTML\n\n"

while true; do
  echo -en "$RESPONSE" | nc -N -lp "${1:-8080}";
done