Dockerfile/samba.sh/README.md add an option to start nmbd

This commit is contained in:
David Personette 2016-02-06 18:37:31 -05:00
parent 2d0b0f3893
commit 647fce5eeb
3 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,6 @@ COPY samba.sh /usr/bin/
VOLUME ["/etc/samba"]
EXPOSE 139 445
EXPOSE 137 139 445
ENTRYPOINT ["samba.sh"]

View File

@ -32,6 +32,7 @@ OR set local storage:
-h This help
-i "<path>" Import smbpassword
required arg: "<path>" - full file path in container
-n Start the 'nmbd' daemon to advertise the shares
-s "<name;/path>[;browsable;readonly;guest;users]" Configure a share
required arg: "<name>;<comment>;</path>"
<name> 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

View File

@ -92,6 +92,7 @@ Options (fields in '[]' are optional, '<>' are required):
-h This help
-i \"<path>\" Import smbpassword
required arg: \"<path>\" - full file path in container
-n Start the 'nmbd' daemon to advertise the shares
-s \"<name;/path>[;browsable;readonly;guest;users]\" Configure a share
required arg: \"<name>;<comment>;</path>\"
<name> 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