Add -I include parameter to samba.sh (#143)
This commit is contained in:
parent
e65c9b765f
commit
2b1b0c2527
@ -63,6 +63,9 @@ OR set local storage:
|
||||
required arg: "<workgroup>"
|
||||
<workgroup> for samba
|
||||
-W Allow access wide symbolic links
|
||||
-I Add an include option at the end of the smb.conf
|
||||
required arg: "<include file path>"
|
||||
<include file path> in the container, e.g. a bind mount
|
||||
|
||||
The 'command' (if provided and valid) will be run instead of samba
|
||||
|
||||
@ -82,6 +85,7 @@ ENVIRONMENT VARIABLES
|
||||
* `WORKGROUP` - As above, set workgroup
|
||||
* `USERID` - Set the UID for the samba server
|
||||
* `GROUPID` - Set the GID for the samba server
|
||||
* `INCLUDE` - As above, add a smb.conf include
|
||||
|
||||
**NOTE**: if you enable nmbd (via `-n` or the `NMBD` environment variable), you
|
||||
will also want to expose port 137 and 138 with `-p 137:137/udp -p 138:138/udp`.
|
||||
|
15
samba.sh
15
samba.sh
@ -45,6 +45,14 @@ global() { local key="${1%%=*}" value="${1#*=}" file=/etc/samba/smb.conf
|
||||
fi
|
||||
}
|
||||
|
||||
### include: add a samba config file include
|
||||
# Arguments:
|
||||
# file) file to import
|
||||
include() { local includefile="$1" file=/etc/samba/smb.conf
|
||||
sed -i "\\|include = $includefile|d" "$file"
|
||||
echo "include = $includefile" >> "$file"
|
||||
}
|
||||
|
||||
### import: import a smbpasswd file
|
||||
# Arguments:
|
||||
# file) file to import
|
||||
@ -193,6 +201,9 @@ Options (fields in '[]' are optional, '<>' are required):
|
||||
required arg: \"<workgroup>\"
|
||||
<workgroup> for samba
|
||||
-W Allow access wide symbolic links
|
||||
-I Add an include option at the end of the smb.conf
|
||||
required arg: \"<include file path>\"
|
||||
<include file path> in the container, e.g. a bind mount
|
||||
|
||||
The 'command' (if provided and valid) will be run instead of samba
|
||||
" >&2
|
||||
@ -202,7 +213,7 @@ The 'command' (if provided and valid) will be run instead of samba
|
||||
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser
|
||||
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o users
|
||||
|
||||
while getopts ":hc:g:i:nprs:Su:Ww:" opt; do
|
||||
while getopts ":hc:g:i:nprs:Su:Ww:I:" opt; do
|
||||
case "$opt" in
|
||||
h) usage ;;
|
||||
c) charmap "$OPTARG" ;;
|
||||
@ -216,6 +227,7 @@ while getopts ":hc:g:i:nprs:Su:Ww:" opt; do
|
||||
u) eval user $(sed 's/^/"/; s/$/"/; s/;/" "/g' <<< $OPTARG) ;;
|
||||
w) workgroup "$OPTARG" ;;
|
||||
W) widelinks ;;
|
||||
I) include "$OPTARG" ;;
|
||||
"?") echo "Unknown option: -$OPTARG"; usage 1 ;;
|
||||
":") echo "No argument value for option: -$OPTARG"; usage 2 ;;
|
||||
esac
|
||||
@ -232,6 +244,7 @@ shift $(( OPTIND - 1 ))
|
||||
[[ "${USER:-""}" ]] && eval user $(sed 's/^/"/; s/$/"/; s/;/" "/g' <<< $USER)
|
||||
[[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP"
|
||||
[[ "${WIDELINKS:-""}" ]] && widelinks
|
||||
[[ "${INCLUDE:-""}" ]] && include "$INCLUDE"
|
||||
|
||||
if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then
|
||||
exec "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user