summaryrefslogtreecommitdiff
path: root/astro/setiathome/pkg-install
diff options
context:
space:
mode:
authorStefan Bethke <stb@FreeBSD.org>1999-05-18 22:40:35 +0000
committerStefan Bethke <stb@FreeBSD.org>1999-05-18 22:40:35 +0000
commit649d8f8c9430bc0485cbc6dda54a16bf3b8c4edd (patch)
tree0cadb57250c4c7c038454d686263b358e21ad0cc /astro/setiathome/pkg-install
parentAdd WWW: (diff)
- Added support for SMP systems to etc/rc.d/setiathome.sh
- Added etc/setiathome.conf with options to set the nice level, the max. number of processes to run, the working directory, and the the user id to run as. - setiathome.1 was missing from Makefile (and +CONTENTS subsequently) - Updated the man page to reflect the changes.
Notes
Notes: svn path=/head/; revision=18877
Diffstat (limited to 'astro/setiathome/pkg-install')
-rw-r--r--astro/setiathome/pkg-install67
1 files changed, 26 insertions, 41 deletions
diff --git a/astro/setiathome/pkg-install b/astro/setiathome/pkg-install
index 8d5edd96ebc1..bcf6e0053a7b 100644
--- a/astro/setiathome/pkg-install
+++ b/astro/setiathome/pkg-install
@@ -6,58 +6,42 @@
DBDIR=/var/db/setiathome
RCD=${PKG_PREFIX}/etc/rc.d/setiathome.sh
-USER=nobody
+seti_wrkdir=/var/db/setiathome # working directory
+seti_user=nobody # user id to run under
+seti_nice=1 # nice level to run at
+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
case $2 in
POST-INSTALL)
- rm -f ${RCD}
- cat <<EOF >${RCD}
-#!/bin/sh
-
-PREFIX=${PKG_PREFIX}
-DBDIR=${DBDIR}
-USER=${USER}
-
-case \$1 in
- start)
- if [ ! -d \${DBDIR} ]; then
- logger -sp user.err -t setiathome "unable to start: \${DBDIR} is missing."
- exit 72
- fi
- if [ ! -f \${DBDIR}/user_info.txt ]; then
- logger -sp user.err -t setiathome "unable to start: please log in to SETI@home first."
- exit 72
- fi
- su -m \${USER} -c \
- "(cd \${DBDIR} && exec \${PREFIX}/bin/setiathome -email >/dev/null &)"
- echo -n " SETI@home"
- ;;
- stop)
- killall setiathome
- ;;
- register)
- mkdir -p \${DBDIR}
- chown \${USER} \${DBDIR}
- chmod 755 \${DBDIR}
-
- su -m nobody -c "cd \${DBDIR} && \${PREFIX}/bin/setiathome -login"
- ;;
-esac
-EOF
- chmod +x ${RCD}
-
if [ -n "${PACKAGE_BUILDING}" ]; then
exit 0
fi
- echo "**** SETI@home requires a working directory for temporary files and"
+ 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 ${DBDIR},"
- echo " register with SETI@home, and let me arrange for SETI@home to be"
- echo -n " started automatically as user \`nobody' [Y/n]? "
+ 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
+ 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 [ "$a" = "N" -o "$a" = "n" ]; then
+ if [ "X$a" = "XN" -o "X$a" = "Xn" ]; then
echo ""
echo "Please set up the working directory yourself. You can use"
echo "${RCD} register"
@@ -80,3 +64,4 @@ EOF
;;
esac
+exit 0