Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: "Javier Vasquez" <jevv.cr AT gmail.com>
  • To: "Andraž 'ruskie' Levstik" <ruskie AT mages.ath.cx>
  • Cc: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d
  • Date: Tue, 18 Sep 2007 09:11:30 -0600

On 9/17/07, "Andraž 'ruskie' Levstik" <ruskie AT mages.ath.cx> wrote:
> On 00:10:53 2007-09-18 "Javier Vasquez" <jevv.cr AT gmail.com> wrote:
> > On 9/17/07, Javier Vasquez <jevv.cr AT gmail.com> wrote:
> > > On 9/16/07, "Andraž 'ruskie' Levstik" <ruskie AT mages.ath.cx> wrote:
> > > > On 07:34:26 2007-09-17 "Javier Vasquez" <jevv.cr AT gmail.com> wrote:
> > > > > Hi,
> > > > >
> > > > > I'm trying to write some personal spells, but the only thing
> > > > > preventing further progress is the fact that one of them require 2
> > > > > daemon scripts to be included in /etc/init.d/runlevels/%S. Well I
> > > > > think that should be the right place although I might be wrong...
> > > > > The others require as well 1 script to be included there as well
> > > > >
> > > > > Copying the scripts in the expected place doesn't seem to do the
> > > > > magic since I can call them manually by
> > > > > "/etc/init.d/runlevels/%S/<my_script> start" for example, but when
> > > > > rebooting the machine I don't see the daemons getting called and
> > > > > when looking for the processes, I don't find them...
> > > > >
> > > > > There must be some procedure to do this, but the spell writing for
> > > > > dumies doesn't help me... Can some one point out how to do this,
> > > > > specially when there's more than one script per spell to be
> > > > > included?
> > > > >
> > > >
> > > > Put the init scrips into(this will ensure they are installed
> > > > automaticaly during casting(if you specify so)):
> > > > $SPELLDIR/init.d
> > > >
> > > > And make sure the init scripts conform to our system i.e.:
> > > > added the following variables into them:
> > > > PROGRAM=/foo/bar/baz
> > > > RUNLEVEL=[one of S, 0, 1, 2, 3, 4, 5, 6, DEV]
> > > > Next only needed if it has any dependencies...
> > > > NEEDS=
> > > >
> > > >
> > > > This is more or less the official way...
> > > >
> > > >
> > > > --
> > > > Andraž "ruskie" Levstik
> > >
> > > So one option, following your comment, implies that I should extract
> > > from the tarball the script and place it under the spell directory,
> > > and besides modify it to comply... modutils might be an example
> > > maybe...
> > >
> > > I saw the acpid example, and although I didn't understand it pretty
> > > well, it seems like another option is to place the scripts somewhere
> > > else and call them through the one placed in the spell under init.d...
> > > This although looking +/- simple, might not be suitable all the time,
> > > specially when the application installs a binary in the common place
> > > for binaries, and besides a script with the same name under init.d,
> > > then a name change or something needs to apply in order for everything
> > > to work... Well, I'll try with this 2nd option and see how it goes...
> > >
> > > Thanks,
> > >
> > > --
> > > Javier
> >
> >
> > So I couldn't get it working with separate scripts somewhere else,
> > plus just a wrapper in /etc/init.d/runlevels/%* which is to be placed
> > in init.d under the spell directory... When performing "telinit run
> > <script> ARG" it looks like ARG is always lost and doesn't reach the
> > original script...
> >
> > Instead I came up with a not so nice work around... I patch the
> > original scripts so that they always include at the very beginning:
> >
> > RUNLEVEL=*
> > . /etc/init.d/smgl_init
> >
> > Then I place in the init.d spell subDir a fake wrapper with:
> >
> > #!/bin/sh
> > PROGRAM=<tmp_dir>/<script>
> > RUNLEVEL=*
> > . /etc/init.d/smgl_init
> >
>
> If you're sourcing smgl_init functions you need to use /bin/bash
>
>
> > Then I modify INSTALL so that the script is placed under <tmp_dir>,
> > and also add FINAL, so that <tmp_dir>/<script> replaces the fake
> > wrapper placed under /etc/init.d/runlevel/%*....
> >
> > This seems to work, except that somehow /etc/init.d/smgl_init gives
> > the following error:
> >
> > /etc/init.d/smgl_functions: line 107: : command not found
> >
> > Which corresponds to:
> >
> > local SCRIPTW="$($SCRIPTC)$SCRIPT$($NORMAL)"
> >
>
> Read the previous line :)
>
> > A weird assignment, but assignment at the end... Is any one familiar
> > with it? Does any onw know if it's critical to attend? At any rate,
> > the script seems to follow through the rest even though the error
> > message is flagged...
> >
>
>
> --
> Andraž "ruskie" Levstik
> Source Mage GNU/Linux Games grimoire guru
> Geek/Hacker/Tinker

Ups, the original scripts point to sh instead of bash... Something
else to fix, :).

Thanks,

--
Javier




Archive powered by MHonArc 2.6.24.

Top of Page