[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#599931: zipl hook scripts invoke zipl multiple times



Package: s390-tools
Version: 1.8.3-2
Severity: wishlist

The zipl hook scripts, /etc/kernel/postinst.d/zz-zipl and
/etc/kernel/postrm.d/zz-zipl, invoke zipl multiple times.  It would be good
to incorporate logic similar to that included in the initramfs-tools hook
script so that zipl only gets invoked once.  For example, at the
time of this writing, /etc/kernel/postinst.d/zz-zipl looks something like this:

-----

   #!/bin/sh
   exec zipl </dev/null >&2

-----

This script is called both for pre-configuration and for configuration,
causing zipl to be invoked twice.  Consider instead the following logic:

-----

   #!/bin/sh
   set -e

   # Avoid executing multiple times.
   if [ -n "$DEB_MAINT_PARAMS" ];then
       eval set -- "$DEB_MAINT_PARAMS"
       if [ -z "$1" ] || [ "$1" != "configure" ];then
           exit 0
       fi
   fi

   
   if [ -f /etc/zipl.conf ];then
      zipl >&2
   else
      echo "WARNING, not invoking zipl: /etc/zipl.conf not found" >&2
   fi

-----

This script exits without invoking zipl when invoked during pre-configuration,
but does invoke zipl during configuration.  (It also does not invoke zipl
if zipl's configuration file is not found.)  Similarly,
/etc/kernel/postrm.d/zz-zipl currently looks something like this:

-----

#!/bin/sh
exec zipl </dev/null >&2

-----

This script is invoked for a remove and also for a purge.  When a purge is done,
the script is called twice: first for the remove process, then a second time
for the purge process.  Thus, zipl gets executed twice.  Consider instead
the following logic:

-----

   #!/bin/sh

   # Avoid executing multiple times.
   if [ -n "$DEB_MAINT_PARAMS" ];then
       eval set -- "$DEB_MAINT_PARAMS"
       if [ -z "$1" ] || [ "$1" != "remove" ];then
           exit 0
       fi
   fi

   if [ -f /etc/zipl.conf ];then
      zipl >&2
   else
      echo "WARNING, not invoking zipl: /etc/zipl.conf not found" >&2
   fi
   exit 0

-----

This logic causes the script to exit without invoking zipl
when called for purge processing, but allows zipl to be invoked
during remove processing.  (It also forces a clean exit in case
of an error from zipl, which is desirable during a remove.)

-- 
  .''`.     Stephen Powell    
 : :'  :
 `. `'`
   `-



Reply to: