From 4ace370a40cb0c542d73ea3961d2995443f370f8 Mon Sep 17 00:00:00 2001 From: shimikano Date: Wed, 19 Feb 2020 17:22:24 +0100 Subject: [PATCH] Introduce WSDD_ARGS to directly pass wsdd arguments. --- README.md | 8 +++++--- docker-cmd.sh | 33 +++++++++++++++++---------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 0695b92..100cb4d 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,13 @@ Docker image for wsdd.py. wsdd implements a Web Service Discovery host daemon. This enables (Samba) hosts, like your local NAS device or Linux server, to be found by Web Service Discovery Clients like Windows. ## Supported environment variables -HOSTNAME: Samba Netbios name to report. +`HOSTNAME`: Samba Netbios name to report. -WORKGROUP: Workgroup name +`WORKGROUP`: Workgroup name -DOMAIN: Report being a member of an AD DOMAIN. Disables WORKGROUP if set. +`DOMAIN`: Report being a member of an AD DOMAIN. Disables `WORKGROUP` if set. + +Alternatively, you can pass all desired wsdd arguments in the environment variable `WSDD_ARGS`. In this case, the arguments are passed as-is and all other environment variables are ignored. ## Running container ### From command line diff --git a/docker-cmd.sh b/docker-cmd.sh index 7e56356..6a8cacb 100755 --- a/docker-cmd.sh +++ b/docker-cmd.sh @@ -2,22 +2,23 @@ args=( ) -if [ ! -z "${HOSTNAME}" ]; then - args+=( "-n $HOSTNAME ") -else - echo "HOSTNAME environment variable must be set." - exit 1 +if [ ! -z "${WSDD_ARGS}" ]; then + args=${WSDD_ARGS} +else + if [ ! -z "${HOSTNAME}" ]; then + args+=( "-n $HOSTNAME ") + else + echo "HOSTNAME environment variable must be set." + exit 1 + fi + + if [ ! -z "${WORKGROUP}" ]; then + args+=( "-w $WORKGROUP " ) + fi + + if [ ! -z "${DOMAIN}" ]; then + args+=( "-d $DOMAIN " ) + fi fi -if [ ! -z "${WORKGROUP}" ]; then - args+=( "-w $WORKGROUP " ) -fi - -if [ ! -z "${DOMAIN}" ]; then - args+=( "-d $DOMAIN " ) -fi - - - exec python wsdd.py ${args} -