Add initial version of Angry IP Scanner (#71)

This commit is contained in:
Max Winterstein
2022-03-27 23:09:16 +02:00
committed by GitHub
parent 1428a90c40
commit a18be66736
17 changed files with 265 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S1
# ==============================================================================
# Take down the S6 supervision tree based on service exit code
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,51 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start angryipscanner service
# ==============================================================================
TMP_FOLDER=$(mktemp -d)
# VNC is not enabled as a separate service, as it cannot handle multiple
# session when running in the foreground.
VNC_PORT="$(bashio::addon.port 5900)"
ARCH="$(bashio::info.arch)"
# Fix tigervnc for 32 bits ARM
if [[ "armhf armv7" = *"${ARCH}"* ]]; then
export LD_PRELOAD=/lib/arm-linux-gnueabihf/libgcc_s.so.1
fi
# Fix tigervnc for 64 bits ARM
if [[ "aarch64" = "${ARCH}" ]]; then
export LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1
fi
# Run it only on localhost if not expose
if bashio::var.has_value "${VNC_PORT}"; then
bashio::log.warning "Your direct VNC access is not protected!"
LOCAL_ONLY=no
else
LOCAL_ONLY=yes
fi
export XDG_RUNTIME_DIR="${TMP_FOLDER}"
export DISPLAY=":0"
bashio::log.info "Starting VNC server (local/${LOCAL_ONLY})..."
tigervncserver \
-name "Home Assistant - Angry IP Scanner" \
-geometry 1920x1080 \
-depth 16 \
-localhost ${LOCAL_ONLY} \
-SecurityTypes None \
--I-KNOW-THIS-IS-INSECURE \
"${DISPLAY}" \
&> /dev/null
# Wait for VNC server to start before continuing
bashio::log.info "Angry IP Scanner waiting for VNC to start"
bashio::net.wait_for 5900
# Start Angry IP Scanner
bashio::log.info "Starting the Angry IP Scanner gateway..."
exec ipscan

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S1
# ==============================================================================
# Take down the S6 supervision tree based on service exit code
# ==============================================================================
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,7 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start NGINX service
# ==============================================================================
bashio::log.info "Starting Nginx..."
exec nginx

View File

@@ -0,0 +1,11 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Start Websockify
# ==============================================================================
# Wait until vnc is up and running
bashio::log.info "Websockify waiting for VNC to start"
bashio::net.wait_for 5900
bashio::log.info "Starting websockify..."
exec websockify -v --web /usr/share/novnc/ 127.0.0.1:5901 127.0.0.1:5900