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

Robby Workman rworkman at slackbuilds.org
Wed Dec 16 14:30:37 UTC 2009

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() {
    OLD="$(dirname $NEW)/$(basename $NEW .new)"
    if [ -e $OLD ]; then
      cp -a $OLD ${NEW}.incoming
      cat $NEW > ${NEW}.incoming
      mv ${NEW}.incoming $NEW

It's untested, but assuming it works, I see no reason why we
can't use it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20091216/70c140c2/attachment.asc>

More information about the SlackBuilds-users mailing list