Subject: pkg/18361: rc.d script for setiathome
To: None <gnats-bugs@gnats.netbsd.org>
From: Julio Merino <jmmv@hispabsd.org>
List: netbsd-bugs
Date: 09/21/2002 14:31:56
>Number: 18361
>Category: pkg
>Synopsis: rc.d script for setiathome
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Sep 21 05:32:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Julio Merino
>Release: NetBSD 1.6H
>Organization:
HispaBSD
>Environment:
System: NetBSD darkstar.local 1.6H NetBSD 1.6H (DARKSTAR) #16: Fri Sep 20 11:10:50 CEST 2002 jmmv@darkstar.local:/var/build/kernel/DARKSTAR i386
Architecture: i386
Machine: i386
>Description:
The package misc/setiathome does not currently provide a startup
script (rc.d). It is interesting to have one, to make things very
simple to the end-user. If you have to configure it by hand, it
can be tricky, so this new script helps you doing so.
What this script does is configure a system-wide setiathome
directory, running as an unpriviledged user. The first time you
run the script, it configures your account and then starts
the setiathome client in its own directory.
The user chosen to run setiathome is `nobody'... but maybe this
should be changed to a new user `setiathome' and request the
administrator to create it before running the program. Do what
you think better.
I've also modified the MESSAGE to note this script.
>How-To-Repeat:
>Fix:
First, apply the patch to the current sources:
Index: MESSAGE
===================================================================
RCS file: /cvsroot/pkgsrc/misc/setiathome/MESSAGE,v
retrieving revision 1.1
diff -u -u -r1.1 MESSAGE
--- MESSAGE 2001/11/01 01:29:33 1.1
+++ MESSAGE 2002/09/21 12:25:40
@@ -4,6 +4,11 @@
Please note - you should really mkdir and cd into a new directory before
running setiathome (to avoid cluttering up your homedir).
+The other possibility is to use the provided "setiathome" rc.d script
+which will start SETI@home on system bootup as an unpriviledged user,
+using /var/db/setiathome as its home. The first time you use this script
+the configuration utility will appear to manually configure your account.
+
Also, please consider joining the NetBSD team:
http://setiathome.ssl.berkeley.edu/cgi-bin/cgi?cmd=team_lookup&name=NetBSD
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/misc/setiathome/Makefile,v
retrieving revision 1.8
diff -u -u -r1.8 Makefile
--- Makefile 2001/10/01 15:52:05 1.8
+++ Makefile 2002/09/21 12:25:40
@@ -4,26 +4,27 @@
.include "../../mk/bsd.prefs.mk"
#
.if ${OPSYS} == "SunOS" && ${MACHINE_ARCH} == "sparc"
-DISTNAME= ${PKGNAME}.sparc-sun-solaris2.6
+DISTNAME= ${PKGNAME_NOREV}.sparc-sun-solaris2.6
#
.elif (${MACHINE_ARCH} == "alpha")
-DISTNAME= ${PKGNAME}.alpha-unknown-netbsd1.4
+DISTNAME= ${PKGNAME_NOREV}.alpha-unknown-netbsd1.4
#
.elif (${MACHINE_ARCH} == "i386")
-DISTNAME= ${PKGNAME}.i386-unknown-netbsd1.3
+DISTNAME= ${PKGNAME_NOREV}.i386-unknown-netbsd1.3
#
.elif (${MACHINE_ARCH} == "powerpc")
-DISTNAME= ${PKGNAME}.powerpc-unknown-netbsd1.4
+DISTNAME= ${PKGNAME_NOREV}.powerpc-unknown-netbsd1.4
#
# XXX Not yet on ftp site
.elif (${MACHINE_ARCH} == "sparc")
-DISTNAME= ${PKGNAME}.sparc-unknown-netbsd1.4
+DISTNAME= ${PKGNAME_NOREV}.sparc-unknown-netbsd1.4
#
.else
-DISTNAME= ${PKGNAME}
+DISTNAME= ${PKGNAME_NOREV}
.endif
#
PKGNAME= setiathome-3.03
+PKGREVISION= 1
CATEGORIES= misc
MASTER_SITES= ftp://ftp.cdrom.com/pub/setiathome/ \
ftp://alien.ssl.berkeley.edu/pub/ \
@@ -40,9 +41,12 @@
DECOMPRESS_CMD= ${CAT}
NO_BUILD= yes
+RCD_SCRIPTS= setiathome
+
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/setiathome ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/xsetiathome ${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/README ${PREFIX}/man/cat1/setiathome.0
+.include "../../mk/bsd.pkg.install.mk"
.include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/misc/setiathome/PLIST,v
retrieving revision 1.1
diff -u -u -r1.1 PLIST
--- PLIST 2001/11/01 01:29:33 1.1
+++ PLIST 2002/09/21 12:25:40
@@ -1,4 +1,5 @@
@comment $NetBSD: PLIST,v 1.1 2001/11/01 01:29:33 zuntum Exp $
bin/setiathome
bin/xsetiathome
+etc/rc.d/setiathome
man/cat1/setiathome.0
And now import this new file as `setiathome.sh' inside a new
`files' subdirectory:
#!/bin/sh
#
# $NetBSD$
#
# PROVIDE: setiathome
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
sah_user="nobody"
sah_group="nobody"
sah_homedir="/var/db/setiathome"
name="setiathome"
rcvar=$name
command="/usr/pkg/bin/${name}"
pidfile="${sah_homedir}/pid.sah"
extra_commands="config"
setiathome_config() {
if [ ! -d ${sah_homedir} ]; then
mkdir ${sah_homedir}
chmod 755 ${sah_homedir}
chown ${sah_user}:${sah_group} ${sah_homedir}
fi
su -fm ${sah_user} -c "cd ${sah_homedir} && exec ${command} -login"
return 0
}
setiathome_start() {
if [ ! -f ${sah_homedir}/key.sah ]; then
run_rc_command config
fi
echo "Starting ${name}."
su -fm ${sah_user} -c "cd ${sah_homedir} && exec ${command} \
${command_args} &" 2>/dev/null 1>/dev/null
}
setiathome_poststop() {
rm -f ${sah_homedir}/pid.sah
}
config_cmd=setiathome_config
start_cmd=setiathome_start
stop_postcmd=setiathome_poststop
load_rc_config $name
run_rc_command "$1"
Thank you!
>Release-Note:
>Audit-Trail:
>Unformatted: