Jarno Suni, thanks for the reply.

First I would like to stress, that I still don't think that running all
the KERNELS postINSTALL hooks while REMOVING the -extra package is the
right thing todo. The only thing I can see that is really needed is the
recreation of the initrd on installation and revmoval of that package
(please correct me if I'm wrong!). So I think this is the only thing
that should be done. Even recreating the GRUB config is unnessecary and
a waste of time.

So working around this in the /etc/kernel/postinst.d/apt-auto-removal
script is imho not the right way to do this.

That being said, this seems like the only available option right now.

I have taken a closer look at your "Fixed again" script and made some 
adjustments (comparing with apt 1.0.1ubuntu2.10 from 14.04):
- The version you have uploaded does not run properly, because some 
backslash-escapes for line breaks are missing (leading to "broken pipe" error). 
- In the check if the kernel given in argument is desired to be removed the 
"exit" from the awk statement causes another broken pipe if the match is not 
the last kernel. It is not needed, so I removed it.
- The awk regex for creating the "list" of installed kernel versions is wrong ( 
only ' ' instead of '[ ]+' ), so the list is always empty.  I don't see the 
advantage of using DPKG_QUERY here compared to the original which just uses 
DPKG. So to keep changes minimal I have reverted it to the old version.
- The shortened check if we have more than two kernels to keep already may lead 
to keeping one more kernel (3 in total) than in the original, which is fine by 
me.
- Again to keep changes (diff) minimal I have reordered the versions for the 
"kernel" variable like they are in the original.
- The use of dpkg-query looks somehow awkward to me (but maybe it's just 
me....).

I'll attach my updated version of the /etc/kernel/postinst.d/apt-auto-
removal script

I have just run a few tests and it seems to work better than the
original for now. I'll do some more testing right now.....

Regards,
Robert.

** Attachment added: "updated /etc/kernel/postinst.d/apt-auto-removal script"
   
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1440608/+attachment/4551868/+files/apt-auto-removal

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1440608

Title:
  /etc/kernel/postinst.d/apt-auto-removal wants to remove all kernels
  except the latest one

To manage notifications about this bug go to:
https://bugs.launchpad.net/hundredpapercuts/+bug/1440608/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to