sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d
- From: "Andraž 'ruskie' Levstik" <ruskie AT mages.ath.cx>
- To: <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 07:17:54 +0200
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
Be sure brain is in gear before engaging mouth.
Key id = F4C1F89C
Key fingerprint = 6FF2 8F20 4C9D DB36 B5B6 F134 884D 72CC F4C1 F89C
-
[SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Javier Vasquez, 09/17/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Andraž 'ruskie' Levstik, 09/17/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Javier Vasquez, 09/17/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Javier Vasquez, 09/17/2007
- [SM-Discuss] [SM_Discuss] Why do we do it this way (was How to write spells that require initial scripts under init.d), Bearcat M. Sandor, 09/17/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Andraž 'ruskie' Levstik, 09/18/2007
- Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d, Javier Vasquez, 09/18/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Javier Vasquez, 09/17/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Javier Vasquez, 09/17/2007
-
Re: [SM-Discuss] [SM_Discuss] How to write spells that require initial scripts under init.d,
Andraž 'ruskie' Levstik, 09/17/2007
Archive powered by MHonArc 2.6.24.