[opensuse-packaging] Need help with %post script

Hi, I'm trying to build bacula-3.0.3 to be submitted to contrib and I'm stuck on a postinstall script problem. First osc failed because the service needed service network to be enabled so I added the line "/sbin/chkconfig --add network" to the script and now I have the error :- |... running 06-check-installtest ... testing for pre/postinstall scripts that are not idempotent + '[' -n instsys ']' + exit 0 network: unknown service postinstall script of bacula-client-3.0.3-28.1.x86_64.rpm failed mount: / is busy System halted. | which seems like a catch 22 situation. Here is the whole script which comes from the original upstream specfile from the source rpm and I've hacked it for opensuse :- %post client # add our link if [ "$1" -ge 1 ] ; then /sbin/chkconfig --add network /sbin/chkconfig --add bacula-fd fi # generate passwords if needed if [ -d %{sysconf_dir} ]; then cd %{sysconf_dir} for file in *.conf; do for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PA need_password=`grep $string $file 2>/dev/null` if [ -n "$need_password" ]; then pass=`openssl rand -base64 33` sed "s-$string-$pass-g" $file > $file.new cp -f $file.new $file; rm -f $file.new fi done done fi /sbin/ldconfig Appreciate any help, Dave P -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

On 03/12/09 07:22, Dave Plater wrote:
%post client # add our link if [ "$1" -ge 1 ] ; then /sbin/chkconfig --add network
No, if the service requires network running, it must use Required-Start: $network in the init script.
/sbin/chkconfig --add bacula-fd
No, use : %fillup_and_insserv -f bacula-fd -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

On 12/03/2009 12:33 PM, Cristian Rodríguez wrote:
On 03/12/09 07:22, Dave Plater wrote:
%post client # add our link if [ "$1" -ge 1 ] ; then /sbin/chkconfig --add network
No, if the service requires network running, it must use
Required-Start: $network
in the init script.
/sbin/chkconfig --add bacula-fd
No, use :
%fillup_and_insserv -f bacula-fd
Thanks for the help, I'm busy reading up on %fillup_and_insserv in SUSE_Package_Conventions/RPM_Macros. Thanks again, Dave P -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

Christian, you want to mention that your alternative does something totally different. On 2009-12-03 07:33:14 -0300, Cristian Rodríguez wrote:
in the init script.
/sbin/chkconfig --add bacula-fd
we normally dont enable services by default.
No, use :
%fillup_and_insserv -f bacula-fd
this is basically an expensive way of saying "do nothing" the -f parameter says "skip fillup". as %fillup_and_insserv doesnt enable services forcefully without the -y/-Y parameter, your macro basically wont do anything and you can just leave it out. in most cases you want %fillup_only <servicename> darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org

On 12/03/2009 02:48 PM, Marcus Rueckert wrote:
Christian, you want to mention that your alternative does something totally different.
On 2009-12-03 07:33:14 -0300, Cristian Rodríguez wrote:
in the init script.
/sbin/chkconfig --add bacula-fd
we normally dont enable services by default.
No, use :
%fillup_and_insserv -f bacula-fd
this is basically an expensive way of saying "do nothing" the -f parameter says "skip fillup". as %fillup_and_insserv doesnt enable services forcefully without the -y/-Y parameter, your macro basically wont do anything and you can just leave it out.
in most cases you want %fillup_only <servicename>
darix
I found a link, which helped solve my problem, in another thread on this list :- http://rpm.org/wiki/Problems/Distributions I now have in my spec file :- %post %restart_on_update bacula-fd %(fillup_and_insserv bacula-fd) The link showed me what equated to the original %post script. Regards Dave P -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (3)
-
Cristian Rodríguez
-
Dave Plater
-
Marcus Rueckert