mirror of
https://github.com/mtan93/homeassistant-addons.git
synced 2026-04-23 06:13:10 +01:00
Add initial version of Angry IP Scanner (#71)
This commit is contained in:
@@ -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
|
||||
51
angry-ip-scanner/rootfs/etc/services.d/angryipscanner/run
Normal file
51
angry-ip-scanner/rootfs/etc/services.d/angryipscanner/run
Normal 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
|
||||
8
angry-ip-scanner/rootfs/etc/services.d/nginx/finish
Normal file
8
angry-ip-scanner/rootfs/etc/services.d/nginx/finish
Normal 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
|
||||
7
angry-ip-scanner/rootfs/etc/services.d/nginx/run
Normal file
7
angry-ip-scanner/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Start NGINX service
|
||||
# ==============================================================================
|
||||
|
||||
bashio::log.info "Starting Nginx..."
|
||||
exec nginx
|
||||
11
angry-ip-scanner/rootfs/etc/services.d/websockify/run
Normal file
11
angry-ip-scanner/rootfs/etc/services.d/websockify/run
Normal 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
|
||||
Reference in New Issue
Block a user