| 1 | #!/bin/sh |
| 2 | # |
| 3 | # smbaddshare |
| 4 | # |
| 5 | # Copyright (C) 2015 Christof Schmitt |
| 6 | # |
| 7 | # Example script that can be used with the 'add share command' config |
| 8 | # option. This is mainly intended for use in the Samba selftest suite, |
| 9 | # please review and adapt it before using elsewhere. |
| 10 | # |
| 11 | |
| 12 | CONF="$1" |
| 13 | SHARENAME="$2" |
| 14 | SHAREPATH="$3" |
| 15 | COMMENT="$4" |
| 16 | MAX_CONN="$5" |
| 17 | |
| 18 | NETCONF="$BINDIR/net --configfile=$CONF conf" |
| 19 | |
| 20 | $NETCONF addshare "$SHARENAME" "$SHAREPATH" writeable=no guest_ok=no "$COMMENT" |
| 21 | RC=$? |
| 22 | if [ $RC -ne 0 ]; then |
| 23 | echo Failure during addshare: rc=$RC |
| 24 | exit $RC |
| 25 | fi |
| 26 | |
| 27 | $NETCONF setparm "$SHARENAME" 'max connections' "$MAX_CONN" |
| 28 | RC=$? |
| 29 | if [ $RC -ne 0 ]; then |
| 30 | echo Failure during setparm for max connections: rc=$RC |
| 31 | exit $RC |
| 32 | fi |