Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 928 - daemontools-0.76-r2.build (improved)
Summary: daemontools-0.76-r2.build (improved)
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Thilo Bangert (RETIRED) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-02 09:26 UTC by Thilo Bangert (RETIRED) (RETIRED)
Modified: 2002-05-06 18:20 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2002-03-02 09:26:05 UTC
Hi,
the improvment: so far $SVCDIR is defined in /etc/init.d/functions.sh - this i believe is from the 
time where /etc/conf.d/ not yet existed.
the new version makes a /etc/conf.d/svscan which sets $SVCDIR.
some improvements to the startup script are included as well...
it's probably not a good idea to remove $SVCDIR from functions.sh right now...
the next djbdns ebuild gontran@gontran.net and i are working on (see gentoo-dev) will include 
setup scripts that might already depend on SVCDIR being in /etc/conf.d/svscan..
greetings
Thilo
==
daemontools-0.76-r2.build
====================
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Maintainer: Geert Bevin <gbevin@theleaf.be>
# /space/gentoo/cvsroot/gentoo-x86/sys-apps/daemontools/daemontools-0.76-r1.ebuild,v 1.2 
2001/12/31 23:47:55 azarah Exp

S=${WORKDIR}/admin/${P}
DESCRIPTION="Collection of tools for managing UNIX services"
SRC_URI="http://cr.yp.to/daemontools/${P}.tar.gz"
HOMEPAGE="http://cr.yp.to/daemontools.html"

DEPEND="virtual/glibc"

src_unpack() {

	unpack ${A}

	cd ${S}
	echo "gcc ${CFLAGS}" > src/conf-cc
	echo "gcc" > src/conf-ld
	echo ${S} > src/home
}

src_compile() {

	cd ${S}/src
	emake || die
}

src_install() {

	einfo "Installing package ..."
	cd ${S}/src
	exeinto /usr/bin
	for x in `cat ../package/commands`
	do
		doexe $x
	done
	dodoc CHANGES ../package/README TODO

	einfo "Installing the svscan startup file ..."
	exeinto /etc/init.d
	newexe ${FILESDIR}/svscan-r2 svscan

	insinto /etc/conf.d
	newins ${FILESDIR}/svscan.conf.d svscan
}

pkg_postinst() {

	echo
	einfo "Please configure svscan in /etc/conf.d/svscan!"
	echo
}
==
files/digest-daemontools-0.76-r2
===================
MD5 1871af2453d6e464034968a0fbcb2bfc daemontools-0.76.tar.gz 36975
==
files/svscan-r2 (new startupscript)
===================
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# /space/gentoo/cvsroot/gentoo-x86/sys-apps/daemontools/files/svscan,v 1.2 2001/12/06 
20:17:02 azarah Exp

#NB: config is in /etc/conf.d/svscan

depend() {
    need net
}

start() {

    if [ ! -e /service  ]
    then
	einfo "Creating service directory ( /service )..."
	mkdir /service
    fi    
    
    ebegin "Starting service scan ..."
    PATH="/usr/bin:$PATH"
    cd /service
    start-stop-daemon --start --quiet --exec /usr/bin/svscan -- &
    echo $! > /var/run/svscan.pid
    eend $?
}

stop() {
    ebegin "Stopping service scan ..."
    start-stop-daemon --stop --quiet --pid /var/run/svscan.pid
    eend $?

    if [ -e /service/* ]
    then
        ebegin "Stopping services ..."
	svc -dx /service/*
        eend $?
	
        ebegin "Stopping service logging ..."
	svc -dx /service/*/log
        eend $?
    fi
}
==
files/svscan.conf.d
============
#Supervise Dir
# the directory where services are installed
# and then linked to /service
# SVCDIR=/var/lib/supervise #default

SVCDIR=/var/lib/supervise
Comment 1 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2002-03-04 05:11:09 UTC
i am not sure if i understood SVCDIR's function correctly, but SVCDIR=/service would be a lot 
better
Thilo
Comment 2 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2002-03-04 05:13:57 UTC
and then, most of this would need reworked again :-(
i am sorry... but i could do that if you want me too
Thilo
Comment 3 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2002-03-07 18:49:55 UTC
Hi,
okay - now for the real thing!
this defines SVCDIR to be /service (this is how it is now) - it also uses SVCDIR in the startup 
scripts effectivly making it configurable
what is SVCDIR in /etc/init.d/functions.sh good for anyway????
==
daemontools-0.76-r2.ebuild
===========
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Maintainer: Geert Bevin <gbevin@theleaf.be>
# /space/gentoo/cvsroot/gentoo-x86/sys-apps/daemontools/daemontools-0.76-r1.ebuild,v 1.2 
2001/12/31 23:47:55 azarah Exp

S=${WORKDIR}/admin/${P}
DESCRIPTION="Collection of tools for managing UNIX services"
SRC_URI="http://cr.yp.to/daemontools/${P}.tar.gz"
HOMEPAGE="http://cr.yp.to/daemontools.html"

DEPEND="virtual/glibc"

src_unpack() {

        unpack ${A}

        cd ${S}
        echo "gcc ${CFLAGS}" > src/conf-cc
        echo "gcc" > src/conf-ld
        echo ${S} > src/home
}

src_compile() {

        cd ${S}/src
        emake || die
}

src_install() {

        einfo "Installing package ..."
        cd ${S}/src
        exeinto /usr/bin
        for x in `cat ../package/commands`
        do
                doexe $x
        done
        dodoc CHANGES ../package/README TODO

        einfo "Installing the svscan startup file ..."
        exeinto /etc/init.d
        newexe ${FILESDIR}/svscan-r2 svscan

        insinto /etc/conf.d
        newins ${FILESDIR}/svscan.conf.d svscan
}

pkg_postinst() {

        echo
        einfo "Please configure daemontools in /etc/conf.d/svscan!"
        echo
}
==
files/svscan.conf.d
==============
#Supervise Dir
# the directory where services are installed
# and then linked to /service
# SVCDIR=/service #default

SVCDIR=/service
==
files/svscan.rc
=========
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# /space/gentoo/cvsroot/gentoo-x86/sys-apps/daemontools/files/svscan,v 1.2 2001/12/06
20:17:02 azarah Exp

#NB: config is in /etc/conf.d/svscan

depend() {
    need net
}

start() {

    if [ ! -e $SVCDIR  ]
    then
        einfo "Creating service directory ( $SVCDIR )..."
        mkdir $SVCDIR
    fi

    ebegin "Starting service scan ..."
    PATH="/usr/bin:$PATH"
    cd $SVCDIR
    start-stop-daemon --start --quiet --exec /usr/bin/svscan -- &
    echo $! > /var/run/svscan.pid
    eend $?
}

stop() {
    ebegin "Stopping service scan ..."
    start-stop-daemon --stop --quiet --pid /var/run/svscan.pid
    eend $?

    if [ -e ${SVCDIR}/* ]
    then
        ebegin "Stopping services ..."
        svc -dx ${SVCDIR}/*
        eend $?

        ebegin "Stopping service logging ..."
        svc -dx ${SVCDIR}/*/log
        eend $?
    fi
}
=======