On Fri, Aug 10, 2007 at 11:57:44AM +0200, Petter Reinholdtsen wrote:
> 
> Package: procps
> Version: 1:3.2.7-4
> Tags: patch
> 
> When upgrading my unstable chroot today, I ran into a problem with the
> init.d scripts in procps.  I am using the dependency based boot
> sequencer insserv, and it complained about duplicate init.d scripts
> providing procps.
> 
> Checking this closer, the problem seem to be that both procps and
> procps.sh exist.  The trigger is that the old script is left in
> /etc/init.d/ after it is removed from the rc.d directories.  Here is
> some key info about the problematic situation.

> This patch solve the problem, by getting rid of the old script before
> calling update-rc.d to install the new one.  It might be a good idea
> to check the version number being upgraded from, as well as the MD5
> sum of the old script, before removing it.  This patch just solve the
> easy part.
> 
> --- /tmp/procps.postinst        2007-08-10 11:52:55.000000000 +0200
> +++ /var/lib/dpkg/info/procps.postinst  2007-08-10 11:53:31.000000000 +0200
> @@ -37,6 +37,10 @@
>         then
>            update-rc.d -f procps.sh remove >/dev/null
>         fi
> +       if [ -f /etc/init.d/procps.sh ]
> +       then
> +          rm /etc/init.d/procps.sh
> +       fi
>         # and if that didn't work Closes: #92184 (#234306 with -L )
>         if [ -L /etc/rcS.d/S30procps.sh ]
>         then
Yes.  The preinst script "upgrade" should do (from memory):

        # Pass the version number in $1
        upgradeoldconffile ()
        {
                v=$1
                f=/etc/init.d/procps.sh
                c=1 # XXX: fixme: this is the critical first version
                        # to drop $f.sh in favour of $f
                [ ! -e "$f" ] && return
                dpkg --compare "$1" ge "$c" || return

                curmd5=`md5sum "$f" |awk '{print $1}'`
                oldmd5=`sed -ne "/^Conffiles:/,/^[^ ]/{ \\'^ $f ' ! d; s///; p  
}" /var/lib/dpkg/status`
                [ "$curmd5" = "$oldmd5" ] && {
                        # The admin hasn't modified $f
                        echo "Preparing to remove obsolete, unmodified 
conffile: $f
                        mv -fv "$f" "$f.from-preinst"
                        return
                } >&2

                # The admin modified $f; cause a deliberate conffile prompt
                echo "Moving obsolete conffile to new pathname:"
                mv -fv "$f" "${f%.sh}"
        }

The postinst script should remove $f.from-preinst, and the postrm
should have an abort-upgrade rollback which checks for file existence,
compares versions, then conditionally does: mv "${f%.sh}" "$f".


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to