forked from openhab/openhabian
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes openhab#632 Signed-off-by: Ethan Dye <[email protected]>
- Loading branch information
Showing
21 changed files
with
504 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
## start: Starts a minimalistic web server that shows the status of the | ||
## openHABian installation. | ||
## reinsure_running: Checks if webserver is running. | ||
## inst_done: Create finish message and link to http://${HOSTNAME:-openhab}:8080. | ||
## cleanup: Stops the webserver and removes all no longer needed files. | ||
|
||
port="80" | ||
isWebRunning="$(ps -ef | pgrep python3)" | ||
|
||
if [[ "$1" = "start" ]]; then | ||
mkdir -p /tmp/webserver | ||
ln -sf /boot/first-boot.log /tmp/webserver/first-boot.txt | ||
cp /opt/openhabian/includes/install-log.html /tmp/webserver/index.html | ||
(cd /tmp/webserver || exit 1; python3 -m http.server "$port" &> /dev/null &) | ||
fi | ||
|
||
if [[ $1 == "reinsure_running" ]]; then | ||
if [[ -z $isWebRunning ]]; then | ||
(cd /tmp/webserver || exit 1; python3 -m http.server "$port" &> /dev/null &) | ||
fi | ||
fi | ||
|
||
if [[ $1 == "inst_done" ]]; then | ||
sed 's|%HOSTNAME|'"${HOSTNAME:-openhab}"'|g' /opt/openhabian/includes/install-complete.html > /tmp/webserver/index.html | ||
fi | ||
|
||
if [[ $1 == "cleanup" ]]; then | ||
if [[ -n $isWebRunning ]]; then | ||
kill "$isWebRunning" &> /dev/null | ||
fi | ||
rm -rf /tmp/webserver &> /dev/null | ||
rm -f /boot/webserver.bash &> /dev/null | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.