Skip to content

Commit

Permalink
tigervncserver hostname workaround (#211)
Browse files Browse the repository at this point in the history
* Add .editorconfig for sh files

* Lint download-deconz.sh

* Align Dockerfile indentation to 4 spaces

* Lint start.sh and try a tigervncserver workaround for Synology

* Adding debug commands for troubleshooting Synology

* Clean up debug output

* Use hostname --fqdn for hostname health check

* User tigervncserver -version to determine hostname health

* Update log message for hostname fix
  • Loading branch information
senilio authored Oct 18, 2023
1 parent ea8c6b4 commit b8f6ba4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.sh]
indent_style = space
indent_size = 2
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ ENV DEBIAN_FRONTEND=noninteractive \
# Install deCONZ dependencies
RUN apt-get update && \
apt-get install -y \
gosu \
gosu \
curl \
kmod \
libatomic1 \
libatomic1 \
libcap2-bin \
libqt5core5a \
libqt5gui5 \
Expand All @@ -48,7 +48,7 @@ RUN apt-get update && \
libqt5sql5 \
libqt5websockets5 \
libqt5widgets5 \
libqt5qml5 \
libqt5qml5 \
libssl1.1 \
lsof \
sqlite3 \
Expand Down
10 changes: 3 additions & 7 deletions docker/download-deconz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ DECONZ_VERSION=$1
CHANNEL=$2
PLATFORM=$3

if echo "${PLATFORM}" | grep -qE "arm64";
then
if echo "${PLATFORM}" | grep -qE "arm64"; then
URL="http://deconz.dresden-elektronik.de/debian/${CHANNEL}/deconz_${DECONZ_VERSION}-debian-buster-${CHANNEL}_arm64.deb"
fi
if echo "${PLATFORM}" | grep -qE "amd64";
then
if echo "${PLATFORM}" | grep -qE "amd64"; then
URL="http://deconz.dresden-elektronik.de/ubuntu/${CHANNEL}/deconz-${DECONZ_VERSION}-qt5.deb"
fi
if echo "${PLATFORM}" | grep -qE "v7";
then
if echo "${PLATFORM}" | grep -qE "v7"; then
URL="http://deconz.dresden-elektronik.de/raspbian/${CHANNEL}/deconz-${DECONZ_VERSION}-qt5.deb"
fi

curl -vv "${URL}" -o /deconz${DEV}.deb

40 changes: 24 additions & 16 deletions docker/root/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DECONZ_OPTS="--auto-connect=1 \

echo "[deconzcommunity/deconz] Using options" $DECONZ_OPTS


echo "[deconzcommunity/deconz] Modifying user and group ID"
if [ "$DECONZ_UID" != 1000 ]; then
DECONZ_UID=${DECONZ_UID:-1000}
Expand All @@ -40,18 +39,18 @@ echo "[deconzcommunity/deconz] Checking device group ID"
if [ "$DECONZ_DEVICE" != 0 ]; then
DEVICE=$DECONZ_DEVICE
else
if [ -e /dev/ttyUSB0 ]; then
DEVICE=/dev/ttyUSB0
fi
if [ -e /dev/ttyACM0 ]; then
DEVICE=/dev/ttyACM0
fi
if [ -e /dev/ttyAMA0 ]; then
DEVICE=/dev/ttyAMA0
fi
if [ -e /dev/ttyS0 ]; then
DEVICE=/dev/ttyS0
fi
if [ -e /dev/ttyUSB0 ]; then
DEVICE=/dev/ttyUSB0
fi
if [ -e /dev/ttyACM0 ]; then
DEVICE=/dev/ttyACM0
fi
if [ -e /dev/ttyAMA0 ]; then
DEVICE=/dev/ttyAMA0
fi
if [ -e /dev/ttyS0 ]; then
DEVICE=/dev/ttyS0
fi
fi

DIALOUTGROUPID=$(stat --printf='%g' $DEVICE)
Expand Down Expand Up @@ -88,17 +87,26 @@ if [ "$DECONZ_VNC_MODE" != 0 ]; then
if [ "$DECONZ_VNC_DISABLE_PASSWORD" = 0 ]; then
# Set VNC password
if [ "$DECONZ_VNC_PASSWORD_FILE" != 0 ] && [ -f "$DECONZ_VNC_PASSWORD_FILE" ]; then
DECONZ_VNC_PASSWORD=$(cat $DECONZ_VNC_PASSWORD_FILE)
DECONZ_VNC_PASSWORD=$(cat $DECONZ_VNC_PASSWORD_FILE)
fi

echo "$DECONZ_VNC_PASSWORD" | tigervncpasswd -f > /opt/deCONZ/vnc/passwd
echo "$DECONZ_VNC_PASSWORD" | tigervncpasswd -f >/opt/deCONZ/vnc/passwd
chmod 600 /opt/deCONZ/vnc/passwd
chown deconz:deconz /opt/deCONZ/vnc/passwd
SECURITYTYPES="VncAuth,TLSVnc"
else
SECURITYTYPES="None,TLSNone"
fi

# Check if hostname is valid, otherwise apply fix
tigervncserver -version >/dev/null 2>&1
if [ $? != 0 ]; then
echo "[deconzcommunity/deconz] Applying hostname fix to avoid tigervncserver crash"
echo '127.0.0.1 deconz' >>/etc/hosts
echo 'deconz' >/etc/hostname
hostname deconz
fi

# Cleanup previous VNC session data
gosu deconz tigervncserver -kill ':*'
gosu deconz tigervncserver -list ':*' -cleanstale
Expand All @@ -125,7 +133,7 @@ if [ "$DECONZ_VNC_MODE" != 0 ]; then
# Assert valid SSL certificate
NOVNC_CERT="/opt/deCONZ/vnc/novnc.pem"
if [ -f "$NOVNC_CERT" ]; then
openssl x509 -noout -in "$NOVNC_CERT" -checkend 0 > /dev/null
openssl x509 -noout -in "$NOVNC_CERT" -checkend 0 >/dev/null
if [ $? != 0 ]; then
echo "[deconzcommunity/deconz] The noVNC SSL certificate has expired; generating a new certificate now."
rm "$NOVNC_CERT"
Expand Down

0 comments on commit b8f6ba4

Please sign in to comment.