Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 196294 - Support for service scripts in baselayout-prefix
Summary: Support for service scripts in baselayout-prefix
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: x86 OS X
: High normal with 3 votes (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords: Goal
Depends on: 196292 360855 360917
Blocks:
  Show dependency tree
 
Reported: 2007-10-18 14:45 UTC by Dirk Tilger
Modified: 2022-09-05 12:40 UTC (History)
8 users (show)

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


Attachments
patch to the ebuild to add two patches and reactivate commented out portions (baselayout-prefix-1.12.5-r4.ebuild.diff,1.54 KB, patch)
2007-10-18 14:48 UTC, Dirk Tilger
Details | Diff
Patch to the source distribution comming with the baselayout-prefix (baselayout-1.12.5-src.patch,3.88 KB, patch)
2007-10-18 14:55 UTC, Dirk Tilger
Details | Diff
Patch to certain shell scripts for the prefixed portage (baselayout-1.12.5-sh.patch,8.27 KB, patch)
2007-10-18 14:58 UTC, Dirk Tilger
Details | Diff
Updated patch to the baselayout-prefix ebuild (baselayout-prefix-1.12.5-r4.ebuild.diff,1.86 KB, patch)
2007-10-18 15:35 UTC, Dirk Tilger
Details | Diff
Updated shell script patch to contain only things related to prefixed portage (baselayout-1.12.5-sh.patch,7.98 KB, patch)
2007-10-18 15:37 UTC, Dirk Tilger
Details | Diff
Updated source distrib patch to only contain things related to prefixed portage (non-Linux specific stuff taken out) (baselayout-1.12.5-src.patch,3.54 KB, patch)
2007-10-18 15:38 UTC, Dirk Tilger
Details | Diff
Patch against the runleven related scripts to replace /bin/pidof if it doesn't exist (baselayout-1.12.5-pidof.patch,513 bytes, patch)
2007-10-18 15:39 UTC, Dirk Tilger
Details | Diff
Disable building 'consoletype' application on non-Linux systems (baselayout-1.12.5-no-consoletype.patch,343 bytes, patch)
2007-10-18 15:40 UTC, Dirk Tilger
Details | Diff
Updated patch against baselayout-prefix (baselayout-prefix-1.12.5-r6.ebuild.diff,2.14 KB, patch)
2009-05-03 19:05 UTC, Dirk Tilger
Details | Diff
Refactured pidof patch (baselayout-1.12.5-pidof.patch,438 bytes, patch)
2009-05-03 19:10 UTC, Dirk Tilger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Tilger 2007-10-18 14:45:42 UTC
The attached patches are an attempt to get the service scripts working in the prefixed portage. Besides patches to the baselayout-prefix, patches to the individual service scripts would be required. I have been testing with the apache service scripts that have been contributed earlier.

Some patches have some implications. These implications are documented with the patch (if the patch got updated, then with the initial contribution of it ;).
Comment 1 Dirk Tilger 2007-10-18 14:48:04 UTC
Created attachment 133760 [details, diff]
patch to the ebuild to add two patches and reactivate commented out portions

This is the patch to the ebuild. It adds application of two patches and reactivates commented out portions.
Comment 2 Dirk Tilger 2007-10-18 14:55:19 UTC
Created attachment 133761 [details, diff]
Patch to the source distribution comming with the baselayout-prefix

This patch adds the @GENTOO_PORTAGE_EPREFIX@ to all filesystem locations. It also patches the Makefile to exclude the "consoletype" application. This application uses Linux specific logic to determine the nature of a terminal device and makes use of Linux specific headers as part of that magic.

The Makefile modification may sit better in a separate patch that is activated on non-Linux architectures only.
Comment 3 Dirk Tilger 2007-10-18 14:58:01 UTC
Created attachment 133762 [details, diff]
Patch to certain shell scripts for the prefixed portage

This patch adds @GENTOO_PORTAGE_EPREFIX@ to filesystem locations.
Comment 4 Dirk Tilger 2007-10-18 15:35:49 UTC
Created attachment 133766 [details, diff]
Updated patch to the baselayout-prefix ebuild

Just thought again about everything. 
The updated ebuild contains Darwin (and possibly other systems) specifc /bin/pidof replacement separately.
The updated ebuild contains non-Linux tool deactivation patch separetely.
Comment 5 Dirk Tilger 2007-10-18 15:37:23 UTC
Created attachment 133767 [details, diff]
Updated shell script patch to contain only things related to prefixed portage
Comment 6 Dirk Tilger 2007-10-18 15:38:48 UTC
Created attachment 133768 [details, diff]
Updated source distrib patch to only contain things related to prefixed portage (non-Linux specific stuff taken out)
Comment 7 Dirk Tilger 2007-10-18 15:39:37 UTC
Created attachment 133770 [details, diff]
Patch against the runleven related scripts to replace /bin/pidof if it doesn't exist
Comment 8 Dirk Tilger 2007-10-18 15:40:24 UTC
Created attachment 133772 [details, diff]
Disable building 'consoletype' application on non-Linux systems
Comment 9 Dirk Tilger 2007-10-18 15:43:35 UTC
For the service script to work (at least on Darwin), the patches from bug 196292 have to be applied.
Comment 10 Fabian Groffen gentoo-dev 2007-11-09 13:44:24 UTC
Hmmm... so what needs to be applied when and where now?
Comment 11 Dirk Tilger 2007-11-10 00:39:33 UTC
(In reply to comment #10)
> Hmmm... so what needs to be applied when and where now?

You apply the ebuild patch on the ebuild and put the remaining ones in ${FILESDIR}
Comment 12 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2007-12-31 21:01:00 UTC
This looks promising..Will these patches be in soon or should I create an overlay to test em out?
Comment 13 Fabian Groffen gentoo-dev 2007-12-31 21:03:10 UTC
new year's resolution: let's look at it, would be cool to have it.
Comment 14 Elias Pipping (RETIRED) gentoo-dev 2008-01-01 14:42:09 UTC
in baselayout-1.12.5-pidof.patch, how about replacing this:

+	eval ps -Ao 'pid,command'|grep "^ *[0-9]* *${args}"|sed 's!^ *\([0-9]*\) .*$!\1!'|xargs echo -n

with

+	ps -Ao 'pid,command' | gawk -v args="${args}" '$0 == $1 FS args {buf=buf " " $1} END {print substr(buf,2)}'

which only uses one pipe (to gawk) instead of three (to grep, sed, xargs echo), should perform better and is much clearer.
Comment 15 Elias Pipping (RETIRED) gentoo-dev 2008-01-01 15:59:00 UTC
this would work as well:

ps -Ao 'pid,command' | sed -n "/^ *[0-9]\+ ${args}/p" | cut -d " " -f 1 | xargs echo -n
Comment 16 Fabian Groffen gentoo-dev 2008-01-01 16:03:04 UTC
I don't want to spoil the fun, but...

solaris% ps -Ao 'pid,command'
ps: unknown output format: -o command
usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]
        [ -u userlist ] [ -U userlist ] [ -G grouplist ]
        [ -p proclist ] [ -g pgrplist ] [ -s sidlist ] [ -z zonelist ]
  'format' is one or more of:
        user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid
        pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid
        f s c lwp nlwp psr tty addr wchan fname comm args projid project pset

(I'd love to have GNU ps on Solaris, but it doesn't compile...)
Comment 17 Elias Pipping (RETIRED) gentoo-dev 2008-01-01 19:50:48 UTC
pid, comm and args are recognized but treated very much differently on solaris and darwin. on solaris, args is the command and the arguments, whereas on darwin args is only the arguments

macbook% ps -o 'args'         
-f =default
maddison% ps -o 'args'
ps -o args

what is exactly the same though, is the behavior of COMM

maddison% ps -o 'comm'
/usr/bin/zsh
macbook% ps -o 'comm'
/g/bin/zsh

soo.... `ps -o 'pid,comm' should work, the question is what we're supporting at the point -- can ${args} only hold '/bin/zsh' or '/bin/zsh -l' as well? because in the latter case we'd have to thing of something...
Comment 18 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-01-02 16:17:12 UTC
(In reply to comment #17)
> macbook% ps -o 'args'         
> -f =default
> maddison% ps -o 'args'
> ps -o args
> 
> what is exactly the same though, is the behavior of COMM
> 
> maddison% ps -o 'comm'
> /usr/bin/zsh
> macbook% ps -o 'comm'
> /g/bin/zsh

I don't think that will work right on linux, if I am reading the bug correctly.

% ps -o 'args'
COMMAND
-bash
ps -o args

% ps -o 'comm'
COMMAND
bash
ps

% ps -o 'command'
COMMAND
-bash
ps -o command

However, I did play around with linux and solaris and instead of "ps -Ao 'pid,command'" in the original patch, you will get the correct results if you put "ps -Ao 'pid,args'" in there instead. This also solves grobian's problem in comment #16. Can someone confirm this for me so I am not confused.
Comment 19 Dirk Tilger 2009-05-03 19:05:46 UTC
Created attachment 190244 [details, diff]
Updated patch against baselayout-prefix

Just merged the latest modifications to the ebuild into the file.

Since quite a while there's a pidof tool in the prefix tree and this ebuild depends on it to get rid of some of the problems that were uncovered by Pipping back then. I'm not up to date what the correct way is to depend on an architecture, but I suspect this patch will have to see a few more generations anyways.
Comment 20 Dirk Tilger 2009-05-03 19:10:23 UTC
Created attachment 190245 [details, diff]
Refactured pidof patch

Here we basically keep the old behaviour. We're having a pidof tool in place now through bsd-pidof.
Comment 21 Dirk Tilger 2009-05-03 19:20:46 UTC
We had this discussion the other day on the gentoo-alt ML about startup scripts:
http://comments.gmane.org/gmane.linux.gentoo.alt/4871

I thought a good approach to get baselayout-prefix ahead without requiring time from the developer end in the beginning might be to give this modified version a minor version bump in the prefix tree (i.e. baselayout-prefix-1.12.6-r6.1). We hard mask the package with a comment pointing to this bug. That should make sure nobody gets surprised by a beta level ebuild. Whoever wants to use it mounts the offroad bumpers, unmasks and emerges it.

Any bugs we report back here. That would allow some folks to test it on MacOS, some other folks to test it on Solaris, on IRIX and on the toaster. When one platform according to the reports appears somewhat stable and the Gentoo developers can't prove it wrong either, we unmask it and live happily thereafter.
Comment 22 Fabian Groffen gentoo-dev 2009-09-14 09:38:40 UTC
this will eventually require a Portage change as soon Portage will remove the startscripts, as workaround until this bug is fixed
Comment 23 Armando Di Cianno 2009-09-23 16:52:58 UTC
This change (removal of functions.sh link) broke ecopy as well.

grobian -- is there a write-up I can reference as to what the game plan with start-up scripts (init.d, launchd) is?  I'm less concerned about 'doing it my way', but I'd like to not divorce my changes too far from Prefix proper.
Comment 24 Fabian Groffen gentoo-dev 2009-09-23 17:16:56 UTC
functions.sh should not be removed I guess, what package is it removed for?
Comment 25 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-09-23 17:58:17 UTC
(In reply to comment #24)
> functions.sh should not be removed I guess, what package is it removed for?
> 

baselayout-prefix.sh owns the symlink but I already fixed ecopy.
Comment 26 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-09-23 17:58:52 UTC
Sorry, can't type. sys-apps/baselayout-prefix
Comment 27 Fabian Groffen gentoo-dev 2009-09-23 18:35:58 UTC
I see now.  That's unintended behaviour.
Comment 28 Fabian Groffen gentoo-dev 2009-09-24 17:20:49 UTC
 =sys-apps/portage-2.2.00.14277 masked
Comment 29 zhoumi 2010-04-20 04:44:24 UTC
Please tell me what can I do about this.

* QA Notice: the following files are outside of the prefix:
 * /sbin
 * /sbin/runscript
 * /sbin/consoletype
 * /sbin/start-stop-daemon
 * /bin
 * /lib
 * /lib/rcscripts
 * /lib/rcscripts/conf.d
 * /lib/rcscripts/conf.d/env_whitelist
 * ERROR: sys-apps/baselayout-prefix-1.12.5-r7 failed:
 *   Aborting due to QA concerns: there are files installed outside the prefix
 * 
 * Call stack:
 *   misc-functions.sh, line 1487:  Called install_qa_check
 *   misc-functions.sh, line   94:  Called install_qa_check_prefix
 *   misc-functions.sh, line  596:  Called die
 * The specific snippet of code:
 *                      die "Aborting due to QA concerns: there are files installed outside the prefix"
 * 
Comment 30 Fabian Groffen gentoo-dev 2010-04-20 08:25:43 UTC
You have to make it prefix aware at certain points, but without your ebuild and modifications there is little we can do to try and help you.
Comment 31 zhoumi 2010-04-20 13:17:05 UTC
I just patch the baselayout-prefix-1.12.5-r6.ebuild.diff to the latest baselayout-prefix ebuild. Here is my patched ebuild: http://gist.github.com/372420

Comment 32 zhoumi 2010-04-22 03:03:53 UTC
The diff file attached 2009-05-03 is no longer suit the latest ebuild. Is there any one just attach a working ebuild pack here? Thanks. 
Comment 33 Dirk Tilger 2010-05-09 09:44:36 UTC
Portage currently removes startup scripts with the comment:
" * removed /etc/init.d and /etc/conf.d directories until bug #196294 has been resolved"

I was wondering what exactly needs to be done to resolve this bug.

I like Gentoo Prefix, but it has (at least for me) a relatively large maintenance overhead. Fixing things on my system only makes me the only beneficiary and seems a waste considering the amount of time spent. If anything could be done from my end to move resolving this bug forward, I'd very much appreciate any directions from your ends.

Thanks and Best regards.
Comment 34 Fabian Groffen gentoo-dev 2010-05-14 14:45:38 UTC
I added your patches to -r7, that should give a start.

The obvious problems are the runscripts of the various packages.  Before you start fixing them, it may be a good idea to reevaluate the current version of baselayout-prefix regarding what's in mainline Gentoo.
Comment 35 yegle 2011-04-14 08:48:28 UTC
No update of this bug for a long time. Really hope this
Comment 36 Benda Xu gentoo-dev 2012-04-05 06:52:41 UTC
Hi, I have got a plan to introduce openrc to baselayout for services. Some early thoughts are gathered here:

http://www.awa.tohoku.ac.jp/~benda/projects/openrc.html
Comment 37 Benda Xu gentoo-dev 2012-05-12 08:18:15 UTC
Hi, please help test OpenRC for this task.

A guide is at https://wiki.gentoo.org/wiki/OpenRC/Prefix

File new bug to me or just comment on this bug for feedback.
Comment 38 Myk Taylor 2012-11-27 18:06:36 UTC
Hi Benda -- thanks for taking this on!  My goal here is to get MythTV running in a x86 prefix (running on a ReadyNAS Ultra 4).  I have everything compiled and have followed the https://wiki.gentoo.org/wiki/OpenRC/Prefix guide up to the init script part.

I note some services complaining about the lack of a service that provides net:

 * Caching service dependencies ...
Service `git-daemon' needs non existent service `net'
Service `mythbackend' needs non existent service `net'
Service `pydoc-2.7' needs non existent service `net'
Service `sshd' needs non existent service `net'

What is the suggested method of resolving this?


Also, I see a lot of init scripts in init.d that a prefix would have no use for, like fsck and devfs.  Would it be reasonable to mask some of those services from being installed?

note: the shebangs in the init scripts already seem to be eprixified during installation, so no manual fixes were required there
Comment 39 Benda Xu gentoo-dev 2013-06-15 16:34:14 UTC
Sorry for the late reply, don't know why I missed your excellent commet :(

(In reply to Myk Taylor from comment #38)
> Hi Benda -- thanks for taking this on!  My goal here is to get MythTV
> running in a x86 prefix (running on a ReadyNAS Ultra 4).  I have everything
> compiled and have followed the https://wiki.gentoo.org/wiki/OpenRC/Prefix
> guide up to the init script part.

nice!

> I note some services complaining about the lack of a service that provides
> net:
> 
>  * Caching service dependencies ...
> Service `git-daemon' needs non existent service `net'
> Service `mythbackend' needs non existent service `net'
> Service `pydoc-2.7' needs non existent service `net'
> Service `sshd' needs non existent service `net'
> 
> What is the suggested method of resolving this?

in $EPREIFX/etc/rc.conf, set rc_sys="prefix" will do.
 
> Also, I see a lot of init scripts in init.d that a prefix would have no use
> for, like fsck and devfs.  Would it be reasonable to mask some of those
> services from being installed?
> 
> note: the shebangs in the init scripts already seem to be eprixified during
> installation, so no manual fixes were required there

Thanks, wiki updated :)
Comment 40 Larry the Git Cow gentoo-dev 2022-09-05 12:40:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47adf3b360d2ae37d1c18aa27c25cd218db0cb95

commit 47adf3b360d2ae37d1c18aa27c25cd218db0cb95
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2022-09-05 12:40:05 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2022-09-05 12:40:46 +0000

    sys-apps/baselayout-prefix: remove last-rited package
    
    Closes: https://bugs.gentoo.org/836114
    Closes: https://bugs.gentoo.org/196294
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 profiles/package.mask                              |   4 -
 sys-apps/baselayout-prefix/Manifest                |   8 -
 .../baselayout-prefix-2.6-r3.ebuild                | 344 ---------------------
 sys-apps/baselayout-prefix/metadata.xml            |  10 -
 4 files changed, 366 deletions(-)