public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] How should I kill a daemon from an ebuild file?
@ 2007-07-27 13:52 Jules Colding
  2007-07-27 14:40 ` [gentoo-dev] " Ali Polatel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jules Colding @ 2007-07-27 13:52 UTC (permalink / raw
  To: Gentoo Dev

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_Ebuilds
# on how to use this ebuild file.
#
# $Header: $

inherit eutils

DESCRIPTION="Brutus Keyring daemon"
HOMEPAGE="http://www.omesc.com/"
SRC_URI="http://www.omesc.com/sites/default/files/downloads/dist/brutus-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 ${BRUTUS_ECONF} || die "econf failed"
        emake || die "emake failed"
}

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


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

-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-dev] Re: How should I kill a daemon from an ebuild file?
  2007-07-27 13:52 [gentoo-dev] How should I kill a daemon from an ebuild file? Jules Colding
@ 2007-07-27 14:40 ` Ali Polatel
  2007-07-27 15:14   ` Mike Frysinger
  2007-07-27 14:51 ` [gentoo-dev] " Jeroen Roovers
  2007-07-27 15:11 ` Mike Frysinger
  2 siblings, 1 reply; 7+ messages in thread
From: Ali Polatel @ 2007-07-27 14:40 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

Jules Colding <colding@omesc.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)

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] How should I kill a daemon from an ebuild file?
  2007-07-27 13:52 [gentoo-dev] How should I kill a daemon from an ebuild file? Jules Colding
  2007-07-27 14:40 ` [gentoo-dev] " Ali Polatel
@ 2007-07-27 14:51 ` Jeroen Roovers
  2007-07-27 15:11 ` Mike Frysinger
  2 siblings, 0 replies; 7+ messages in thread
From: Jeroen Roovers @ 2007-07-27 14:51 UTC (permalink / raw
  To: gentoo-dev

On Fri, 27 Jul 2007 15:52:13 +0200
Jules Colding <colding@omesc.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.gentoo.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-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] How should I kill a daemon from an ebuild file?
  2007-07-27 13:52 [gentoo-dev] How should I kill a daemon from an ebuild file? Jules Colding
  2007-07-27 14:40 ` [gentoo-dev] " Ali Polatel
  2007-07-27 14:51 ` [gentoo-dev] " Jeroen Roovers
@ 2007-07-27 15:11 ` Mike Frysinger
  2 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2007-07-27 15:11 UTC (permalink / raw
  To: gentoo-dev; +Cc: Jules Colding

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] Re: How should I kill a daemon from an ebuild file?
  2007-07-27 14:40 ` [gentoo-dev] " Ali Polatel
@ 2007-07-27 15:14   ` Mike Frysinger
  2007-07-27 16:33     ` Roy Marples
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2007-07-27 15:14 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] Re: How should I kill a daemon from an ebuild file?
  2007-07-27 15:14   ` Mike Frysinger
@ 2007-07-27 16:33     ` Roy Marples
  2007-07-27 17:19       ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Roy Marples @ 2007-07-27 16:33 UTC (permalink / raw
  To: gentoo-dev

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-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] Re: How should I kill a daemon from an ebuild file?
  2007-07-27 16:33     ` Roy Marples
@ 2007-07-27 17:19       ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2007-07-27 17:19 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-07-27 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 13:52 [gentoo-dev] How should I kill a daemon from an ebuild file? Jules Colding
2007-07-27 14:40 ` [gentoo-dev] " Ali Polatel
2007-07-27 15:14   ` Mike Frysinger
2007-07-27 16:33     ` Roy Marples
2007-07-27 17:19       ` Mike Frysinger
2007-07-27 14:51 ` [gentoo-dev] " Jeroen Roovers
2007-07-27 15:11 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox