diff options
author | jlam <jlam@pkgsrc.org> | 2001-11-21 16:44:17 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2001-11-21 16:44:17 +0000 |
commit | 16bb385d16c8b0abbb5ad13ac4e18d2e96976727 (patch) | |
tree | 4b3cfc0b81c0625c37d33c1d29387c5c7386b705 | |
parent | a896a9b92a730ad701a514f87820743bbf7bd97b (diff) | |
download | pkgsrc-16bb385d16c8b0abbb5ad13ac4e18d2e96976727.tar.gz |
Use the general INSTALL/DEINSTALL scripts instead of the homegrown ones.
Also split the one rc.d script into one for each daemon and one admin
script (idea from Luke Mewburn <lukem@wasabisystems.com>).
-rw-r--r-- | net/samba/INSTALL | 45 | ||||
-rw-r--r-- | net/samba/Makefile | 42 | ||||
-rwxr-xr-x | net/samba/files/nmbd.sh | 30 | ||||
-rw-r--r-- | net/samba/files/samba.sh | 61 | ||||
-rwxr-xr-x | net/samba/files/smbd.sh | 28 |
5 files changed, 108 insertions, 98 deletions
diff --git a/net/samba/INSTALL b/net/samba/INSTALL index e435075d547..cfcf2709cbf 100644 --- a/net/samba/INSTALL +++ b/net/samba/INSTALL @@ -1,48 +1,15 @@ #!/bin/sh # -# $NetBSD: INSTALL,v 1.1 2001/10/31 22:58:42 zuntum Exp $ - -PKGNAME=$1 -STAGE=$2 - -CAT="@CAT@" -CHMOD="@CHMOD@" -CHOWN="@CHOWN@" -CP="@CP@" -MKDIR="@MKDIR@" -RM="@RM@" +# $NetBSD: INSTALL,v 1.2 2001/11/21 16:44:17 jlam Exp $ SAMBA_PRIVATE="@SAMBA_PRIVATE@" -SAMBA_LOCKDIR="@SAMBA_LOCKDIR@" -SAMPLECONFDIR=${PKG_PREFIX}/share/examples/samba -CONFDIR=@SAMBA_ETCDIR@ -CONFFILES="smb.conf" case ${STAGE} in -PRE-INSTALL) - ;; - POST-INSTALL) - ${MKDIR} -p ${CONFDIR} ${SAMBA_PRIVATE} ${SAMBA_LOCKDIR} - echo "Installing configuration files:" - for file in ${CONFFILES} - do - FILE=${CONFDIR}/${file} - SAMPLEFILE=${SAMPLECONFDIR}/${file}.sample - if [ -f ${FILE} ] - then - echo " ${FILE} already exists" - else - echo " ${FILE}" - ${CP} ${SAMPLEFILE} ${FILE} - ${CHMOD} 644 ${FILE} - fi - done - # Create SMB password file - if [ ! -f ${SAMBA_PRIVATE}/smbpasswd ] + if [ ! -e ${SAMBA_PRIVATE}/smbpasswd ] then - echo -n "Creating ${SAMBA_PRIVATE}/smbpasswd..." + ${ECHO} -n "Creating ${SAMBA_PRIVATE}/smbpasswd..." ${CHOWN} -R 0:0 ${SAMBA_PRIVATE} ${CAT} /etc/passwd | ${PKG_PREFIX}/sbin/mksmbpasswd \ > ${SAMBA_PRIVATE}/smbpasswd @@ -51,10 +18,4 @@ POST-INSTALL) echo "done." fi ;; - -*) - echo "Unexpected argument: ${STAGE}" - exit 1 - ;; esac -exit 0 diff --git a/net/samba/Makefile b/net/samba/Makefile index e4373806530..d23c4ca453d 100644 --- a/net/samba/Makefile +++ b/net/samba/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.67 2001/11/15 15:24:39 taca Exp $ +# $NetBSD: Makefile,v 1.68 2001/11/21 16:44:17 jlam Exp $ DISTNAME= samba-2.2.2 WRKSRC= ${WRKDIR}/${DISTNAME}/source @@ -14,8 +14,6 @@ MAINTAINER= packages@netbsd.org HOMEPAGE= http://www.samba.org/ COMMENT= SMB/CIFS protocol server suite for UNIX -#USE_SSL= # defined - GNU_CONFIGURE= # defined USE_LIBTOOL= # defined LTCONFIG_OVERRIDE= ${WRKSRC}/ltconfig @@ -29,7 +27,7 @@ USE_GNU_READLINE= # uses rl_event_hook interface to GNU readline SAMBA_LOGDIR= /var/log SAMBA_LOCKDIR= /var/run/samba -SAMBA_ETCDIR?= /etc/samba +SAMBA_ETCDIR?= ${CONFDIR}/samba SAMBA_PRIVATE?= ${SAMBA_ETCDIR}/private SAMBA_SHARE?= ${PREFIX}/share @@ -65,9 +63,6 @@ CONFIGURE_ARGS+= --with-pam CONFIGURE_ARGS+= --without-smbwrapper CONFIGURE_ARGS+= --without-smbmount -INSTALL_FILE= ${WRKDIR}/INSTALL -DEINSTALL_FILE= ${WRKDIR}/DEINSTALL - DOCDIR= ${PREFIX}/share/doc/samba HTMLDIR= ${PREFIX}/share/doc/html/samba EXAMPLESDIR= ${PREFIX}/share/examples/samba @@ -76,30 +71,25 @@ FILES_SUBST= SAMBA_PRIVATE=${SAMBA_PRIVATE} FILES_SUBST+= SAMBA_LOCKDIR=${SAMBA_LOCKDIR} FILES_SUBST+= SAMBA_LOGDIR=${SAMBA_LOGDIR} FILES_SUBST+= SAMBA_ETCDIR=${SAMBA_ETCDIR} -FILES_SUBST+= PREFIX=${PREFIX} -FILES_SUBST+= CAT=${CAT:Q} -FILES_SUBST+= CHMOD=${CHMOD:Q} -FILES_SUBST+= CHOWN=${CHOWN:Q} -FILES_SUBST+= CMP=${CMP:Q} -FILES_SUBST+= CP=${CP:Q} -FILES_SUBST+= ECHO=${ECHO:Q} -FILES_SUBST+= MKDIR=${MKDIR:Q} -FILES_SUBST+= RM=${RM:Q} -FILES_SUBST+= RMDIR=${RMDIR:Q} -FILES_SUBST+= TRUE=${TRUE:Q} -FILES_SUBST_SED= ${FILES_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} - MESSAGE_SUBST+= ETCDIR=${SAMBA_ETCDIR} +CONF_FILES= ${EXAMPLESDIR}/smb.conf.sample ${SAMBA_ETCDIR}/smb.conf +RCD_SCRIPTS= samba nmbd smbd +MAKE_DIRS= ${SAMBA_LOCKDIR} +OWN_DIRS= ${SAMBA_ETCDIR} ${SAMBA_PRIVATE} + +INSTALL_EXTRA_TMPL= ${PKGDIR}/INSTALL + post-extract: ${FIND} ${WRKDIR}/${DISTNAME} -name ".cvsignore" -print | \ ${XARGS} ${RM} -f ${RM} -r ${WRKDIR}/${DISTNAME}/docs/textdocs/outdated pre-install: - ${SED} ${FILES_SUBST_SED} ${FILESDIR}/samba.sh > ${WRKDIR}/samba.sh - ${SED} ${FILES_SUBST_SED} ${PKGDIR}/INSTALL > ${INSTALL_FILE} - ${SED} ${FILES_SUBST_SED} ${PKGDIR}/DEINSTALL > ${DEINSTALL_FILE} + for script in ${RCD_SCRIPTS}; do \ + ${SED} ${FILES_SUBST_SED} ${FILESDIR}/$${script}.sh \ + > ${WRKDIR}/$${script}; \ + done post-install: # Install Samba documentation. @@ -115,7 +105,10 @@ post-install: ${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLESDIR} ${CHMOD} -R ugo-w ${EXAMPLESDIR} - ${INSTALL_SCRIPT} ${WRKDIR}/samba.sh ${PREFIX}/etc/rc.d/samba + for script in ${RCD_SCRIPTS}; do \ + ${INSTALL_SCRIPT} ${WRKDIR}/$${script} \ + ${PREFIX}/etc/rc.d/$${script}; \ + done ${INSTALL_SCRIPT} ${WRKSRC}/script/convert_smbpasswd ${PREFIX}/sbin ${INSTALL_SCRIPT} ${WRKSRC}/script/mksmbpasswd.sh \ ${PREFIX}/sbin/mksmbpasswd @@ -126,4 +119,5 @@ post-install: PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL +.include "../../mk/bsd.pkg.install.mk" .include "../../mk/bsd.pkg.mk" diff --git a/net/samba/files/nmbd.sh b/net/samba/files/nmbd.sh new file mode 100755 index 00000000000..95c029f60f9 --- /dev/null +++ b/net/samba/files/nmbd.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $NetBSD: nmbd.sh,v 1.5 2001/11/21 16:44:18 jlam Exp $ +# +# PROVIDE: nmbd +# REQUIRE: DAEMON + +if [ -d /etc/rc.d -a -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 [ ! -d /etc/rc.d ] +then + @ECHO@ -n ' ${name}' + ${command} ${nmbd_flags} ${command_args} +else + load_rc_config $name + run_rc_command "$1" +fi diff --git a/net/samba/files/samba.sh b/net/samba/files/samba.sh index c087d2f5d50..157abe0028a 100644 --- a/net/samba/files/samba.sh +++ b/net/samba/files/samba.sh @@ -1,52 +1,49 @@ #!/bin/sh # -# $NetBSD: samba.sh,v 1.5 2001/08/23 04:15:10 jlam Exp $ +# $NetBSD: samba.sh,v 1.6 2001/11/21 16:44:18 jlam Exp $ # # PROVIDE: samba -# REQUIRE: DAEMON -# -# nmbd may require DNS to resolve NetBIOS hostnames, and smbd may be acting as -# a Backup Domain Controller and may need the network to be up, so simply -# require DAEMON above. -# -# To use this script, copy to /etc/rc.d and set samba=YES in /etc/rc.conf. -# You may also set nmbd_flags and smbd_flags to any additional options you -# wish to pass to the Samba daemons. +# KEYWORD: nostart if [ -d /etc/rc.d -a -f /etc/rc.subr ] then . /etc/rc.subr fi -arg="$1" -rcvar="samba" -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} +# NOTE: run_rc_command sets $_arg +# +forward_commands() +{ + for file in $COMMAND_LIST; do + /etc/rc.d/$file $_arg + done +} -name="nmbd" -command="@PREFIX@/sbin/${name}" -reload_cmd=":" # avoid dumping debug output on SIGHUP +reverse_commands() +{ + REVCOMMAND_LIST= + for file in $COMMAND_LIST; do + REVCOMMAND_LIST="$file $REVCOMMAND_LIST" + done + for file in $REVCOMMAND_LIST; do + /etc/rc.d/$file $_arg + done +} -if [ ! -d /etc/rc.d ] -then - @ECHO@ -n ' ${name}' - ${command} ${nmbd_flags} ${command_args} -else - load_rc_config $name - run_rc_command "$arg" -fi +COMMAND_LIST="nmbd smbd" -name="smbd" -command="@PREFIX@/sbin/${name}" -reload_cmd= # use default reload command for smbd +name="samba" +start_cmd="forward_commands" +stop_cmd="reverse_commands" +reload_cmd="forward_commands" +status_cmd="forward_commands" +extra_commands="reload status" if [ ! -d /etc/rc.d ] then @ECHO@ -n ' ${name}' - ${command} ${smbd_flags} ${command_args} + _arg="$1" + ${start_cmd} else - load_rc_config $name run_rc_command "$1" fi diff --git a/net/samba/files/smbd.sh b/net/samba/files/smbd.sh new file mode 100755 index 00000000000..74b7f8a8c61 --- /dev/null +++ b/net/samba/files/smbd.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# $NetBSD: smbd.sh,v 1.6 2001/11/21 16:44:18 jlam Exp $ +# +# PROVIDE: smbd +# REQUIRE: DAEMON + +if [ -d /etc/rc.d -a -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 [ ! -d /etc/rc.d ] +then + @ECHO@ -n ' ${name}' + ${command} ${smbd_flags} ${command_args} +else + load_rc_config $name + run_rc_command "$1" +fi |