[Slackbuilds-users] "# Keep same perms on rc.INIT.new" in doinst.sh

Niels Horn niels.horn at gmail.com
Wed Dec 16 14:41:32 UTC 2009

On Wed, Dec 16, 2009 at 12:30 PM, Robby Workman <rworkman at slackbuilds.org>wrote:

> On Wed, 16 Dec 2009 10:27:56 -0200
> Niels Horn <niels.horn at gmail.com> wrote:
> > In the doinst.sh I include this part from the template whenever I
> > write a SlackBuild that needs a rc.INIT script.
> > Maybe a silly question, but why is this routine not a function, like
> > config() ?
> > Now I have to change "INIT" to "<my_program>" eight times, while it
> > could be called with a variable.
> >
> > Any special reason for not having a function, or simply because
> > nobody has done it yet?
> I've run across maybe two or three different apps that had
> more than one init script, so other than those few instances,
> doing this in vi has sufficed:
>  (command mode)  :%s/INIT/rc.whatever/g
> That being said, I suspect you're aiming for something like this:
>  preserve_perms() {
>    NEW="$1"
>    OLD="$(dirname $NEW)/$(basename $NEW .new)"
>    if [ -e $OLD ]; then
>      cp -a $OLD ${NEW}.incoming
>      cat $NEW > ${NEW}.incoming
>      mv ${NEW}.incoming $NEW
>    fi
>  }
> It's untested, but assuming it works, I see no reason why we
> can't use it.
> -RW
> I have zarafa in pending that could have several init scripts: server,
gateway, spooler, monitor, dagent, etc.

I actually did not include them, as it depends on the users which services
he/she wants to start, so I left it "as an exercise to the user" to write
the rc.init script as one script with parameters or several separate scripts
that can be made executable or not.

But, yes, I actually wrote something very similar to what you suggested, but
ended up not using it. Maybe in my next submission :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20091216/2938036b/attachment-0001.htm>

More information about the SlackBuilds-users mailing list