Skip to content

Commit

Permalink
Expose DECONZ_APPDATA_DIR as environment variable (#235)
Browse files Browse the repository at this point in the history
* Expose DECONZ_APPDATA_DIR as environment variable

* Replace /opt/deCONZ everywhere with
  • Loading branch information
phdelodder authored Feb 5, 2024
1 parent d7bbb29 commit 9f14c47
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Use these environment variables to change the default behaviour of the container
| `-e DECONZ_GID=1000` | Set the group id of deCONZ volume |
| `-e DECONZ_START_VERBOSE=0` | Set this option to 0 to disable verbose of start script, set to 1 to enable `set -x` logging |
| `-e DECONZ_BAUDRATE=115200` | Set the baudrate of the conbee stick, for conbee 3 this needs to be set |
| `-e DECONZ_APPDATA_DIR=/opt/deCONZ` | Set an alternative appdata directory incase volume bindings are not possible, eg Home Assistant OS #232 |

#### Docker-Compose

Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ ENV DEBIAN_FRONTEND=noninteractive \
DECONZ_UID=1000 \
DECONZ_GID=1000 \
DECONZ_START_VERBOSE=0 \
DECONZ_BAUDRATE=0
DECONZ_BAUDRATE=0 \
DECONZ_APPDATA_DIR=/opt/deCONZ

# Install deCONZ dependencies
RUN apt-get update && \
Expand Down
24 changes: 12 additions & 12 deletions docker/root/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo "[deconzcommunity/deconz] Web UI port: $DECONZ_WEB_PORT"
echo "[deconzcommunity/deconz] Websockets port: $DECONZ_WS_PORT"

DECONZ_OPTS="--auto-connect=1 \
--appdata=/opt/deCONZ \
--appdata=$DECONZ_APPDATA_DIR \
--dbg-info=$DEBUG_INFO \
--dbg-aps=$DEBUG_APS \
--dbg-zcl=$DEBUG_ZCL \
Expand Down Expand Up @@ -80,13 +80,13 @@ if [ "$DECONZ_VNC_MODE" != 0 ]; then
DECONZ_VNC_DISPLAY=:$(($DECONZ_VNC_PORT - 5900))
echo "[deconzcommunity/deconz] VNC port: $DECONZ_VNC_PORT"

if [ ! -e /opt/deCONZ/vnc ]; then
mkdir -p /opt/deCONZ/vnc
if [ ! -e $DECONZ_APPDATA_DIR/vnc ]; then
mkdir -p $DECONZ_APPDATA_DIR/vnc
fi

ln -sfT /opt/deCONZ/vnc /home/deconz/.vnc
ln -sfT $DECONZ_APPDATA_DIR/vnc /home/deconz/.vnc
chown deconz:deconz /home/deconz/.vnc
chown deconz:deconz /opt/deCONZ -R
chown deconz:deconz $DECONZ_APPDATA_DIR -R

echo "[deconzcommunity/deconz] VNC DISABLE PASSWORD: $DECONZ_VNC_DISABLE_PASSWORD"
if [ "$DECONZ_VNC_DISABLE_PASSWORD" = 0 ]; then
Expand All @@ -95,9 +95,9 @@ if [ "$DECONZ_VNC_MODE" != 0 ]; then
DECONZ_VNC_PASSWORD=$(cat $DECONZ_VNC_PASSWORD_FILE)
fi

echo "$DECONZ_VNC_PASSWORD" | tigervncpasswd -f >/opt/deCONZ/vnc/passwd
chmod 600 /opt/deCONZ/vnc/passwd
chown deconz:deconz /opt/deCONZ/vnc/passwd
echo "$DECONZ_VNC_PASSWORD" | tigervncpasswd -f >$DECONZ_APPDATA_DIR/vnc/passwd
chmod 600 $DECONZ_APPDATA_DIR/vnc/passwd
chown deconz:deconz $DECONZ_APPDATA_DIR/vnc/passwd
SECURITYTYPES="VncAuth,TLSVnc"
else
SECURITYTYPES="None,TLSNone"
Expand Down Expand Up @@ -136,7 +136,7 @@ if [ "$DECONZ_VNC_MODE" != 0 ]; then
fi

# Assert valid SSL certificate
NOVNC_CERT="/opt/deCONZ/vnc/novnc.pem"
NOVNC_CERT="$DECONZ_APPDATA_DIR/vnc/novnc.pem"
if [ -f "$NOVNC_CERT" ]; then
openssl x509 -noout -in "$NOVNC_CERT" -checkend 0 >/dev/null
if [ $? != 0 ]; then
Expand Down Expand Up @@ -168,9 +168,9 @@ if [ "$DECONZ_UPNP" != 1 ]; then
DECONZ_OPTS="$DECONZ_OPTS --upnp=0"
fi

mkdir -p /opt/deCONZ/otau
ln -sfT /opt/deCONZ/otau /home/deconz/otau
mkdir -p $DECONZ_APPDATA_DIR/otau
ln -sfT $DECONZ_APPDATA_DIR/otau /home/deconz/otau
chown deconz:deconz /home/deconz/otau
chown deconz:deconz /opt/deCONZ -R
chown deconz:deconz $DECONZ_APPDATA_DIR -R

exec gosu deconz /usr/bin/deCONZ $DECONZ_OPTS

0 comments on commit 9f14c47

Please sign in to comment.