List Info

Thread: How should I kill a daemon from an ebuild file?




How should I kill a daemon from an ebuild file?
user name
2007-07-27 08:52:13
Hi,

I have an ebuild (see below) for a small keyring daemon. I
would like to
kill the daemon process, if it is running, whenever it is
emerged again
to ensure that no running daemon process refers to an old
install.

Is there a clean and recommended way of doing this in an
ebuild or
should I just use killall in pkg_postinst()?

Or is this ultimately a big no-no??

Thanks,
  jules



#  
# Ebuild file for the Brutus Keyring.
# Copyright (C) 2007 OMC Denmark ApS
#
# This program is free software; you can redistribute it
and/or modify
# it under the terms of the GNU General Public License as
published by
# the Free Software Foundation; either version 2 of the
License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be
useful,
# but WITHOUT ANY WARRANTY; without even the implied
warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
License
# along with this program; if not, write to the Free
Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA 02111-1307 USA
#
# Please see http://gentoo-wiki.com/HOWTO_Installing_3rd_Party_Ebuil
ds
# on how to use this ebuild file.
#
# $Header: $

inherit eutils

DESCRIPTION="Brutus Keyring daemon"
HOMEPAGE="http://www.omesc.com/&quo
t;
SRC_URI="h
ttp://www.omesc.com/sites/default/files/downloads/dist/brutu
s-keyring/Gentoo/brutus-keyring-0.9.3.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"

IUSE="debug"
RESTRICT="nomirror"

DEPEND=">=gnome-base/orbit-2.14.1
        >=dev-libs/libIDL-0.8.5
        >=dev-util/pkgconfig-0.20
        >=dev-libs/libgcrypt-1.2.2
        gnome-base/gnome-common"

DOCS="COPYING README INSTALL docs/brutus-keyring-guide
docs/brutus-keyring-devel-guide"

src_compile() {
        BRUTUS_ECONF="--enable-brutus-dist=yes 
                --enable-brutus-devel=yes 
                --enable-brutus-target=gentoo 
                $(use_enable debug brutus-debug yes)"

        econf $ || die "econf
failed"
        emake || die "emake failed"
}

src_install() {
        emake DESTDIR="$" install || die
"emake install failed"
        dodoc $
}


pkg_postinst() {
        elog "brutus-keyring has been installed"
}

-- 
gentoo-devgentoo.org mailing list


Re: How should I kill a daemon from an ebuild file?
user name
2007-07-27 09:40:22
JULES COLDING <COLDINGOMESC.COM> YAZM??:
> HI,
> 
> I HAVE AN EBUILD (SEE BELOW) FOR A SMALL KEYRING
DAEMON. I WOULD LIKE TO
> KILL THE DAEMON PROCESS, IF IT IS RUNNING, WHENEVER IT
IS EMERGED AGAIN
> TO ENSURE THAT NO RUNNING DAEMON PROCESS REFERS TO AN
OLD INSTALL.
> 
> IS THERE A CLEAN AND RECOMMENDED WAY OF DOING THIS IN
AN EBUILD OR
> SHOULD I JUST USE KILLALL IN PKG_POSTINST()?
> 
> OR IS THIS ULTIMATELY A BIG NO-NO??
> 

HAVE A LOOK AT PKG_SETUP FUNCTIONS IN POSTFIX EBUILDS. THIS
CAN GIVE YOU
AN IDEA ABOUT HOW TO DO IT PROPERLY.

-- 
ALI POLATEL (HAWKING)
Re: How should I kill a daemon from an ebuild file?
user name
2007-07-27 09:51:12
On Fri, 27 Jul 2007 15:52:13 +0200
Jules Colding <coldingomesc.com> wrote:

> Or is this ultimately a big no-no??

I have seen some ebuilds touching "my processes",
usually when it goes
wrong and the ebuild messes up. See for example
<https://bugs.gent
oo.org/129204>.

To me ebuilds should build, install and uninstall packages,
and should
never interfere with the live system when it isn't
necessary, i.e. not
when it's just a matter of convenience.

So yes, to me this is a "big no-no".


Kind regards,
     JeR
-- 
gentoo-devgentoo.org mailing list


Re: How should I kill a daemon from an ebuild file?
user name
2007-07-27 10:11:17
On Friday 27 July 2007, Jules Colding wrote:
> Or is this ultimately a big no-no??

it's a big no-no.  the only thing that is valid is sending a
message to a 
running daemon to tell it that it needs to restart itself.

problems with launching a daemon from an ebuild:
 - inherits bloated portage environment
 - screws up systems when package is:
    - emerged into ROOT != /
    - cross-compiled
    - emerged inside of a chroot

guess i should get this actually documented ...
-mike
Re: Re: How should I kill a daemon from an ebuild file?
user name
2007-07-27 10:14:14
On Friday 27 July 2007, Ali Polatel wrote:
> Have a look at pkg_setup functions in postfix ebuilds.
This can give you
> an idea about how to do it properly.

that isnt half bad, but still not good.  i'd propose you
should actually be 
doing:
/etc/init.d/postgres --quiet status
and using that to determine the state of things

however, that is still incorrect for sure when:
 - ROOT != /
 - cross-compiling
-mike
Re: Re: How should I kill a daemon from an ebuild file?
user name
2007-07-27 11:33:43
On Fri, 2007-07-27 at 11:14 -0400, Mike Frysinger wrote:
> On Friday 27 July 2007, Ali Polatel wrote:
> > Have a look at pkg_setup functions in postfix
ebuilds. This can give you
> > an idea about how to do it properly.
> 
> that isnt half bad, but still not good.  i'd propose
you should actually be 
> doing:
> /etc/init.d/postgres --quiet status
> and using that to determine the state of things

Just to note, baselayout-1 is a little wierd like that as in
it's not
exactly quiet if init script dependencies need to be
updated.

Also, if the rev-bump relies on a new init script then
you're SOL as
it's not etc-updated.

So although what Mike posted is correct, there's also a good
chance It
Just Won't Work (TM)

So that's another argument for no.

Thanks

Roy

-- 
gentoo-devgentoo.org mailing list


Re: Re: How should I kill a daemon from an ebuild file?
user name
2007-07-27 12:19:39
On Friday 27 July 2007, Roy Marples wrote:
> On Fri, 2007-07-27 at 11:14 -0400, Mike Frysinger
wrote:
> > On Friday 27 July 2007, Ali Polatel wrote:
> > > Have a look at pkg_setup functions in postfix
ebuilds. This can give
> > > you an idea about how to do it properly.
> >
> > that isnt half bad, but still not good.  i'd
propose you should actually
> > be doing:
> > /etc/init.d/postgres --quiet status
> > and using that to determine the state of things
>
> Just to note, baselayout-1 is a little wierd like that
as in it's not
> exactly quiet if init script dependencies need to be
updated.

... which will be fixed

> Also, if the rev-bump relies on a new init script then
you're SOL as
> it's not etc-updated.

the check is in pkg_setup, so this isnt an issue ... but
this could easily be 
true for any checking after the package is installed
-mike
[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )