diff options
author | jlam <jlam> | 2004-01-11 00:41:12 +0000 |
---|---|---|
committer | jlam <jlam> | 2004-01-11 00:41:12 +0000 |
commit | 497b953ccc901e5af0a124670b5e1a058a7fff2e (patch) | |
tree | d0930d3abc3d71cb10ffc2c18b000cbd8a027e59 /net/samba2/files | |
parent | 984ce45b6f50e3f125c723950e7a09f48c5358a9 (diff) | |
download | pkgsrc-497b953ccc901e5af0a124670b5e1a058a7fff2e.tar.gz |
Reimport net/samba as net/samba2. net/samba2 will continue to track the
2.x release of Samba, which net/samba will track post-2.x releases of
Samba.
Diffstat (limited to 'net/samba2/files')
-rw-r--r-- | net/samba2/files/adduser.sh | 160 | ||||
-rw-r--r-- | net/samba2/files/deluser.sh | 68 | ||||
-rw-r--r-- | net/samba2/files/nmbd.sh | 30 | ||||
-rw-r--r-- | net/samba2/files/samba.sh | 56 | ||||
-rw-r--r-- | net/samba2/files/smbd.sh | 28 |
5 files changed, 342 insertions, 0 deletions
diff --git a/net/samba2/files/adduser.sh b/net/samba2/files/adduser.sh new file mode 100644 index 00000000000..edca6e1fa3a --- /dev/null +++ b/net/samba2/files/adduser.sh @@ -0,0 +1,160 @@ +#!/bin/sh +# +# $NetBSD: adduser.sh,v 1.1.1.1 2004/01/11 00:41:13 jlam Exp $ +# +# This is an adduser script for NetBSD systems whose useradd(8) doesn't +# accept "$" in the username. + +awkprog="@AWK@" +catprog="@CAT@" +mktempprog="@MKTEMP@" +pwdmkdbprog="@PWD_MKDB@" +rmprog="@RM@" + +progname=adduser + +usage() { + echo "Usage: $progname [-c comment] [-d homedir] [-n] [-r low..high]" + echo " [-s shell] -g gid name" + exit 1 +} + +isnum() { + case "$1" in + 0[0-9]*|*[!0-9]*) + return 1 + ;; + esac + return 0 +} + +doit="" +gid="" +minuid=1000 +maxuid=60000 +comment="" +homedir="" +shell=/sbin/nologin + +while getopts c:d:g:nr:s: flag; do + case $flag in + c) comment="${OPTARG}" ;; + d) homedir="${OPTARG}" ;; + g) gid="${OPTARG}" ;; + n) doit=":" ;; + r) minuid=${OPTARG%%..*}; maxuid=${OPTARG##*..} ;; + s) shell="${OPTARG}" ;; + esac +done +shift `expr $OPTIND - 1` + +if [ $# -lt 1 ]; then + usage +fi + +name="$1" +if [ -z "$gid" ]; then + echo "$progname: \`-g gid' is a required option" 1>&2 + exit 1 +fi +if ! isnum "$gid"; then + echo "$progname: \`$gid' is not a valid gid" 1>&2 + exit 1 +fi +if ! isnum "$minuid"; then + echo "$progname: \`$minuid' is not a valid minimum uid" 1>&2 + exit 1 +fi +if ! isnum "$maxuid"; then + echo "$progname: \`$maxuid' is not a valid maximum uid" 1>&2 + exit 1 +fi +if [ $minuid -gt $maxuid ]; then + echo "$progname: \`$minuid..$maxuid' is not a valid range" 1>&2 + exit 1 +fi +case "$comment" in +*:*) + echo "$progname: \`$comment' is not a valid comment" 1>&2 + exit 1 + ;; +esac +case "$homedir" in +*:*) + echo "$progname: \`$homedir' is not a valid home directory" 1>&2 + exit 1 + ;; +%*) + # This is an unsubstituted variable (probably %H in smbd). + # Silently change this to a proper default. + # + homedir="/nonexistent" + ;; +esac +case "$shell" in +*:*) + echo "$progname: \`$shell' is not a valid shell" 1>&2 + exit 1 + ;; +esac +case "$name" in +*:*) + echo "$progname: \`$name' is not a valid username" 1>&2 + exit 1 + ;; +esac + +ptmp=`$mktempprog -q /etc/ptmp` +case "$ptmp" in +/etc/ptmp) + ;; +*) + echo "$progname: can't create /etc/ptmp" 1>&2 + exit 1 + ;; +esac + +if [ ! -f /etc/master.passwd ]; then + echo "$progname: /etc/master.passwd not found" 1>&2 + $rmprog -f $ptmp + exit 1 +fi + +$catprog /etc/master.passwd >> $ptmp + +uid=` \ + $awkprog -v minuid=$minuid -v maxuid=maxuid ' \ + BEGIN { FS = ":" } \ + { seen_uids[$3] = 1 } \ + END { \ + uid = minuid; \ + while (uid <= maxuid) { \ + if (uid in seen_uids) { \ + uid++; \ + continue; \ + } \ + print uid; \ + exit; \ + } \ + print -1; \ + }' $ptmp \ +` +if [ $uid -lt 0 ]; then + echo "$progname: no uid can be allocated in $minuid..$maxuid" 1>&2 + $rmprog -f $ptmp + exit 1 +fi + +case "${name}" in +*$) : ${comment:=${name%%[$]*} samba machine account} ;; +*) : ${comment:=${name} samba user} ;; +esac +entry="${name}:*:${uid}:${gid}::0:0:${comment}:${homedir}:${shell}" + +echo "$entry" >> $ptmp + +$doit $pwdmkdbprog -p -u "${name}" $ptmp +rc=$? + +$rmprog -f $ptmp +exit $rc diff --git a/net/samba2/files/deluser.sh b/net/samba2/files/deluser.sh new file mode 100644 index 00000000000..1b55c879e0c --- /dev/null +++ b/net/samba2/files/deluser.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# +# $NetBSD: deluser.sh,v 1.1.1.1 2004/01/11 00:41:13 jlam Exp $ +# +# This is a deluser script for NetBSD systems whose userdel(8) doesn't +# accept "$" in the username. + +awkprog="@AWK@" +mktempprog="@MKTEMP@" +pwdmkdbprog="@PWD_MKDB@" +rmprog="@RM@" + +progname=deluser + +usage() { + echo "Usage: $progname [-n] name" + exit 1 +} + +doit="" + +while getopts n flag; do + case $flag in + n) doit=":" ;; + esac +done +shift `expr $OPTIND - 1` + +if [ $# -lt 1 ]; then + usage +fi + +name="$1" + +case "$name" in +*:*) + echo "$progname: \`$name' is not a valid user name" 1>&2 + exit 1 +esac + +ptmp=`$mktempprog -q /etc/ptmp` +case "$ptmp" in +/etc/ptmp) + ;; +*) + echo "$progname: can't create /etc/ptmp" 1>&2 + exit 1 + ;; +esac + +if [ ! -f /etc/master.passwd ]; then + echo "$progname: /etc/master.passwd not found" 1>&2 + $rmprog -f $ptmp + exit 1 +fi + +$awkprog -v name="${name}" ' \ + BEGIN { FS = ":" } \ + { \ + if ($1 != name) \ + print $0; \ + }' /etc/master.passwd > $ptmp + +$doit $pwdmkdbprog -p $ptmp +rc=$? + +$rmprog -f $ptmp +exit $rc diff --git a/net/samba2/files/nmbd.sh b/net/samba2/files/nmbd.sh new file mode 100644 index 00000000000..0e11c4d8f8a --- /dev/null +++ b/net/samba2/files/nmbd.sh @@ -0,0 +1,30 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: nmbd.sh,v 1.1.1.1 2004/01/11 00:41:13 jlam Exp $ +# +# PROVIDE: nmbd +# REQUIRE: DAEMON + +if [ -f /etc/rc.subr ] +then + . /etc/rc.subr +fi + +name="nmbd" +rcvar=$name +command="@PREFIX@/sbin/${name}" +required_files="@SAMBA_ETCDIR@/smb.conf" +extra_commands="reload" +command_args="-D" # _must_ start as daemon from rc.d; + # add more flags through ${${name}_flags} + +reload_cmd=":" # avoid dumping debug output on SIGHUP + +if [ -f /etc/rc.subr ] +then + load_rc_config $name + run_rc_command "$1" +else + @ECHO@ -n " ${name}" + ${command} ${nmbd_flags} ${command_args} +fi diff --git a/net/samba2/files/samba.sh b/net/samba2/files/samba.sh new file mode 100644 index 00000000000..c5316a2906c --- /dev/null +++ b/net/samba2/files/samba.sh @@ -0,0 +1,56 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: samba.sh,v 1.1.1.1 2004/01/11 00:41:13 jlam Exp $ +# +# KEYWORD: nostart + +if [ -f /etc/rc.subr ] +then + . /etc/rc.subr +fi + +rcd_dir=`@DIRNAME@ $0` + +# NOTE: run_rc_command sets $rc_arg +# +forward_commands() +{ + # Backward compat with NetBSD <1.6: + [ -z "$rc_arg" ] && rc_arg=$_arg + + for file in $COMMAND_LIST; do + $rcd_dir/$file $rc_arg + done +} + +reverse_commands() +{ + # Backward compat with NetBSD <1.6: + [ -z "$rc_arg" ] && rc_arg=$_arg + + REVCOMMAND_LIST= + for file in $COMMAND_LIST; do + REVCOMMAND_LIST="$file $REVCOMMAND_LIST" + done + for file in $REVCOMMAND_LIST; do + $rcd_dir/$file $rc_arg + done +} + +COMMAND_LIST="nmbd smbd" + +name="samba" +start_cmd="forward_commands" +stop_cmd="reverse_commands" +reload_cmd="forward_commands" +status_cmd="forward_commands" +extra_commands="reload status" + +if [ -f /etc/rc.subr ] +then + run_rc_command "$1" +else + @ECHO@ -n " ${name}" + _arg="$1" + ${start_cmd} +fi diff --git a/net/samba2/files/smbd.sh b/net/samba2/files/smbd.sh new file mode 100644 index 00000000000..21c5491a8cb --- /dev/null +++ b/net/samba2/files/smbd.sh @@ -0,0 +1,28 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: smbd.sh,v 1.1.1.1 2004/01/11 00:41:13 jlam Exp $ +# +# PROVIDE: smbd +# REQUIRE: DAEMON + +if [ -f /etc/rc.subr ] +then + . /etc/rc.subr +fi + +name="smbd" +rcvar=$name +command="@PREFIX@/sbin/${name}" +required_files="@SAMBA_ETCDIR@/smb.conf" +extra_commands="reload" +command_args="-D" # _must_ start as daemon from rc.d; + # add more flags through ${${name}_flags} + +if [ -f /etc/rc.subr ] +then + load_rc_config $name + run_rc_command "$1" +else + @ECHO@ -n " ${name}" + ${command} ${smbd_flags} ${command_args} +fi |