Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2001 02:10:53 +0200 (CEST)
From:      Cyrille Lefevre <clefevre@citeweb.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/29943: Maintainer update: setiathome tidy and enhancements
Message-ID:  <200108220010.f7M0ArL89631@gits.dyndns.org>

next in thread | raw e-mail | index | archive | help

>Number:         29943
>Category:       ports
>Synopsis:       Maintainer update: setiathome tidy and enhancements
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 21 17:20:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
ACME
>Environment:
System: FreeBSD gits 4.3-STABLE FreeBSD 4.3-STABLE #28: Wed Jul 25 09:04:25 CEST 2001 root@gits:/disk2/4.x-stable/src/sys/compile/CUSTOM i386

>Description:
	Tidy things up a bit.

	Makefile
		PORTREVISION bumped (also needed by tkseti).
		MAINTAINER email address changed.
		PACKAGE_BUILDING replaced by BATCH.
		PKGMESSAGE and PKGDEINSTALL added.

	pkg-install
		$FreeBSD$ added.
		PACKAGE_BUILDING replaced by BATCH.
		indentation changed for more readability.
		DEINSTALL section added.

	pkg-message
		new file.

	pkg-plist
		updated.

	files/setiathome.sh
		indentation changed for more readability.
		messages logged through syslog.
		restart/status sections added.

	files/rc.setiathome.conf
		new file.

>How-To-Repeat:
	n/a
>Fix:

	Take care, the first two patches are against /dev/null.
	others are cvs diff.

--- /dev/null	Wed Aug 22 00:24:32 2001
+++ pkg-message	Wed Aug 22 00:13:46 2001
@@ -0,0 +1,3 @@
+****  %%PREFIX%%/etc/rc.setiathome.conf may be edited to tune some startup
+      variables such as `seti_nice' defaulted to 15 and `seti_maxprocs'
+      defaulted to your number of processors.
--- /dev/null	Wed Aug 22 00:24:32 2001
+++ files/rc.setiathome.conf	Tue Aug 21 06:04:06 2001
@@ -0,0 +1,12 @@
+# $FreeBSD$
+#
+# SETI@home startup configuration file.
+#
+
+# seti_wrkdir=/var/db/setiathome	# primary working directory
+# seti_std_args=-email			# command arguments for standard mode
+# seti_reg_args=-login			# command arguments for register mode
+# seti_proxy_args=			# proxy arguments
+# seti_user=nobody			# user id to run as
+# seti_nice=15				# nice level to run at
+# seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/Makefile,v
retrieving revision 1.27
diff -u -r1.27 Makefile
--- Makefile	2001/06/09 12:59:29	1.27
+++ Makefile	2001/08/22 00:03:35
@@ -6,7 +6,7 @@
 
 PORTNAME=	setiathome
 PORTVERSION=	3.03
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	astro
 MASTER_SITES=	ftp://ftp.cdrom.com/pub/setiathome/ \
 		ftp://alien.ssl.berkeley.edu/pub/ \
@@ -15,15 +15,14 @@
 DISTNAME=	${PORTNAME}-${PORTVERSION}.${PORT_HOST}
 EXTRACT_SUFX=	.tar
 
-MAINTAINER=	clefevre@redirect.to
+MAINTAINER=	clefevre@citeweb.net
 
 .include <bsd.port.pre.mk>
 
-#
 # Global variables
 #
 
-.if !defined(PACKAGE_BUILDING) || empty(PACKAGE_BUILDING)
+.if !defined(BATCH)
 IS_INTERACTIVE=	yes
 .endif
 
@@ -38,13 +37,17 @@
 
 EXTRACT_CMD=	${CAT}
 EXTRACT_BEFORE_ARGS=
+
 STRIP=		# aout is already stripped
 SCRIPTS_ENV+=	PKG_PREFIX=${PREFIX}
-SCRIPTS_ENV+=	PACKAGE_BUILDING=${PACKAGE_BUILDING}
+PLIST_SUB=	X11PORTS=${X11PORTS}
 
 MAN1=		${PORTNAME}.1
 
-#
+MSG_FILE=	${PKGDIR}/pkg-message
+PKGMESSAGE=	${WRKDIR}/pkg-message
+PKGDEINSTALL=	${PKGINSTALL}
+
 # Local variables
 #
 
@@ -55,12 +58,15 @@
 PORT_OS=	${PORT_OSNAME}${PORT_OSREL}
 PORT_HOST=	${PORT_CPU}-${PORT_VENDOR}-${PORT_OS}
 
-SBINSUBDIR?=	sbin
-RCDSUBDIR=	etc/rc.d
-MANSUBDIR=	man
-PROG=		${PORTNAME}
-SCRIPT=		${PORTNAME}.sh
+SBIN_DIR=	${PREFIX}/sbin
+CONF_DIR=	${PREFIX}/etc
+RC_DIR=		${PREFIX}/etc/rc.d
 
+SAMP_SUFX=	.sample
+
+BIN_FILE=	setiathome
+RC_FILES=	setiathome
+
 # xsetiathome is currently broken at 4.2. should work at 2.x,
 # don't know between 3.0 and 4.2 ? so, be conservative...
 # diagnostic messages are :
@@ -68,60 +74,70 @@
 #	Floating point exception (core dumped)
 
 .if ${OSVERSION} < 300000
-XBINSUBDIR=	bin
-XPROG+=		x${PORTNAME}
 MAN1+=		x${PORTNAME}.1
+XBIN_DIR=	${PREFIX}/bin
+XBIN_FILE+=	xsetiathome
+X11PORTS=
+.else
+X11PORTS=	"@comment "
 .endif
 
 #
-# Post-configure
 #
 
-post-configure:
-	@${SED} -e 's.!!SUBDIR!!.${SBINSUBDIR}.g' ${FILESDIR}/${SCRIPT} > ${WRKSRC}/${SCRIPT}
+post-patch: patch-message
 
-#
+patch-message:
+	@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE}
+
 # Install
 #
 
-do-install: install-daemon install-program install-script install-man
+do-install: install-daemon install-program install-man
 
 install-daemon:
-	@${INSTALL_PROGRAM} ${WRKSRC}/${PROG} ${PREFIX}/${SBINSUBDIR}
+	@${INSTALL_PROGRAM} ${WRKSRC}/${BIN_FILE} ${SBIN_DIR}
 
 install-program:
 .if defined(XPROG)
-	@${INSTALL_PROGRAM} ${WRKSRC}/${prog} ${PREFIX}/${XBINSUBDIR}
+	@${INSTALL_PROGRAM} ${WRKSRC}/${XBIN_FILE} ${XBIN_DIR}
 .endif
 
-install-script:
-	@${INSTALL_SCRIPT} ${WRKSRC}/${SCRIPT} ${PREFIX}/${RCDSUBDIR}
-
 install-man:
 .for mansect in 1
 .for man in ${MAN${mansect}}
 	@${INSTALL_MAN} ${FILESDIR}/${man} \
-			${MAN${mansect}PREFIX}/${MANSUBDIR}/man${mansect}
+			${MAN${mansect}PREFIX}/man/man${mansect}
 .endfor
 .endfor
 
-#
 # Post-install
 #
 
-post-install: update-plist configure-package
+post-install: install-startup-files configure-package display-message
 
-update-plist:
-	@${GREP} -q ${SBINSUBDIR}/${PROG} ${TMPPLIST} || \
-	 ${ECHO} ${SBINSUBDIR}/${PROG} >> ${TMPPLIST}
-.if defined(XPROG)
-	@${GREP} -q ${XBINSUBDIR}/${XPROG} ${TMPPLIST} || \
-	 ${ECHO} ${XBINSUBDIR}/${XPROG} >> ${TMPPLIST}
+install-startup-files:
+.for file in ${RC_FILES}
+.if exists(${FILESDIR}/rc.${file}.conf)
+	@${INSTALL_DATA} ${FILESDIR}/rc.${file}.conf \
+		${CONF_DIR}/rc.${file}.conf${SAMP_SUFX}
+.if !exists(${CONF_DIR}/rc.${file}.conf)
+	@${INSTALL_DATA} ${FILESDIR}/rc.${file}.conf ${CONF_DIR}
+.endif
 .endif
+.if exists(${FILESDIR}/${file}.sh)
+	@${INSTALL_SCRIPT} ${FILESDIR}/${file}.sh ${RC_DIR}
+.endif
+.endfor
 
 configure-package:
-.if defined(IS_INTERACTIVE)
+.if !defined(BATCH)
 	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.endif
+
+display-message:
+.if !defined(BATCH)
+	@${CAT} ${PKGMESSAGE}
 .endif
 
 .include <bsd.port.post.mk>
Index: pkg-install
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/pkg-install,v
retrieving revision 1.7
diff -u -r1.7 pkg-install
--- pkg-install	2001/01/28 19:48:30	1.7
+++ pkg-install	2001/08/21 23:54:02
@@ -1,66 +1,141 @@
 #!/bin/sh
-
+#
+# $FreeBSD$
 #
-# Set up the work area and run setiathome to login or register
+# Set up the work area and run SETI@home to login or register.
 #
+
+[ $# != 2 ] && exit 1
+[ -z "${PKG_PREFIX}" ] && exit 1
+[ -n "${BATCH}" ] && exit 0
+
+PKG_NAME=$1
+PKG_ACTION=$2
 
-seti_rcdir=${PKG_PREFIX}/etc/rc.d	# startup directory
-seti_script=setiathome.sh		# startup script
+# override these variables in ${PREFIX}/etc/rc.setiathome.conf
 seti_wrkdir=/var/db/setiathome		# working directory
 seti_user=nobody			# user id to run under
-seti_maxprocs=`sysctl -n hw.ncpu`	# max. number of processes to start
+seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start
 
-if [ -f ${PKG_PREFIX}/etc/setiathome.conf ]; then
-	. ${PKG_PREFIX}/etc/setiathome.conf
-fi
+rcconf_dir=${PKG_PREFIX}/etc
+rcconf_file=rc.setiathome.conf
+rcconf_path=${rcconf_dir}/${rcconf_file}
 
-case $2 in
-	POST-INSTALL)
-		if [ -n "${PACKAGE_BUILDING}" ]; then
-			exit 0
-		fi
+if [ -f ${rcconf_path} ]; then
+	. ${rcconf_path}
+fi
 
-		echo "****  setihome requires a working directory for temporary files and"
-		echo "      a brief registration process."
-		echo
-		echo "      Would you like to set up a working directory in ${seti_wrkdir},"
-		if [ ${seti_maxprocs} -gt 1 ]; then
-			if [ `sysctl -n hw.ncpu` -eq ${seti_maxprocs} ]; then
-				echo "      register with SETI@home, and let me arrange for ${seti_maxprocs} setiathome"
-				echo "      processes (one for each of your `sysctl -n hw.ncpu` CPUs) to be started automatically"
-				echo -n "      as user \`${seti_user}' [Y/n]? "
-			else
-				echo "      register with SETI@home, and let me arrange for ${seti_maxprocs} setiathome"
-				echo "      processes (as configured) to be started automatically"
-				echo -n "      as user \`${seti_user}' [Y/n]? "
-			fi
+rc_dir=${PKG_PREFIX}/etc/rc.d
+rc_file=setiathome.sh
+rc_path=${rc_dir}/${rc_file}
+
+ncpu=$(sysctl -n hw.ncpu)
+
+case "$PKG_ACTION" in
+POST-INSTALL)
+
+echo "****  SETI@home requires a working directory for temporary files and a"
+echo "      brief registration process."
+echo
+echo "      Would you like to set up a working directory in ${seti_wrkdir},"
+	if [ ${seti_maxprocs} -gt 1 ]; then
+echo "      register with SETI@home, and let me arrange for ${ncpu} setiathome"
+		if [ ${ncpu} -eq ${seti_maxprocs} ]; then
+echo "      processes (one for each of your ${ncpu} CPUs) to be started"
+echo -n "      automatically as user \`${seti_user}'? [Y/n] "
 		else
-			echo "      register with SETI@home, and let me arrange for setiathome to be"
-			echo -n "      started automatically as user \`${seti_user}' [Y/n]? "
+echo "      processes (as configured) to be started automatically as user"
+echo -n "      \`${seti_user}'? [Y/n] "
 		fi
-		read a
-		echo ""
-		if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
-			echo ""
-			echo "Please set up the working directory yourself.  You can use"
-			echo "${seti_rcdir}/${seti_script} register"
-			echo "to do so. See setiathome(1) for details."
-			exit 0
-		fi
-
-		${seti_rcdir}/${seti_script} register
-
-		if [ ! -f ${seti_wrkdir}/user_info.sah ]; then
-			echo "unable to start setiathome: it seems registration or login failed."
-			exit 0
-		fi
-		${seti_rcdir}/${seti_script} start >/dev/null
-		echo
-		echo "****  Congratulations!  Your system now participates in the search for extra-"
-		echo "      terrestrial intelligence.  Be sure to visit the home page at"
-		echo "      http://setiathome.ssl.berkeley.edu/"
-		echo "      See setiathome(1) for further details."
-		;;
-
+	else
+echo "      register with SETI@home, and let me arrange for setiathome to be"
+echo -n "      started automatically as user \`${seti_user}'? [Y/n] "
+	fi
+	read a
+echo
+	if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
+echo "****  Please set up the working directory yourself.  You may use"
+echo "            ${rc_path} register"
+echo "      to do so. See setiathome(1) for details."
+		exit 0
+	fi
+	${rc_path} register
+	if [ ! -f ${seti_wrkdir}/user_info.sah ]; then
+echo "unable to start setiathome: it seems registration or login failed."
+echo "See setiathome(1) for details."
+		exit 0
+	fi
+	${rc_path} start > /dev/null
+echo
+echo "****  Congratulations!  Your system now participates in the search for"
+echo "      extra-terrestrial intelligence.  Be sure to visit the home page"
+echo "      at http://setiathome.ssl.berkeley.edu/"
+echo "      See setiathome(1) for further details."
+	;;
+
+DEINSTALL)
+	if [ ! -d ${seti_wrkdir} ]; then
+		exit 0
+	fi
+
+	${rc_path} stop > /dev/null
+
+echo "****  SETI@home working directory and temporary files have to be"
+echo "      removed to complete the deinstallation process.  Of course,"
+echo "      you may prefer to keep them for futher researchs?  Would you"
+echo "      like to remove it as well as all temporary files it may"
+echo -n "      contains? [y/N] "
+	read a
+echo
+	if [ "X$a" != "XY" -a "X$a" != "Xy" ]; then
+echo "****  SETI@home working directory and temporary files left untouched."
+		exit 0
+	fi
+	for i in ${seti_wrkdir}/.??* ${seti_wrkdir}/*; do
+		case "${i}" in
+		"${seti_wrkdir}/.??*"|"${seti_wrkdir}/*")
+			continue
+			;;
+		*/.tkseti*|*.sah)
+			[ -f ${i} ] || continue
+			rm -f ${i}
+			;;
+		*)
+			[ -d ${i} ] || continue
+			for j in ${seti_wrkdir}/*; do
+				case "${j}" in
+				"${seti_wrkdir}/*")
+					continue
+					;;
+				*/.tkseti*|*.sah)
+					[ -f ${j} ] || continue
+					rm -f ${j}
+					;;
+				esac
+			done
+			rmdir ${i}
+			;;
+		esac
+	done
+	rmdir ${seti_wrkdir}
+	if [ -d ${seti_wrkdir} ]; then
+echo "****  SETI@home working directory can't be removed since it contains"
+echo "      non SETI@home files or directories.  You have to remove it"
+echo "      manually.  You can use"
+echo "            rm -rf ${seti_wrkdir}"
+echo "      to do so, but think about it twince before."
+	else
+echo "****  SETI@home working directory and temporary files removed."
+	fi
+	;;
+
+PRE-INSTALL|POST-DEINSTALL)
+	;;
+
+*)
+echo "usage: $0 <PKG_NAME> {PRE-INSTALL|POST-INSTALL|DEINSTALL|POST-DEINSTALL}" >&2
+	exit 1
+	;;
 esac
+
 exit 0
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/pkg-plist,v
retrieving revision 1.4
diff -u -r1.4 pkg-plist
--- pkg-plist	2001/07/04 14:27:55	1.4
+++ pkg-plist	2001/08/21 21:53:58
@@ -1,2 +1,6 @@
-etc/rc.d/setiathome.sh
 sbin/setiathome
+@unexec if cmp -s %D/etc/rc.setiathome.conf %D/etc/rc.setiathome.conf.sample; then rm -f %D/etc/rc.setiathome.conf; fi
+etc/rc.setiathome.conf.sample
+@exec [ -f %D/etc/rc.setiathome.conf ] || cp %D/etc/rc.setiathome.conf.sample %D/etc/rc.setiathome.conf
+etc/rc.d/setiathome.sh
+%%X11PORTS%%bin/xsetiathome
Index: files/setiathome.sh
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/files/setiathome.sh,v
retrieving revision 1.5
diff -u -r1.5 setiathome.sh
--- files/setiathome.sh	2001/07/04 14:27:58	1.5
+++ files/setiathome.sh	2001/08/21 04:34:34
@@ -2,105 +2,145 @@
 #
 # $FreeBSD: ports/astro/setiathome/files/setiathome.sh,v 1.5 2001/07/04 14:27:58 kevlo Exp $
 #
-# Start or stop setiathome, or set up working directory and register
+# Start or stop SETI@home, or set up working directory and register.
 #
 
-# override these variables in ${PREFIX}/etc/setiathome.conf
+rc_file=${0##*/}
+rc_arg=$1
+
+# override these variables in ${PREFIX}/etc/rc.setiathome.conf
 seti_wrkdir=/var/db/setiathome		# primary working directory
-seti_bindir=!!SUBDIR!!			# exec directory relative to ${PREFIX}
-seti_command=setiathome			# command name
 seti_std_args=-email			# command arguments for standard mode
 seti_reg_args=-login			# command arguments for register mode
 seti_proxy_args=			# proxy arguments
 seti_user=nobody			# user id to run as
-seti_nice=1				# nice level to run at
-seti_maxprocs=`sysctl -n hw.ncpu`	# max. number of processes to start
-seti_syslog=daemon.err			# syslog facility.level
+seti_nice=15				# nice level to run at
+seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start
 
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${0##*/}\$"); then
-	echo "${0##*/}: Cannot determine PREFIX." >&2
+if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
+	echo "${rc_file}: Cannot determine PREFIX." >&2
 	echo "Please use the complete pathname." >&2
 	exit 64
 fi
+
+rcconf_dir=${PREFIX}/etc
+rcconf_file=rc.${rc_file%.sh}.conf
+rcconf_path=${rcconf_dir}/${rcconf_file}
 
-if [ -f ${PREFIX}/etc/setiathome.conf ]; then
-	. ${PREFIX}/etc/setiathome.conf
+if [ -f ${rcconf_path} ]; then
+	. ${rcconf_path}
 fi
 
+program_dir=${PREFIX}/sbin
+program_file=setiathome
+program_path=${program_dir}/${program_file}
+
+syslog_facility=daemon.err
+
 i=${seti_maxprocs}
 seti_wrksuff="."
 while [ ${i} -gt 1 ]; do
 	seti_wrksuff="${seti_wrksuff} ${i}"
-	i=`expr ${i} - 1`
+	i=$((${i} - 1))
 done
 
-case $1 in
-	start)
-		for i in ${seti_wrksuff}; do
-			if [ ! -d ${seti_wrkdir}/${i} ]; then
-				logger -sp ${seti_syslog} -t ${seti_command} \
-					"unable to start: ${seti_wrkdir}/${i} is missing."
-				exit 72
-			fi
-			if [ ! -f ${seti_wrkdir}/${i}/user_info.sah ]; then
-				logger -sp ${seti_syslog} -t ${seti_command} \
-					"unable to start: please log in to SETI@home first. (${seti_wrkdir}/${i}/user_info.sah is missing.)"
-				exit 72
-			fi
-		done
-		for i in ${seti_wrksuff}; do
-			su -fm ${seti_user} -c "\
-				(cd ${seti_wrkdir}/${i} && \
-				 exec ${PREFIX}/${seti_bindir}/${seti_command} \
+case "$rc_arg" in
+start)
+	if [ ! -x ${program_path} ]; then
+		logger -sp ${syslog_facility} -t ${program_file} \
+			"unable to start: ${program_path} is missing."
+		exit 72
+	fi
+	for i in ${seti_wrksuff}; do
+		if [ ! -d ${seti_wrkdir}/${i} ]; then
+			logger -sp ${syslog_facility} -t ${program_file} \
+			"unable to start: ${seti_wrkdir}/${i} is missing."
+			exit 72
+		fi
+		if [ ! -f ${seti_wrkdir}/${i}/user_info.sah ]; then
+			logger -sp ${syslog_facility} -t ${program_file} \
+			"unable to start: please log in to SETI@home first" \
+			"(${seti_wrkdir}/${i}/user_info.sah is missing)."
+			logger -sp ${syslog_facility} -t ${program_file} \
+				"run \"$0 register\" to accomplish this."
+			exit 72
+		fi
+	done
+	for i in ${seti_wrksuff}; do
+		su -fm ${seti_user} -c "\
+			(cd ${seti_wrkdir}/${i} && exec ${program_path} \
 				 ${seti_std_args} ${seti_proxy_args} \
 				 ${seti_nice+-nice} ${seti_nice} >/dev/null &)"
-			echo -n " SETI@home"
-		done
-		;;
-
-	stop)
-		killall ${seti_command}
-		;;
-
-	register)
-		# Create or update primary working directory (in case the uid changed)
-		mkdir -p ${seti_wrkdir}
-		chown ${seti_user} ${seti_wrkdir}
-		chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir}
-		seti_dontlogin=no
-		if [ -f ${seti_wrkdir}/user_info.sah ]; then
-			echo "      It seems you have already registered with SETI@home.  Would you like"
-			echo -n "      to repeat the procedure? [Y/n] "
-			read a
-			if [ "X${a}" = "Xn" -o "X${a}" = "XN" ]; then
-				seti_dontlogin=yes
-			fi
-		fi
-		# No need to register if we've already done so
-		if [ "X${seti_dontlogin}" != "Xyes" ]; then
-			su -fm ${seti_user} -c "\
-				cd ${seti_wrkdir} && \
-				exec ${PREFIX}/${seti_bindir}/${seti_command} \
-				${seti_reg_args} ${seti_proxy_args}"
+	done
+	echo -n " SETI@home"
+	;;
+
+stop)
+	for i in ${seti_wrksuff}; do
+		pid_path=${seti_wrkdir}/${i}/pid.sah
+		if [ -f ${pid_path} ]; then
+			kill $(cat ${pid_path}) 2> /dev/null
 		fi
-
-		if [ ${seti_maxprocs} -gt 1 ]; then
-			echo "      Updating additional working directories."
-			i=${seti_maxprocs}
-			while [ ${i} -gt 1 ]; do
-				mkdir -p ${seti_wrkdir}/${i}
-				chown ${seti_user} ${seti_wrkdir}/${i}
-				chmod 755 ${seti_wrkdir}/${i}
-				# Assume the user want's all processes to run with the same registration
-				rm -f ${seti_wrkdir}/${i}/user_info.sah
-				ln -sf ../user_info.sah ${seti_wrkdir}/${i}
-				i=`expr ${i} - 1`
-			done
+	done
+	if [ ! -f ${seti_wrkdir}/pid.sah ]; then
+		killall ${program_file} 2> /dev/null
+	fi
+	;;
+
+restart)
+	$0 stop
+	$0 start
+	;;
+
+status)
+	ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)"
+	;;
+
+register)
+	if [ ! -x ${program_path} ]; then
+		echo "${program_file}:" \
+			"unable to register: ${program_path} is missing." >&2
+		exit 72
+	fi
+	# Create or update primary working directory (in case the uid changed)
+	mkdir -p ${seti_wrkdir}
+	chown ${seti_user} ${seti_wrkdir}
+	chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir}
+	seti_dontlogin=no
+	if [ -f ${seti_wrkdir}/user_info.sah ]; then
+		echo    "      It seems you have already registered with" \
+			"SETI@home.  Would you"
+		echo -n "      like to repeat the procedure? [Y/n] "
+		read a
+		if [ "X${a}" = "Xn" -o "X${a}" = "XN" ]; then
+			seti_dontlogin=yes
 		fi
-		;;		
+	fi
+	# No need to register if we've already done so
+	if [ "X${seti_dontlogin}" != "Xyes" ]; then
+		su -fm ${seti_user} -c "\
+			cd ${seti_wrkdir} && \
+			exec ${program_path} \
+			${seti_reg_args} ${seti_proxy_args}"
+	fi
+	if [ ${seti_maxprocs} -gt 1 ]; then
+		echo "      Updating additional working directories."
+		i=${seti_maxprocs}
+		while [ ${i} -gt 1 ]; do
+			mkdir -p ${seti_wrkdir}/${i}
+			chown ${seti_user} ${seti_wrkdir}/${i}
+			chmod 755 ${seti_wrkdir}/${i}
+			# Assume the user want's all processes to run
+			# with the same registration
+			rm -f ${seti_wrkdir}/${i}/user_info.sah
+			ln -sf ../user_info.sah ${seti_wrkdir}/${i}
+			i=$((${i} - 1))
+		done
+	fi
+	;;		
 
-	*)
-		echo "usage: ${0##*/} {start|stop|register}" >&2
-		exit 64
-		;;
+*)
+	echo "usage: ${rc_file} {start|stop|restart|status|register}" >&2
+	exit 64
+	;;
 esac
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108220010.f7M0ArL89631>