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

Detecting install vs upgrade in postinst

The postinst script for linux-image-* behaves differently on fresh
installation vs upgrade.  For a fresh installation, it updates the
default symlinks /vmlinuz and /initrd.img to point to the new kernel
and initramfs versions.  On upgrade it generally doesn't.

I've been rewriting and simplifying the scripts, and in my testing I
realised that if a package is installed, removed and installed a second
time it sees the second installation as an upgrade - which I think is
incorrect.  It currently detects an upgrade based on whether the second
argument to the postinst script is non-empty, and that's defined as
'the mostly recently configured version'.

Is there a simple way that a postinst script can tell that the
previously configured version was removed?  Or do I have to use some
sort of flag file?  (I can imagine either creating this in the preinst,
or creating it in postinst and removing it in postrm.)


Ben Hutchings
The most exhausting thing in life is being insincere. - Anne Morrow

Attachment: signature.asc
Description: This is a digitally signed message part

Reply to: