On Wed, Dec 16, 2009 at 12:30 PM, Robby Workman <span dir="ltr">&lt;<a href="mailto:rworkman@slackbuilds.org">rworkman@slackbuilds.org</a>&gt;</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 &lt;<a href="mailto:niels.horn@gmail.com">niels.horn@gmail.com</a>&gt; wrote:<br>
<br>
&gt; In the doinst.sh I include this part from the template whenever I<br>
&gt; write a SlackBuild that needs a rc.INIT script.<br>
&gt; Maybe a silly question, but why is this routine not a function, like<br>
&gt; config() ?<br>
&gt; Now I have to change &quot;INIT&quot; to &quot;&lt;my_program&gt;&quot; eight times, while it<br>
&gt; could be called with a variable.<br>
&gt;<br>
&gt; Any special reason for not having a function, or simply because<br>
&gt; nobody has done it yet?<br>
<br>
<br>
</div>I&#39;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&#39;re aiming for something like this:<br>
<br>
  preserve_perms() {<br>
    NEW=&quot;$1&quot;<br>
    OLD=&quot;$(dirname $NEW)/$(basename $NEW .new)&quot;<br>
    if [ -e $OLD ]; then<br>
      cp -a $OLD ${NEW}.incoming<br>
      cat $NEW &gt; ${NEW}.incoming<br>
      mv ${NEW}.incoming $NEW<br>
    fi<br>
  }<br>
<br>
It&#39;s untested, but assuming it works, I see no reason why we<br>
can&#39;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 &quot;as an exercise to the user&quot; 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>