samba.sh fix #60 make recycle optional

This commit is contained in:
David Personette 2017-05-25 10:45:14 -04:00
parent 4ec382d583
commit 8d3cb605fe

View File

@ -56,6 +56,14 @@ perms() { local i file=/etc/samba/smb.conf
done done
} }
### recycle: disable recycle bin
# Arguments:
# none)
# Return: result
recycle() { local file=/etc/samba/smb.conf
sed -i '/recycle/d; /vfs/d' $file
}
### share: Add share ### share: Add share
# Arguments: # Arguments:
# share) share name # share) share name
@ -141,6 +149,7 @@ Options (fields in '[]' are optional, '<>' are required):
required arg: \"<path>\" - full file path in container required arg: \"<path>\" - full file path in container
-n Start the 'nmbd' daemon to advertise the shares -n Start the 'nmbd' daemon to advertise the shares
-p Set ownership and permissions on the shares -p Set ownership and permissions on the shares
-r Disable recycle bin for shares
-s \"<name;/path>[;browse;readonly;guest;users;admins;wl]\" Config a share -s \"<name;/path>[;browse;readonly;guest;users;admins;wl]\" Config a share
required arg: \"<name>;<comment>;</path>\" required arg: \"<name>;<comment>;</path>\"
<name> is how it's called for clients <name> is how it's called for clients
@ -172,13 +181,14 @@ The 'command' (if provided and valid) will be run instead of samba
[[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser [[ "${USERID:-""}" =~ ^[0-9]+$ ]] && usermod -u $USERID -o smbuser
[[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o users [[ "${GROUPID:-""}" =~ ^[0-9]+$ ]] && groupmod -g $GROUPID -o users
while getopts ":hc:i:nps:t:u:w:" opt; do while getopts ":hc:i:nprs:t:u:w:" opt; do
case "$opt" in case "$opt" in
h) usage ;; h) usage ;;
c) charmap "$OPTARG" ;; c) charmap "$OPTARG" ;;
i) import "$OPTARG" ;; i) import "$OPTARG" ;;
n) NMBD="true" ;; n) NMBD="true" ;;
p) PERMISSIONS="true" ;; p) PERMISSIONS="true" ;;
r) recycle ;;
s) eval share $(sed 's/^\|$/"/g; s/;/" "/g' <<< $OPTARG) ;; s) eval share $(sed 's/^\|$/"/g; s/;/" "/g' <<< $OPTARG) ;;
t) timezone "$OPTARG" ;; t) timezone "$OPTARG" ;;
u) eval user $(sed 's|;| |g' <<< $OPTARG) ;; u) eval user $(sed 's|;| |g' <<< $OPTARG) ;;
@ -190,9 +200,10 @@ done
shift $(( OPTIND - 1 )) shift $(( OPTIND - 1 ))
[[ "${CHARMAP:-""}" ]] && charmap "$CHARMAP" [[ "${CHARMAP:-""}" ]] && charmap "$CHARMAP"
[[ "${PERMISSIONS:-""}" ]] && perms
[[ "${RECYCLE:-""}" ]] && recycle
[[ "${TZ:-""}" ]] && timezone "$TZ" [[ "${TZ:-""}" ]] && timezone "$TZ"
[[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP" [[ "${WORKGROUP:-""}" ]] && workgroup "$WORKGROUP"
[[ "${PERMISSIONS:-""}" ]] && perms
if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then if [[ $# -ge 1 && -x $(which $1 2>&-) ]]; then
exec "$@" exec "$@"