samba.sh/README.md support additional environment variables

This commit is contained in:
David Personette 2019-07-06 16:27:43 -04:00
parent 26d20a96a3
commit 54374d29a0
2 changed files with 15 additions and 6 deletions

View File

@ -72,15 +72,15 @@ OR set local storage:
ENVIRONMENT VARIABLES ENVIRONMENT VARIABLES
* `CHARMAP` - As above, configure character mapping * `CHARMAP` - As above, configure character mapping
* `GLOBAL` - As above, configure a global option * `GLOBAL` - As above, configure a global option (See NOTE3 below)
* `IMPORT` - As above, import a smbpassword file * `IMPORT` - As above, import a smbpassword file
* `NMBD` - As above, enable nmbd * `NMBD` - As above, enable nmbd
* `PERMISSIONS` - As above, set file permissions on all shares * `PERMISSIONS` - As above, set file permissions on all shares
* `RECYCLE` - As above, disable recycle bin * `RECYCLE` - As above, disable recycle bin
* `SHARE` - As above, setup a share * `SHARE` - As above, setup a share (See NOTE3 below)
* `SMB` - As above, disable SMB2 minimum version * `SMB` - As above, disable SMB2 minimum version
* `TZ` - Set a timezone, IE `EST5EDT` * `TZ` - Set a timezone, IE `EST5EDT`
* `USER` - As above, setup a user * `USER` - As above, setup a user (See NOTE3 below)
* `WIDELINKS` - As above, allow access wide symbolic links * `WIDELINKS` - As above, allow access wide symbolic links
* `WORKGROUP` - As above, set workgroup * `WORKGROUP` - As above, set workgroup
* `USERID` - Set the UID for the samba server * `USERID` - Set the UID for the samba server
@ -93,6 +93,9 @@ will also want to expose port 137 and 138 with `-p 137:137/udp -p 138:138/udp`.
**NOTE2**: there are reports that `-n` and `NMBD` only work if you have the **NOTE2**: there are reports that `-n` and `NMBD` only work if you have the
container configured to use the hosts network stack. container configured to use the hosts network stack.
**NOTE3**: optionally supports additional variables starting with the same name,
IE `SHARE` also will work for `SHARE2`, `SHARE3`... `SHAREx`, etc.
## Examples ## Examples
Any of the commands can be run at creation with `docker run` or later with Any of the commands can be run at creation with `docker run` or later with

View File

@ -235,13 +235,19 @@ done
shift $(( OPTIND - 1 )) shift $(( OPTIND - 1 ))
[[ "${CHARMAP:-""}" ]] && charmap "$CHARMAP" [[ "${CHARMAP:-""}" ]] && charmap "$CHARMAP"
[[ "${GLOBAL:-""}" ]] && global "$GLOBAL" while read i; do
global "$i"
done <$(env | awk '/^GLOBAL/ {sub (/^[^=]*=/, "", $0); print}')
[[ "${IMPORT:-""}" ]] && import "$IMPORT" [[ "${IMPORT:-""}" ]] && import "$IMPORT"
[[ "${PERMISSIONS:-""}" ]] && perms [[ "${PERMISSIONS:-""}" ]] && perms
[[ "${RECYCLE:-""}" ]] && recycle [[ "${RECYCLE:-""}" ]] && recycle
[[ "${SHARE:-""}" ]] && eval share $(sed 's/^/"/; s/$/"/; s/;/" "/g' <<< $SHARE) while read i; do
eval share $(sed 's/^/"/; s/$/"/; s/;/" "/g' <<< $i)
done <$(env | awk '/^SHARE/ {sub (/^[^=]*=/, "", $0); print}')
[[ "${SMB:-""}" ]] && smb [[ "${SMB:-""}" ]] && smb
[[ "${USER:-""}" ]] && eval user $(sed 's/^/"/; s/$/"/; s/;/" "/g' <<< $USER) while read i; do
eval user $(sed 's/^/"/; s/$/"/; s/;/" "/g' <<< $i)
done <$(env | awk '/^USER/ {sub (/^[^=]*=/, "", $0); print}')
[[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP" [[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP"
[[ "${WIDELINKS:-""}" ]] && widelinks [[ "${WIDELINKS:-""}" ]] && widelinks
[[ "${INCLUDE:-""}" ]] && include "$INCLUDE" [[ "${INCLUDE:-""}" ]] && include "$INCLUDE"