On Wed, Dec 16, 2009 at 12:30 PM, Robby Workman <span dir="ltr"><<a href="mailto:rworkman@slackbuilds.org">rworkman@slackbuilds.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Wed, 16 Dec 2009 10:27:56 -0200<br>
Niels Horn <<a href="mailto:niels.horn@gmail.com">niels.horn@gmail.com</a>> wrote:<br>
<br>
> In the doinst.sh I include this part from the template whenever I<br>
> write a SlackBuild that needs a rc.INIT script.<br>
> Maybe a silly question, but why is this routine not a function, like<br>
> config() ?<br>
> Now I have to change "INIT" to "<my_program>" eight times, while it<br>
> could be called with a variable.<br>
><br>
> Any special reason for not having a function, or simply because<br>
> nobody has done it yet?<br>
<br>
<br>
</div>I've run across maybe two or three different apps that had<br>
more than one init script, so other than those few instances,<br>
doing this in vi has sufficed:<br>
<br>
(command mode) :%s/INIT/rc.whatever/g<br>
<br>
That being said, I suspect you're aiming for something like this:<br>
<br>
preserve_perms() {<br>
NEW="$1"<br>
OLD="$(dirname $NEW)/$(basename $NEW .new)"<br>
if [ -e $OLD ]; then<br>
cp -a $OLD ${NEW}.incoming<br>
cat $NEW > ${NEW}.incoming<br>
mv ${NEW}.incoming $NEW<br>
fi<br>
}<br>
<br>
It's untested, but assuming it works, I see no reason why we<br>
can't use it.<br>
<font color="#888888"><br>
-RW<br>
</font><br></blockquote></div>I have zarafa in pending that could have several init scripts: server, gateway, spooler, monitor, dagent, etc.<br><br>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.<br>
<br>But, yes, I actually wrote something very similar to what you suggested, but ended up not using it. Maybe in my next submission :)<br><br>Niels<br><br><br>