From 647fce5eeb31384017d4fc59424f9d7a8b6d4323 Mon Sep 17 00:00:00 2001 From: David Personette Date: Sat, 6 Feb 2016 18:37:31 -0500 Subject: [PATCH] Dockerfile/samba.sh/README.md add an option to start nmbd --- Dockerfile | 2 +- README.md | 2 ++ samba.sh | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf98de3..5fa4fe1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,6 @@ COPY samba.sh /usr/bin/ VOLUME ["/etc/samba"] -EXPOSE 139 445 +EXPOSE 137 139 445 ENTRYPOINT ["samba.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 62d53cf..fe151ad 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ OR set local storage: -h This help -i "" Import smbpassword required arg: "" - full file path in container + -n Start the 'nmbd' daemon to advertise the shares -s "[;browsable;readonly;guest;users]" Configure a share required arg: ";;" is how it's called for clients @@ -53,6 +54,7 @@ OR set local storage: ENVIRONMENT VARIABLES (only available with `docker run`) + * `NMBD` - As above, enable nmbd * `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT` ## Examples diff --git a/samba.sh b/samba.sh index 0d82535..5363256 100755 --- a/samba.sh +++ b/samba.sh @@ -92,6 +92,7 @@ Options (fields in '[]' are optional, '<>' are required): -h This help -i \"\" Import smbpassword required arg: \"\" - full file path in container + -n Start the 'nmbd' daemon to advertise the shares -s \"[;browsable;readonly;guest;users]\" Configure a share required arg: \";;\" is how it's called for clients @@ -114,10 +115,11 @@ The 'command' (if provided and valid) will be run instead of samba exit $RC } -while getopts ":hi:t:u:s:" opt; do +while getopts ":hi:nt:u:s:" opt; do case "$opt" in h) usage ;; i) import "$OPTARG" ;; + n) NMBD="true" ;; s) eval share $(sed 's/^\|$/"/g; s/;/" "/g' <<< $OPTARG) ;; u) eval user $(sed 's/;/ /g' <<< $OPTARG) ;; t) timezone "$OPTARG" ;; @@ -137,5 +139,6 @@ elif [[ $# -ge 1 ]]; then elif ps -ef | egrep -v grep | grep -q smbd; then echo "Service already running, please restart container to apply changes" else + [[ $NMBD ]] && ionice -c 3 nmbd -DS exec ionice -c 3 smbd -FS fi \ No newline at end of file