View | Details | Raw Unified | Return to bug 29943 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-33 / +49 lines)
Lines 6-12 Link Here
6
6
7
PORTNAME=	setiathome
7
PORTNAME=	setiathome
8
PORTVERSION=	3.03
8
PORTVERSION=	3.03
9
PORTREVISION=	2
9
PORTREVISION=	3
10
CATEGORIES=	astro
10
CATEGORIES=	astro
11
MASTER_SITES=	ftp://ftp.cdrom.com/pub/setiathome/ \
11
MASTER_SITES=	ftp://ftp.cdrom.com/pub/setiathome/ \
12
		ftp://alien.ssl.berkeley.edu/pub/ \
12
		ftp://alien.ssl.berkeley.edu/pub/ \
Lines 15-29 Link Here
15
DISTNAME=	${PORTNAME}-${PORTVERSION}.${PORT_HOST}
15
DISTNAME=	${PORTNAME}-${PORTVERSION}.${PORT_HOST}
16
EXTRACT_SUFX=	.tar
16
EXTRACT_SUFX=	.tar
17
17
18
MAINTAINER=	clefevre@redirect.to
18
MAINTAINER=	clefevre@citeweb.net
19
19
20
.include <bsd.port.pre.mk>
20
.include <bsd.port.pre.mk>
21
21
22
#
23
# Global variables
22
# Global variables
24
#
23
#
25
24
26
.if !defined(PACKAGE_BUILDING) || empty(PACKAGE_BUILDING)
25
.if !defined(BATCH)
27
IS_INTERACTIVE=	yes
26
IS_INTERACTIVE=	yes
28
.endif
27
.endif
29
28
Lines 38-50 Link Here
38
37
39
EXTRACT_CMD=	${CAT}
38
EXTRACT_CMD=	${CAT}
40
EXTRACT_BEFORE_ARGS=
39
EXTRACT_BEFORE_ARGS=
40
41
STRIP=		# aout is already stripped
41
STRIP=		# aout is already stripped
42
SCRIPTS_ENV+=	PKG_PREFIX=${PREFIX}
42
SCRIPTS_ENV+=	PKG_PREFIX=${PREFIX}
43
SCRIPTS_ENV+=	PACKAGE_BUILDING=${PACKAGE_BUILDING}
43
PLIST_SUB=	X11PORTS=${X11PORTS}
44
44
45
MAN1=		${PORTNAME}.1
45
MAN1=		${PORTNAME}.1
46
46
47
#
47
MSG_FILE=	${PKGDIR}/pkg-message
48
PKGMESSAGE=	${WRKDIR}/pkg-message
49
PKGDEINSTALL=	${PKGINSTALL}
50
48
# Local variables
51
# Local variables
49
#
52
#
50
53
Lines 55-66 Link Here
55
PORT_OS=	${PORT_OSNAME}${PORT_OSREL}
58
PORT_OS=	${PORT_OSNAME}${PORT_OSREL}
56
PORT_HOST=	${PORT_CPU}-${PORT_VENDOR}-${PORT_OS}
59
PORT_HOST=	${PORT_CPU}-${PORT_VENDOR}-${PORT_OS}
57
60
58
SBINSUBDIR?=	sbin
61
SBIN_DIR=	${PREFIX}/sbin
59
RCDSUBDIR=	etc/rc.d
62
CONF_DIR=	${PREFIX}/etc
60
MANSUBDIR=	man
63
RC_DIR=		${PREFIX}/etc/rc.d
61
PROG=		${PORTNAME}
62
SCRIPT=		${PORTNAME}.sh
63
64
65
SAMP_SUFX=	.sample
66
67
BIN_FILE=	setiathome
68
RC_FILES=	setiathome
69
64
# xsetiathome is currently broken at 4.2. should work at 2.x,
70
# xsetiathome is currently broken at 4.2. should work at 2.x,
65
# don't know between 3.0 and 4.2 ? so, be conservative...
71
# don't know between 3.0 and 4.2 ? so, be conservative...
66
# diagnostic messages are :
72
# diagnostic messages are :
Lines 68-127 Link Here
68
#	Floating point exception (core dumped)
74
#	Floating point exception (core dumped)
69
75
70
.if ${OSVERSION} < 300000
76
.if ${OSVERSION} < 300000
71
XBINSUBDIR=	bin
72
XPROG+=		x${PORTNAME}
73
MAN1+=		x${PORTNAME}.1
77
MAN1+=		x${PORTNAME}.1
78
XBIN_DIR=	${PREFIX}/bin
79
XBIN_FILE+=	xsetiathome
80
X11PORTS=
81
.else
82
X11PORTS=	"@comment "
74
.endif
83
.endif
75
84
76
#
85
#
77
# Post-configure
78
#
86
#
79
87
80
post-configure:
88
post-patch: patch-message
81
	@${SED} -e 's.!!SUBDIR!!.${SBINSUBDIR}.g' ${FILESDIR}/${SCRIPT} > ${WRKSRC}/${SCRIPT}
82
89
83
#
90
patch-message:
91
	@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE}
92
84
# Install
93
# Install
85
#
94
#
86
95
87
do-install: install-daemon install-program install-script install-man
96
do-install: install-daemon install-program install-man
88
97
89
install-daemon:
98
install-daemon:
90
	@${INSTALL_PROGRAM} ${WRKSRC}/${PROG} ${PREFIX}/${SBINSUBDIR}
99
	@${INSTALL_PROGRAM} ${WRKSRC}/${BIN_FILE} ${SBIN_DIR}
91
100
92
install-program:
101
install-program:
93
.if defined(XPROG)
102
.if defined(XPROG)
94
	@${INSTALL_PROGRAM} ${WRKSRC}/${prog} ${PREFIX}/${XBINSUBDIR}
103
	@${INSTALL_PROGRAM} ${WRKSRC}/${XBIN_FILE} ${XBIN_DIR}
95
.endif
104
.endif
96
105
97
install-script:
98
	@${INSTALL_SCRIPT} ${WRKSRC}/${SCRIPT} ${PREFIX}/${RCDSUBDIR}
99
100
install-man:
106
install-man:
101
.for mansect in 1
107
.for mansect in 1
102
.for man in ${MAN${mansect}}
108
.for man in ${MAN${mansect}}
103
	@${INSTALL_MAN} ${FILESDIR}/${man} \
109
	@${INSTALL_MAN} ${FILESDIR}/${man} \
104
			${MAN${mansect}PREFIX}/${MANSUBDIR}/man${mansect}
110
			${MAN${mansect}PREFIX}/man/man${mansect}
105
.endfor
111
.endfor
106
.endfor
112
.endfor
107
113
108
#
109
# Post-install
114
# Post-install
110
#
115
#
111
116
112
post-install: update-plist configure-package
117
post-install: install-startup-files configure-package display-message
113
118
114
update-plist:
119
install-startup-files:
115
	@${GREP} -q ${SBINSUBDIR}/${PROG} ${TMPPLIST} || \
120
.for file in ${RC_FILES}
116
	 ${ECHO} ${SBINSUBDIR}/${PROG} >> ${TMPPLIST}
121
.if exists(${FILESDIR}/rc.${file}.conf)
117
.if defined(XPROG)
122
	@${INSTALL_DATA} ${FILESDIR}/rc.${file}.conf \
118
	@${GREP} -q ${XBINSUBDIR}/${XPROG} ${TMPPLIST} || \
123
		${CONF_DIR}/rc.${file}.conf${SAMP_SUFX}
119
	 ${ECHO} ${XBINSUBDIR}/${XPROG} >> ${TMPPLIST}
124
.if !exists(${CONF_DIR}/rc.${file}.conf)
125
	@${INSTALL_DATA} ${FILESDIR}/rc.${file}.conf ${CONF_DIR}
126
.endif
120
.endif
127
.endif
128
.if exists(${FILESDIR}/${file}.sh)
129
	@${INSTALL_SCRIPT} ${FILESDIR}/${file}.sh ${RC_DIR}
130
.endif
131
.endfor
121
132
122
configure-package:
133
configure-package:
123
.if defined(IS_INTERACTIVE)
134
.if !defined(BATCH)
124
	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
135
	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
136
.endif
137
138
display-message:
139
.if !defined(BATCH)
140
	@${CAT} ${PKGMESSAGE}
125
.endif
141
.endif
126
142
127
.include <bsd.port.post.mk>
143
.include <bsd.port.post.mk>
(-)pkg-install (-53 / +128 lines)
Lines 1-66 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
2
#
3
# $FreeBSD$
3
#
4
#
4
# Set up the work area and run setiathome to login or register
5
# Set up the work area and run SETI@home to login or register.
5
#
6
#
7
8
[ $# != 2 ] && exit 1
9
[ -z "${PKG_PREFIX}" ] && exit 1
10
[ -n "${BATCH}" ] && exit 0
11
12
PKG_NAME=$1
13
PKG_ACTION=$2
6
14
7
seti_rcdir=${PKG_PREFIX}/etc/rc.d	# startup directory
15
# override these variables in ${PREFIX}/etc/rc.setiathome.conf
8
seti_script=setiathome.sh		# startup script
9
seti_wrkdir=/var/db/setiathome		# working directory
16
seti_wrkdir=/var/db/setiathome		# working directory
10
seti_user=nobody			# user id to run under
17
seti_user=nobody			# user id to run under
11
seti_maxprocs=`sysctl -n hw.ncpu`	# max. number of processes to start
18
seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start
12
19
13
if [ -f ${PKG_PREFIX}/etc/setiathome.conf ]; then
20
rcconf_dir=${PKG_PREFIX}/etc
14
	. ${PKG_PREFIX}/etc/setiathome.conf
21
rcconf_file=rc.setiathome.conf
15
fi
22
rcconf_path=${rcconf_dir}/${rcconf_file}
16
23
17
case $2 in
24
if [ -f ${rcconf_path} ]; then
18
	POST-INSTALL)
25
	. ${rcconf_path}
19
		if [ -n "${PACKAGE_BUILDING}" ]; then
26
fi
20
			exit 0
21
		fi
22
27
23
		echo "****  setihome requires a working directory for temporary files and"
28
rc_dir=${PKG_PREFIX}/etc/rc.d
24
		echo "      a brief registration process."
29
rc_file=setiathome.sh
25
		echo
30
rc_path=${rc_dir}/${rc_file}
26
		echo "      Would you like to set up a working directory in ${seti_wrkdir},"
31
27
		if [ ${seti_maxprocs} -gt 1 ]; then
32
ncpu=$(sysctl -n hw.ncpu)
28
			if [ `sysctl -n hw.ncpu` -eq ${seti_maxprocs} ]; then
33
29
				echo "      register with SETI@home, and let me arrange for ${seti_maxprocs} setiathome"
34
case "$PKG_ACTION" in
30
				echo "      processes (one for each of your `sysctl -n hw.ncpu` CPUs) to be started automatically"
35
POST-INSTALL)
31
				echo -n "      as user \`${seti_user}' [Y/n]? "
36
32
			else
37
echo "****  SETI@home requires a working directory for temporary files and a"
33
				echo "      register with SETI@home, and let me arrange for ${seti_maxprocs} setiathome"
38
echo "      brief registration process."
34
				echo "      processes (as configured) to be started automatically"
39
echo
35
				echo -n "      as user \`${seti_user}' [Y/n]? "
40
echo "      Would you like to set up a working directory in ${seti_wrkdir},"
36
			fi
41
	if [ ${seti_maxprocs} -gt 1 ]; then
42
echo "      register with SETI@home, and let me arrange for ${ncpu} setiathome"
43
		if [ ${ncpu} -eq ${seti_maxprocs} ]; then
44
echo "      processes (one for each of your ${ncpu} CPUs) to be started"
45
echo -n "      automatically as user \`${seti_user}'? [Y/n] "
37
		else
46
		else
38
			echo "      register with SETI@home, and let me arrange for setiathome to be"
47
echo "      processes (as configured) to be started automatically as user"
39
			echo -n "      started automatically as user \`${seti_user}' [Y/n]? "
48
echo -n "      \`${seti_user}'? [Y/n] "
40
		fi
49
		fi
41
		read a
50
	else
42
		echo ""
51
echo "      register with SETI@home, and let me arrange for setiathome to be"
43
		if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
52
echo -n "      started automatically as user \`${seti_user}'? [Y/n] "
44
			echo ""
53
	fi
45
			echo "Please set up the working directory yourself.  You can use"
54
	read a
46
			echo "${seti_rcdir}/${seti_script} register"
55
echo
47
			echo "to do so. See setiathome(1) for details."
56
	if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
48
			exit 0
57
echo "****  Please set up the working directory yourself.  You may use"
49
		fi
58
echo "            ${rc_path} register"
50
59
echo "      to do so. See setiathome(1) for details."
51
		${seti_rcdir}/${seti_script} register
60
		exit 0
52
61
	fi
53
		if [ ! -f ${seti_wrkdir}/user_info.sah ]; then
62
	${rc_path} register
54
			echo "unable to start setiathome: it seems registration or login failed."
63
	if [ ! -f ${seti_wrkdir}/user_info.sah ]; then
55
			exit 0
64
echo "unable to start setiathome: it seems registration or login failed."
56
		fi
65
echo "See setiathome(1) for details."
57
		${seti_rcdir}/${seti_script} start >/dev/null
66
		exit 0
58
		echo
67
	fi
59
		echo "****  Congratulations!  Your system now participates in the search for extra-"
68
	${rc_path} start > /dev/null
60
		echo "      terrestrial intelligence.  Be sure to visit the home page at"
69
echo
61
		echo "      http://setiathome.ssl.berkeley.edu/"
70
echo "****  Congratulations!  Your system now participates in the search for"
62
		echo "      See setiathome(1) for further details."
71
echo "      extra-terrestrial intelligence.  Be sure to visit the home page"
63
		;;
72
echo "      at http://setiathome.ssl.berkeley.edu/"
64
73
echo "      See setiathome(1) for further details."
74
	;;
75
76
DEINSTALL)
77
	if [ ! -d ${seti_wrkdir} ]; then
78
		exit 0
79
	fi
80
81
	${rc_path} stop > /dev/null
82
83
echo "****  SETI@home working directory and temporary files have to be"
84
echo "      removed to complete the deinstallation process.  Of course,"
85
echo "      you may prefer to keep them for futher researchs?  Would you"
86
echo "      like to remove it as well as all temporary files it may"
87
echo -n "      contains? [y/N] "
88
	read a
89
echo
90
	if [ "X$a" != "XY" -a "X$a" != "Xy" ]; then
91
echo "****  SETI@home working directory and temporary files left untouched."
92
		exit 0
93
	fi
94
	for i in ${seti_wrkdir}/.??* ${seti_wrkdir}/*; do
95
		case "${i}" in
96
		"${seti_wrkdir}/.??*"|"${seti_wrkdir}/*")
97
			continue
98
			;;
99
		*/.tkseti*|*.sah)
100
			[ -f ${i} ] || continue
101
			rm -f ${i}
102
			;;
103
		*)
104
			[ -d ${i} ] || continue
105
			for j in ${seti_wrkdir}/*; do
106
				case "${j}" in
107
				"${seti_wrkdir}/*")
108
					continue
109
					;;
110
				*/.tkseti*|*.sah)
111
					[ -f ${j} ] || continue
112
					rm -f ${j}
113
					;;
114
				esac
115
			done
116
			rmdir ${i}
117
			;;
118
		esac
119
	done
120
	rmdir ${seti_wrkdir}
121
	if [ -d ${seti_wrkdir} ]; then
122
echo "****  SETI@home working directory can't be removed since it contains"
123
echo "      non SETI@home files or directories.  You have to remove it"
124
echo "      manually.  You can use"
125
echo "            rm -rf ${seti_wrkdir}"
126
echo "      to do so, but think about it twince before."
127
	else
128
echo "****  SETI@home working directory and temporary files removed."
129
	fi
130
	;;
131
132
PRE-INSTALL|POST-DEINSTALL)
133
	;;
134
135
*)
136
echo "usage: $0 <PKG_NAME> {PRE-INSTALL|POST-INSTALL|DEINSTALL|POST-DEINSTALL}" >&2
137
	exit 1
138
	;;
65
esac
139
esac
140
66
exit 0
141
exit 0
(-)pkg-plist (-1 / +5 lines)
Lines 1-2 Link Here
1
etc/rc.d/setiathome.sh
2
sbin/setiathome
1
sbin/setiathome
2
@unexec if cmp -s %D/etc/rc.setiathome.conf %D/etc/rc.setiathome.conf.sample; then rm -f %D/etc/rc.setiathome.conf; fi
3
etc/rc.setiathome.conf.sample
4
@exec [ -f %D/etc/rc.setiathome.conf ] || cp %D/etc/rc.setiathome.conf.sample %D/etc/rc.setiathome.conf
5
etc/rc.d/setiathome.sh
6
%%X11PORTS%%bin/xsetiathome
(-)files/setiathome.sh (-76 / +116 lines)
Lines 2-106 Link Here
2
#
2
#
3
# $FreeBSD: ports/astro/setiathome/files/setiathome.sh,v 1.5 2001/07/04 14:27:58 kevlo Exp $
3
# $FreeBSD: ports/astro/setiathome/files/setiathome.sh,v 1.5 2001/07/04 14:27:58 kevlo Exp $
4
#
4
#
5
# Start or stop setiathome, or set up working directory and register
5
# Start or stop SETI@home, or set up working directory and register.
6
#
6
#
7
7
8
# override these variables in ${PREFIX}/etc/setiathome.conf
8
rc_file=${0##*/}
9
rc_arg=$1
10
11
# override these variables in ${PREFIX}/etc/rc.setiathome.conf
9
seti_wrkdir=/var/db/setiathome		# primary working directory
12
seti_wrkdir=/var/db/setiathome		# primary working directory
10
seti_bindir=!!SUBDIR!!			# exec directory relative to ${PREFIX}
11
seti_command=setiathome			# command name
12
seti_std_args=-email			# command arguments for standard mode
13
seti_std_args=-email			# command arguments for standard mode
13
seti_reg_args=-login			# command arguments for register mode
14
seti_reg_args=-login			# command arguments for register mode
14
seti_proxy_args=			# proxy arguments
15
seti_proxy_args=			# proxy arguments
15
seti_user=nobody			# user id to run as
16
seti_user=nobody			# user id to run as
16
seti_nice=1				# nice level to run at
17
seti_nice=15				# nice level to run at
17
seti_maxprocs=`sysctl -n hw.ncpu`	# max. number of processes to start
18
seti_maxprocs=$(sysctl -n hw.ncpu)	# max. number of processes to start
18
seti_syslog=daemon.err			# syslog facility.level
19
19
20
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${0##*/}\$"); then
20
if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
21
	echo "${0##*/}: Cannot determine PREFIX." >&2
21
	echo "${rc_file}: Cannot determine PREFIX." >&2
22
	echo "Please use the complete pathname." >&2
22
	echo "Please use the complete pathname." >&2
23
	exit 64
23
	exit 64
24
fi
24
fi
25
26
rcconf_dir=${PREFIX}/etc
27
rcconf_file=rc.${rc_file%.sh}.conf
28
rcconf_path=${rcconf_dir}/${rcconf_file}
25
29
26
if [ -f ${PREFIX}/etc/setiathome.conf ]; then
30
if [ -f ${rcconf_path} ]; then
27
	. ${PREFIX}/etc/setiathome.conf
31
	. ${rcconf_path}
28
fi
32
fi
29
33
34
program_dir=${PREFIX}/sbin
35
program_file=setiathome
36
program_path=${program_dir}/${program_file}
37
38
syslog_facility=daemon.err
39
30
i=${seti_maxprocs}
40
i=${seti_maxprocs}
31
seti_wrksuff="."
41
seti_wrksuff="."
32
while [ ${i} -gt 1 ]; do
42
while [ ${i} -gt 1 ]; do
33
	seti_wrksuff="${seti_wrksuff} ${i}"
43
	seti_wrksuff="${seti_wrksuff} ${i}"
34
	i=`expr ${i} - 1`
44
	i=$((${i} - 1))
35
done
45
done
36
46
37
case $1 in
47
case "$rc_arg" in
38
	start)
48
start)
39
		for i in ${seti_wrksuff}; do
49
	if [ ! -x ${program_path} ]; then
40
			if [ ! -d ${seti_wrkdir}/${i} ]; then
50
		logger -sp ${syslog_facility} -t ${program_file} \
41
				logger -sp ${seti_syslog} -t ${seti_command} \
51
			"unable to start: ${program_path} is missing."
42
					"unable to start: ${seti_wrkdir}/${i} is missing."
52
		exit 72
43
				exit 72
53
	fi
44
			fi
54
	for i in ${seti_wrksuff}; do
45
			if [ ! -f ${seti_wrkdir}/${i}/user_info.sah ]; then
55
		if [ ! -d ${seti_wrkdir}/${i} ]; then
46
				logger -sp ${seti_syslog} -t ${seti_command} \
56
			logger -sp ${syslog_facility} -t ${program_file} \
47
					"unable to start: please log in to SETI@home first. (${seti_wrkdir}/${i}/user_info.sah is missing.)"
57
			"unable to start: ${seti_wrkdir}/${i} is missing."
48
				exit 72
58
			exit 72
49
			fi
59
		fi
50
		done
60
		if [ ! -f ${seti_wrkdir}/${i}/user_info.sah ]; then
51
		for i in ${seti_wrksuff}; do
61
			logger -sp ${syslog_facility} -t ${program_file} \
52
			su -fm ${seti_user} -c "\
62
			"unable to start: please log in to SETI@home first" \
53
				(cd ${seti_wrkdir}/${i} && \
63
			"(${seti_wrkdir}/${i}/user_info.sah is missing)."
54
				 exec ${PREFIX}/${seti_bindir}/${seti_command} \
64
			logger -sp ${syslog_facility} -t ${program_file} \
65
				"run \"$0 register\" to accomplish this."
66
			exit 72
67
		fi
68
	done
69
	for i in ${seti_wrksuff}; do
70
		su -fm ${seti_user} -c "\
71
			(cd ${seti_wrkdir}/${i} && exec ${program_path} \
55
				 ${seti_std_args} ${seti_proxy_args} \
72
				 ${seti_std_args} ${seti_proxy_args} \
56
				 ${seti_nice+-nice} ${seti_nice} >/dev/null &)"
73
				 ${seti_nice+-nice} ${seti_nice} >/dev/null &)"
57
			echo -n " SETI@home"
74
	done
58
		done
75
	echo -n " SETI@home"
59
		;;
76
	;;
60
77
61
	stop)
78
stop)
62
		killall ${seti_command}
79
	for i in ${seti_wrksuff}; do
63
		;;
80
		pid_path=${seti_wrkdir}/${i}/pid.sah
64
81
		if [ -f ${pid_path} ]; then
65
	register)
82
			kill $(cat ${pid_path}) 2> /dev/null
66
		# Create or update primary working directory (in case the uid changed)
67
		mkdir -p ${seti_wrkdir}
68
		chown ${seti_user} ${seti_wrkdir}
69
		chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir}
70
		seti_dontlogin=no
71
		if [ -f ${seti_wrkdir}/user_info.sah ]; then
72
			echo "      It seems you have already registered with SETI@home.  Would you like"
73
			echo -n "      to repeat the procedure? [Y/n] "
74
			read a
75
			if [ "X${a}" = "Xn" -o "X${a}" = "XN" ]; then
76
				seti_dontlogin=yes
77
			fi
78
		fi
79
		# No need to register if we've already done so
80
		if [ "X${seti_dontlogin}" != "Xyes" ]; then
81
			su -fm ${seti_user} -c "\
82
				cd ${seti_wrkdir} && \
83
				exec ${PREFIX}/${seti_bindir}/${seti_command} \
84
				${seti_reg_args} ${seti_proxy_args}"
85
		fi
83
		fi
86
84
	done
87
		if [ ${seti_maxprocs} -gt 1 ]; then
85
	if [ ! -f ${seti_wrkdir}/pid.sah ]; then
88
			echo "      Updating additional working directories."
86
		killall ${program_file} 2> /dev/null
89
			i=${seti_maxprocs}
87
	fi
90
			while [ ${i} -gt 1 ]; do
88
	;;
91
				mkdir -p ${seti_wrkdir}/${i}
89
92
				chown ${seti_user} ${seti_wrkdir}/${i}
90
restart)
93
				chmod 755 ${seti_wrkdir}/${i}
91
	$0 stop
94
				# Assume the user want's all processes to run with the same registration
92
	$0 start
95
				rm -f ${seti_wrkdir}/${i}/user_info.sah
93
	;;
96
				ln -sf ../user_info.sah ${seti_wrkdir}/${i}
94
97
				i=`expr ${i} - 1`
95
status)
98
			done
96
	ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)"
97
	;;
98
99
register)
100
	if [ ! -x ${program_path} ]; then
101
		echo "${program_file}:" \
102
			"unable to register: ${program_path} is missing." >&2
103
		exit 72
104
	fi
105
	# Create or update primary working directory (in case the uid changed)
106
	mkdir -p ${seti_wrkdir}
107
	chown ${seti_user} ${seti_wrkdir}
108
	chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir}
109
	seti_dontlogin=no
110
	if [ -f ${seti_wrkdir}/user_info.sah ]; then
111
		echo    "      It seems you have already registered with" \
112
			"SETI@home.  Would you"
113
		echo -n "      like to repeat the procedure? [Y/n] "
114
		read a
115
		if [ "X${a}" = "Xn" -o "X${a}" = "XN" ]; then
116
			seti_dontlogin=yes
99
		fi
117
		fi
100
		;;		
118
	fi
119
	# No need to register if we've already done so
120
	if [ "X${seti_dontlogin}" != "Xyes" ]; then
121
		su -fm ${seti_user} -c "\
122
			cd ${seti_wrkdir} && \
123
			exec ${program_path} \
124
			${seti_reg_args} ${seti_proxy_args}"
125
	fi
126
	if [ ${seti_maxprocs} -gt 1 ]; then
127
		echo "      Updating additional working directories."
128
		i=${seti_maxprocs}
129
		while [ ${i} -gt 1 ]; do
130
			mkdir -p ${seti_wrkdir}/${i}
131
			chown ${seti_user} ${seti_wrkdir}/${i}
132
			chmod 755 ${seti_wrkdir}/${i}
133
			# Assume the user want's all processes to run
134
			# with the same registration
135
			rm -f ${seti_wrkdir}/${i}/user_info.sah
136
			ln -sf ../user_info.sah ${seti_wrkdir}/${i}
137
			i=$((${i} - 1))
138
		done
139
	fi
140
	;;		
101
141
102
	*)
142
*)
103
		echo "usage: ${0##*/} {start|stop|register}" >&2
143
	echo "usage: ${rc_file} {start|stop|restart|status|register}" >&2
104
		exit 64
144
	exit 64
105
		;;
145
	;;
106
esac
146
esac

Return to bug 29943