diff options
author | stb <stb@FreeBSD.org> | 1999-04-22 01:44:35 +0000 |
---|---|---|
committer | stb <stb@FreeBSD.org> | 1999-04-22 01:44:35 +0000 |
commit | 76334b9106708e556d6aba10c35ce0594fa0e253 (patch) | |
tree | 87e7a59880b08a5776266af7e2cd598631adcb3e /astro/setiathome/pkg-install | |
parent | c74624a5ca054f00da27ee038721a4cdfbde86e3 (diff) | |
download | FreeBSD-ports-76334b9106708e556d6aba10c35ce0594fa0e253.zip FreeBSD-ports-76334b9106708e556d6aba10c35ce0594fa0e253.tar.gz |
SETI@home - donate idle cycles to the search for aliens
Diffstat (limited to 'astro/setiathome/pkg-install')
-rw-r--r-- | astro/setiathome/pkg-install | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/astro/setiathome/pkg-install b/astro/setiathome/pkg-install new file mode 100644 index 0000000..714e9ea --- /dev/null +++ b/astro/setiathome/pkg-install @@ -0,0 +1,73 @@ +#!/bin/sh + +# +# Set up the work area and run setiathome to login or register +# + +DBDIR=/var/db/setiathome +RCD=${PKG_PREFIX}/etc/rc.d/setiathome.sh +USER=nobody + +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 +esac +EOF + chmod +x ${RCD} + + echo "**** SETI@home requires a working directory for temporary files and" + echo " a brief registration process." + 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 [Y/n]? " + read a + echo "" + if [ "$a" = "N" -o "$a" = "n" ]; then + echo "" + echo "Please set up the working directory yourself. See setiathome(1)" + echo "for details." + exit 0 + fi + + mkdir -p ${DBDIR} + chown ${USER} ${DBDIR} + chmod 755 ${DBDIR} + + su -m nobody -c "cd ${DBDIR} && ${PKG_PREFIX}/bin/setiathome -login" + + if [ ! -f ${DBDIR}/user_info.txt ]; then + echo "unable to start setiathome: it seems registration or login failed." + exit 72 + fi + ${RCD} 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." + ;; + +esac |