summaryrefslogtreecommitdiff
path: root/japanese/samba
diff options
context:
space:
mode:
authorNorikatsu Shigemura <nork@FreeBSD.org>2004-08-05 16:45:52 +0000
committerNorikatsu Shigemura <nork@FreeBSD.org>2004-08-05 16:45:52 +0000
commit828d4f6cc819d1db46851ec196ea100261dea4f5 (patch)
treef6b6fed3815ef625f29c9baadfa56ab55415dba8 /japanese/samba
parentFix build with GCC 3.4.2. This patch was originally submitted by (diff)
o Security Update to 2.2.10-ja-1.0.
o rcNG-ify obtained from net/samba3. PR: ports/70034 Submitted by: NAKAJI Hiroyuki <nakaji@jp.freebsd.org> (maintainer)
Notes
Notes: svn path=/head/; revision=115470
Diffstat (limited to 'japanese/samba')
-rw-r--r--japanese/samba/Makefile36
-rw-r--r--japanese/samba/distinfo4
-rw-r--r--japanese/samba/files/samba.sh.sample143
-rw-r--r--japanese/samba/pkg-plist3
4 files changed, 150 insertions, 36 deletions
diff --git a/japanese/samba/Makefile b/japanese/samba/Makefile
index 7f440c439cdd..262139371341 100644
--- a/japanese/samba/Makefile
+++ b/japanese/samba/Makefile
@@ -21,7 +21,7 @@ COMMENT= A free SMB and CIFS client and server for UNIX
CONFLICTS= samba-2.2.* samba-3.0.* sharity-light-1.*
-SAMBA_VERSION= 2.2.9
+SAMBA_VERSION= 2.2.10
SAMBA_JA_VERSION= 1.0
USE_BZIP2= yes
@@ -60,9 +60,14 @@ BUILD_VFS= ""
VARDIR= /var
SAMBA_SPOOL= ${VARDIR}/spool/samba
SAMBA_LOGDIR= ${VARDIR}/log
+SAMBA_RUNDIR= ${VARDIR}/run
+SAMBA_LOCKDIR= ${VARDIR}/db/samba
SAMBA_PRIVATE= ${PREFIX}/private
SAMBA_CONFDIR= ${PREFIX}/etc
+SAMBA_SWATDIR= ${PREFIX}/share/swat
SAMBA_VFSDIR= ${PREFIX}/lib/samba
+SAMBA_CONFIG= ${SAMBA_CONFDIR}/smb.conf
+
SCRIPTS_ENV= WRKDIRPREFIX="${WRKDIRPREFIX}" \
TOUCH="${TOUCH}" \
MKDIR="${MKDIR}" \
@@ -70,21 +75,23 @@ SCRIPTS_ENV= WRKDIRPREFIX="${WRKDIRPREFIX}" \
SAMBA_OPTIONS="${SAMBA_OPTIONS}" \
REALCURDIR="${.CURDIR}"
# sample files
-STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/samba.sh.sample
+STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/samba.sh
SAMPLE_CONFIG= ${SAMBA_CONFDIR}/smb.conf.default
+.include <bsd.port.pre.mk>
+
+USE_RC_SUBR= yes
+
CONFIGURE_ARGS= --with-i18n-swat \
--libdir=${SAMBA_CONFDIR} \
- --localstatedir=${VARDIR} --with-swatdir=${PREFIX}/share/swat \
- --with-lockdir=${VARDIR}/db/samba \
+ --localstatedir=${VARDIR} --with-swatdir=${SAMBA_SWATDIR} \
+ --with-lockdir=${SAMBA_LOCKDIR} \
--with-logfilebase=${SAMBA_LOGDIR} \
--with-privatedir=${SAMBA_PRIVATE} \
--with-piddir=${VARDIR}/run \
--with-pam --with-pam_smbpass \
--with-included-popt
-.include <bsd.port.pre.mk>
-
.if defined(WITH_SYSLOG)
CONFIGURE_ARGS+= --with-syslog
.endif
@@ -116,6 +123,9 @@ LDAPSAM= ""
.if defined(WITH_WINBIND)
CONFIGURE_ARGS+= --with-winbind
WINBIND= ""
+WINBIND_FILTER= ${SED} -e 's|%%WINBIND%%||g'
+.else
+WINBIND_FILTER= ${GREP} -v '^%%WINBIND%%'
.endif
.if defined(WITH_WINBIND_AUTH_CHALLENGE)
@@ -179,6 +189,16 @@ PLIST_SUB= AUDIT=${AUDIT} \
WINBIND=${WINBIND} \
SMBSH=${SMBSH}
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} \
+ CUPS=${CUPS} \
+ RC_SUBR=${RC_SUBR} \
+ SAMBA_CONFDIR=${SAMBA_CONFDIR} \
+ SAMBA_CONFIG=${SAMBA_CONFIG} \
+ SAMBA_LOGDIR=${SAMBA_LOGDIR} \
+ SAMBA_RUNDIR=${SAMBA_RUNDIR} \
+ SAMBA_LOCKDIR=${SAMBA_LOCKDIR} \
+ SAMBA_SPOOL=${SAMBA_SPOOL}
+
post-patch:
${FIND} ${WRKSRC}/.. -name '*.orig' -delete
@@ -187,8 +207,8 @@ pre-build:
(cd ${WRKSRC} && make proto)
post-build:
- ${SED} 's:/usr/local:${PREFIX}:g' ${FILESDIR}/samba.sh.sample \
- > ${WRKDIR}/samba.sh.sample
+ ${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${FILESDIR}/samba.sh.sample | ${WINBIND_FILTER} > ${WRKDIR}/samba.sh.sample
.if defined(WITH_RECYCLE) || defined(WITH_AUDIT)
cd ${WRKSRC}/../examples/VFS; \
./configure;${MAKE}; \
diff --git a/japanese/samba/distinfo b/japanese/samba/distinfo
index 3ed180d223c7..b1f20071183c 100644
--- a/japanese/samba/distinfo
+++ b/japanese/samba/distinfo
@@ -1,2 +1,2 @@
-MD5 (samba-2.2.9-ja-1.0.tar.bz2) = 7648a1afc62ffb8e1f507f731f3f8de3
-SIZE (samba-2.2.9-ja-1.0.tar.bz2) = 7474160
+MD5 (samba-2.2.10-ja-1.0.tar.bz2) = 73d85b6ff8c6d3a925ff70f264eaeded
+SIZE (samba-2.2.10-ja-1.0.tar.bz2) = 7473659
diff --git a/japanese/samba/files/samba.sh.sample b/japanese/samba/files/samba.sh.sample
index abaf42f4520a..6fea8f03478a 100644
--- a/japanese/samba/files/samba.sh.sample
+++ b/japanese/samba/files/samba.sh.sample
@@ -1,30 +1,123 @@
#!/bin/sh
#
# $FreeBSD$
+#
+
+# PROVIDE: nmbd smbd
+%%WINBIND%%# PROVIDE: winbindd
+# REQUIRE: NETWORKING SERVERS named %%CUPS%%
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable samba:
+#
+#samba_enable="YES"
+#
+# or, for fine grain control
+#
+#nmbd_enable="YES"
+#smbd_enable="YES"
+%%WINBIND%%#winbindd_enable="YES"
+#
+
+. %%RC_SUBR%%
-smbspool=/var/spool/samba
-pidfiledir=/var/run
-smbd=/usr/local/sbin/smbd
-nmbd=/usr/local/sbin/nmbd
-
-# start
-if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
- if [ -f $smbd ]; then
- if [ -d $smbspool ]; then
- rm -f $smbspool/*
- fi
- echo -n ' Samba'
- $nmbd -D
- $smbd -D
- fi
-
-# stop
-elif [ "x$1" = "xstop" ]; then
- kill `cat $pidfiledir/smbd.pid`
- kill `cat $pidfiledir/nmbd.pid`
-
-# restart
-elif [ "x$1" = "xrestart" ]; then
- $0 stop
- $0 start
+name=samba
+rcvar=`set_rcvar`
+
+load_rc_config $name
+# Set defaults
+samba_config=${samba_config:-"%%SAMBA_CONFIG%%"}
+# Config file is required
+if [ ! -r ${samba_config} ]; then
+ warn "${samba_config} is not readable."
+ case $1 in
+ force*) : ;;
+ *) exit 1 ;;
+ esac
+fi
+
+if test -n ${samba_enable:-""} && checkyesno samba_enable; then
+ nmbd_enable=${nmbd_enable:-"YES"}
+ smbd_enable=${smbd_enable:-"YES"}
+%%WINBIND%% winbindd_enable=${winbindd_enable:-"YES"}
+%%WINBIND%% # Check, that winbind is actally configured
+%%WINBIND%% if [ ! "`egrep -i '(idmap.*uid|winbind.*uid)' ${samba_config} 2>/dev/null | egrep -v [\#\;]`" ]; then
+%%WINBIND%% #warn "Winbind support is not configured"
+%%WINBIND%% winbindd_enable="NO"
+%%WINBIND%% fi
fi
+
+# Hack until run_rc_command() get rid of exit()
+samba_stop() {
+ pid=$(check_pidfile ${pidfile} ${command})
+ if [ -z ${pid} ]; then
+ echo "${name} not running? (check ${pidfile})."
+ return 1
+ fi
+ echo "Stopping ${command}."
+ kill -${sig_stop:-TERM} ${pid}
+ [ $? -ne 0 ] && [ -z "$rc_force" ] && return 1
+ wait_for_pids ${pid}
+}
+
+nmbd_precmd() {
+ # XXX: Never delete winbindd_idmap, winbindd_cache and group_mapping
+ if [ -d "%%SAMBA_LOCKDIR%%" ]; then
+ echo "Starting SAMBA: removing stale tdbs :"
+ for file in connections.tdb locking.tdb messages.tdb \
+ sessionid.tdb unexpected.tdb brlock.tdb \
+ namelist.debug
+ do
+ rm -vf "%%SAMBA_LOCKDIR%%/$file"
+ done
+ fi
+}
+
+# nmbd
+name=nmbd
+rcvar=`set_rcvar`
+command="%%PREFIX%%/sbin/${name}"
+required_dirs="%%SAMBA_LOCKDIR%%"
+pidfile=%%SAMBA_RUNDIR%%/${name}.pid
+start_precmd="nmbd_precmd"
+stop_cmd="samba_stop"
+# Defaults
+nmbd_enable=${nmbd_enable:-"NO"}
+nmbd_flags=${nmbd_flags:-"-D"}
+command_args="-s ${samba_config}"
+
+load_rc_config $name
+run_rc_command "$1"
+
+# smbd
+name=smbd
+rcvar=`set_rcvar`
+command="%%PREFIX%%/sbin/${name}"
+pidfile=%%SAMBA_RUNDIR%%/${name}.pid
+start_precmd=":"
+stop_cmd="samba_stop"
+# Defaults
+smbd_enable=${smbd_enable:-"NO"}
+smbd_flags=${smbd_flags:-"-D"}
+command_args="-s ${samba_config}"
+
+load_rc_config $name
+run_rc_command "$1"
+%%WINBIND%%
+%%WINBIND%%# winbindd
+%%WINBIND%%name=winbindd
+%%WINBIND%%rcvar=`set_rcvar`
+%%WINBIND%%command="%%PREFIX%%/sbin/${name}"
+%%WINBIND%%required_dirs="%%SAMBA_LOCKDIR%%"
+%%WINBIND%%pidfile=%%SAMBA_RUNDIR%%/${name}.pid
+%%WINBIND%%start_precmd=":"
+%%WINBIND%%stop_cmd="samba_stop"
+%%WINBIND%%# Defaults
+%%WINBIND%%winbindd_enable=${winbindd_enable:-"NO"}
+%%WINBIND%%winbindd_flags=${winbindd_flags:-""}
+%%WINBIND%%command_args="-s ${samba_config}"
+%%WINBIND%%
+%%WINBIND%%load_rc_config $name
+%%WINBIND%%run_rc_command "$1"
diff --git a/japanese/samba/pkg-plist b/japanese/samba/pkg-plist
index 2fa351f46cad..80732719c94c 100644
--- a/japanese/samba/pkg-plist
+++ b/japanese/samba/pkg-plist
@@ -82,7 +82,8 @@ etc/codepages/unicode_map.ISO8859-9
etc/codepages/unicode_map.KOI8-R
etc/codepages/unicode_map.KOI8-U
@dirrm etc/codepages
-etc/rc.d/samba.sh.sample
+@unexec %D/etc/rc.d/samba.sh forcestop 2>/dev/null || true
+etc/rc.d/samba.sh
etc/smb.conf.default
%%AUDIT%%lib/samba/audit.so
%%RECYCLE%%lib/samba/recycle.so