ports/51759: Maintainer update: astro/setiathome (manual page fix, etc.)

Cyrille Lefevre cyrille.lefevre at laposte.net
Sun May 4 20:10:27 UTC 2003


>Number:         51759
>Category:       ports
>Synopsis:       Maintainer update: astro/setiathome (manual page fix, etc.)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 04 13:10:16 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Cyrille Lefevre
>Release:        FreeBSD 5.0-RELEASE-p4 i386
>Organization:
ACME
>Environment:
System: FreeBSD gits 5.0-RELEASE-p4 FreeBSD 5.0-RELEASE-p4 #8: Thu Apr 24 19:09:07 CEST 2003 root at gits:/disk3/freebsd/current/obj/disk3/freebsd/current/src/sys/CUSTOM i386
>Description:
	The setiathome manual page refer to setiathome.conf while it is
	now named rc.setiathome.conf. also, the manual page has been
	completed (variables, start/stop scripts, etc.)

	Makefile
		PORTREVISION bumped
	pkg-install
		registration heuristic changed (don't register if already
		registered, then automatically start setiathome in either
		case)
	files/rc.setiathome.conf
		seti_proxy_args changed to seti_proxy_server
		seti_socks_server, seti_socks_user, seti_socks_passwd added
		seti_sleep changed to seti_sleep_time
	files/setiathome.1
		/usr/local changed to %%PREFIX%%
		above and below changes described
	files/setiathome.sh
		same changes as files/rc.setiathome.conf
		su heuristic changed back from sh here-doc to sh -c
		due to unnecessary su process (not seen before)
		gracefull (aka apachectl :) option added using
		stop_after_send.txt
>How-To-Repeat:
	man setiathome
>Fix:

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/Makefile,v
retrieving revision 1.38
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.38 Makefile
--- Makefile	12 Apr 2003 17:07:42 -0000	1.38
+++ Makefile	29 Apr 2003 01:05:10 -0000
@@ -6,7 +6,7 @@
 
 PORTNAME=	setiathome
 PORTVERSION?=	3.03
-PORTREVISION?=	7
+PORTREVISION?=	8
 CATEGORIES?=	astro
 MASTER_SITES=	ftp://ftp.cdrom.com/pub/setiathome/ \
 		ftp://alien.ssl.berkeley.edu/pub/
@@ -17,7 +17,7 @@
 COMMENT?=	Donate idle cycles to the search for space aliens
 
 .if ${PORTVERSION} == "3.03"
-FORBIDDEN=	'Exploitable buffer overflow. http://spoor12.edup.tudelft.nl/'
+#FORBIDDEN=	'Exploitable buffer overflow. http://spoor12.edup.tudelft.nl/'
 .endif
 
 .include <bsd.port.pre.mk>
@@ -125,7 +125,7 @@
 # Post-patch
 #
 
-post-patch: patch-pkgmessage
+post-patch: patch-pkgmessage patch-man
 
 patch-pkgmessage:
 	@${SED} 's|%%PREFIX%%|${PREFIX}|g; \
@@ -133,6 +133,16 @@
 		 s|%%SUFX%%|${PKGNAMESUFFIX}|g' \
 		${MSG_FILE} > ${PKGMESSAGE}
 
+patch-man:
+.for mansect in 1
+.for man in ${MAN${mansect}}
+	@${SED} 's|%%PREFIX%%|${PREFIX}|g; \
+		 s|%%PREFX%%|${PKGNAMEPREFIX}|g; \
+		 s|%%SUFX%%|${PKGNAMESUFFIX}|g' \
+		${FILESDIR}/${man} > ${WRKDIR}/${man}
+.endfor
+.endfor
+
 # Install
 #
 
@@ -151,7 +161,7 @@
 install-man:
 .for mansect in 1
 .for man in ${MAN${mansect}}
-	@${INSTALL_MAN} ${FILESDIR}/${man} \
+	@${INSTALL_MAN} ${WRKDIR}/${man} \
 		${MAN${mansect}PREFIX}/man/man${mansect}
 .endfor
 .endfor
Index: pkg-install
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/pkg-install,v
retrieving revision 1.10
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.10 pkg-install
--- pkg-install	9 Apr 2003 05:02:42 -0000	1.10
+++ pkg-install	29 Apr 2003 02:39:56 -0000
@@ -33,37 +33,54 @@
 
 case "${PKG_ACTION}" in
 POST-INSTALL)
-
+	if [ -f ${seti_wrkdir}/user_info.sah ]; then
+echo "****  SETI at home already has a working directory for temporary files and"
+echo "      you seem to be already registered with SETI at home."
+echo
+echo -n "      Would you like repeat the registration with SETI at home? [y/N] "
+		read ans
+echo
+		if [ "X${ans}" = "XY" -o "X${ans}" = "Xy" ]; then
+			register=yes
+		else
+			register=no
+		fi
+	else
 echo "****  SETI at 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
+		if [ ${seti_maxprocs} -gt 1 ]; then
 echo "      register with SETI at home, and let me arrange for ${ncpu} setiathome"
-		if [ ${ncpu} -eq ${seti_maxprocs} ]; then
+			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
+			else
 echo "      processes (as configured) to be started automatically as user"
 echo -n "      \`${seti_user}'? [Y/n] "
-		fi
-	else
+			fi
+		else
 echo "      register with SETI at home, and let me arrange for setiathome to be"
 echo -n "      started automatically as user \`${seti_user}'? [Y/n] "
-	fi
-	read a
+		fi
+		read ans
 echo
-	if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
+		if [ "X${ans}" = "XN" -o "X${ans}" = "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
+			exit 0
+		else
+			register=yes
+		fi
 	fi
-	${rc_path} register
-	if [ ! -f ${seti_wrkdir}/user_info.sah ]; then
+	if [ "${register}" = "yes" ]; then
+		${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
+			exit 0
+		fi
 	fi
 	${rc_path} start > /dev/null
 echo
Index: files/rc.setiathome.conf
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/files/rc.setiathome.conf,v
retrieving revision 1.5
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.5 rc.setiathome.conf
--- files/rc.setiathome.conf	9 Apr 2003 05:02:42 -0000	1.5
+++ files/rc.setiathome.conf	29 Apr 2003 00:21:50 -0000
@@ -4,11 +4,14 @@
 #
 
 # seti_wrkdir=/var/db/${rc_file%.sh}	# 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=setiathome			# user id to run as
-# seti_group=${seti_user}		# group id to run as
+# seti_std_args=-email			# command line arguments for startup
+# seti_reg_args=-login			# command line arguments to register
+# seti_proxy_server=			# HTTP proxy server (hostname:port)
+# seti_socks_server=			# SOCKS proxy server (hostname:port)
+# seti_socks_user=			# SOCKS proxy user name
+# seti_socks_passwd=			# SOCKS proxy password
+# seti_user=setiathome			# user name to run as
+# seti_group=${seti_user}		# group name to run as
 # seti_nice=15				# nice level to run at
 # seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start
-# seti_sleep=21600			# time to sleep between restarts
+# seti_sleep_time=21600			# time to sleep between restarts
Index: files/setiathome.1
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/files/setiathome.1,v
retrieving revision 1.10
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.10 setiathome.1
--- files/setiathome.1	27 Jan 2001 04:40:33 -0000	1.10
+++ files/setiathome.1	29 Apr 2003 01:03:11 -0000
@@ -118,22 +118,51 @@
 .Fx
 port includes a start-up script that starts
 .Nm
-at system start-up.
+at system start-up and stop it at system shut-down.
+.Ss Stopping setiathome
+There is two way to stop
+.Nm ,
+gracefully (See
+.Pa stop_after_send.txt
+mentioned in
+.Sx FILES
+below) and urgently (using kill as done at system shut-down time).
+To do so, respectively run
+.Pp
+.Dl %%PREFIX%%/etc/rc.d/%%PREFX%%setiathome%%SUFX%%.sh gracefull
+or
+.Dl %%PREFIX%%/etc/rc.d/%%PREFX%%setiathome%%SUFX%%.sh stop
 .Ss Configuration File
 The optional configuration file
-.Pa /usr/local/etc/setiathome.conf
-can contain one or more of the following variable assignments to override
+.Pa %%PREFIX%%/etc/rc.%%PREFX%%setiathome%%SUFX%%.conf
+may contain one or more of the following variable assignments to override
 their default values:
 .Bl -tag -width seti_wrkdir
 .It Pa seti_wrkdir=/var/db/setiathome
 The working directory where
 .Nm
 will store it's temporary files.
-.It Pa seti_user=nobody
+.It Pa seti_std_args=-email and/or -graphics
+The command line arguments for normal start-up.
+.It Pa seti_reg_args=-login
+The command line arguments for registration.
+.It Pa seti_proxy_server=hostname:port
+The HTTP proxy server and port to connect through.
+.It Pa seti_socks_server=hostname:port
+The SOCKS server and port to connect through.
+.It Pa seti_socks_user=username
+The SOCKS user name to connect with.
+.It Pa seti_socks_passwd=password
+The SOCKS password to connect with.
+.It Pa seti_user=setiathome
 The user to run
 .Nm
 as.
-.It Pa seti_nice=1
+.It Pa seti_group=setiathome
+The group to run
+.Nm
+as (only used at registration time).
+.It Pa seti_nice=15
 The
 .Xr nice 1
 value to run
@@ -146,6 +175,10 @@
 Running more than one instance per CPU is not useful, as
 .Nm
 is almost completely CPU-bound.
+.It Pa seti_sleep_time=21600
+The time to sleep (in seconds) between restarts if the
+.Nm
+data server is unresponsive.
 .El
 .Pp
 If you change values in the configuration file, you need to stop and start
@@ -153,9 +186,9 @@
 and possibly reconfigure the working directory for the changes to take
 effect. Run
 .Pp
-.Dl /usr/local/etc/rc.d/setiathome.sh stop
-.Dl /usr/local/etc/rc.d/setiathome.sh register
-.Dl /usr/local/etc/rc.d/setiathome.sh start
+.Dl %%PREFIX%%/etc/rc.d/%%PREFX%%setiathome%%SUFX%%.sh stop
+.Dl %%PREFIX%%/etc/rc.d/%%PREFX%%setiathome%%SUFX%%.sh register
+.Dl %%PREFIX%%/etc/rc.d/%%PREFX%%setiathome%%SUFX%%.sh start
 .Pp
 to do that.
 .Ss Setting up setiathome
@@ -210,10 +243,10 @@
 .El
 .Sh FILES
 .Bl -tag -width /var/db -compact
-.It Pa /usr/local/etc/rc.d/setiathome.sh
+.It Pa %%PREFIX%%/etc/rc.d/%%PREFX%%setiathome%%SUFX%%.sh
 Start-up script.
 .Pp
-.It Pa /usr/local/etc/setiathome.conf
+.It Pa %%PREFIX%%/etc/rc.%%PREFX%%setiathome%%SUFX%%.conf
 Optional configuration file for the start-up script.
 .Pp
 .It Pa /var/db/setiathome/
Index: files/setiathome.sh
===================================================================
RCS file: /home/ncvs/ports/astro/setiathome/files/setiathome.sh,v
retrieving revision 1.11
diff -u -I$Id.*$ -I$.+BSD.*$ -r1.11 setiathome.sh
--- files/setiathome.sh	12 Apr 2003 17:07:42 -0000	1.11
+++ files/setiathome.sh	29 Apr 2003 01:39:11 -0000
@@ -15,14 +15,17 @@
 
 # override these variables in ${PREFIX}/etc/rc.setiathome.conf
 seti_wrkdir=/var/db/${rc_file%.sh}	# 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=setiathome			# user id to run as
-seti_group=${seti_user}			# group id to run as
+seti_std_args=-email			# command line arguments for startup
+seti_reg_args=-login			# command line arguments to register
+seti_proxy_server=			# HTTP proxy server (hostname:port)
+seti_socks_server=			# SOCKS proxy server (hostname:port)
+seti_socks_user=			# SOCKS proxy user name
+seti_socks_passwd=			# SOCKS proxy password
+seti_user=setiathome			# user name to run as
+seti_group=${seti_user}			# group name to run as
 seti_nice=15				# nice level to run at
 seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start
-seti_sleep=21600			# time to sleep between restarts
+seti_sleep_time=21600			# time to sleep between restarts
 
 if ! PREFIX=$(expr ${rc_path} : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
 	echo "${rc_file}: Cannot determine PREFIX." >&2
@@ -74,19 +77,27 @@
 		fi
 	done
 	for i in ${seti_wrksuff}; do
-		su -fm ${seti_user} -c "exec /bin/sh -T" << EOF > /dev/null &
-			cd ${seti_wrkdir}/${i} || exit
-			echo \$\$ > shpid.sah
-			trap 'kill \$pid;exit' 15
-			while :; do
+		su -fm ${seti_user} -c "exec /bin/sh -cT \"
+			cd ${seti_wrkdir}/${i} || exit; \
+			trap 'kill \\\$pid;exit' 15; \
+			while :; do \
+				echo \\\$\\\$ > shpid.sah; \
 				${program_path} \
-					${seti_std_args} ${seti_proxy_args} \
-					${seti_nice:+-nice} ${seti_nice} &
-				pid=\$!; wait \$pid
-				sleep ${seti_sleep} &
-				pid=\$!; wait \$pid
-			done
-EOF
+					${seti_std_args} \
+					${seti_proxy_server:+-proxy} \
+						${seti_proxy_server} \
+					${seti_socks_server:+-socks_server} \
+						${seti_socks_server} \
+					${seti_socks_user:+-socks_user} \
+						${seti_socks_user} \
+					${seti_socks_passwd:+-socks_passwd} \
+						${seti_socks_passwd} \
+					${seti_nice:+-nice} ${seti_nice} & \
+				pid=\\\$!; wait \\\$pid; \
+				[ -f stop_after_send.txt ] && break; \
+				sleep ${seti_sleep_time} & \
+				pid=\\\$!; wait \\\$pid; \
+			done\" > /dev/null &"
 	done
 	echo -n " SETI at home"
 	;;
@@ -105,6 +116,16 @@
 	fi
 	;;
 
+gracefull)
+	for i in ${seti_wrksuff}; do
+		pid_path=${seti_wrkdir}/${i}/pid.sah
+		stop_path=${seti_wrkdir}/${i}/stop_after_send.txt
+		if [ -f ${pid_path} ]; then
+			touch ${stop_path}
+		fi
+	done
+	;;
+
 restart)
 	$0 stop
 	$0 start
@@ -187,7 +208,7 @@
 	;;		
 
 *)
-	echo "usage: ${rc_file} {start|stop|restart|status|register}" >&2
+	echo "usage: ${rc_file} {start|stop|gracefull|restart|status|register}" >&2
 	exit 64
 	;;
 esac
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list