mkinitcpio hook script: Generate pacnew if current preset does not match template
Generate pacnew if current preset does not match template.
Inform user about pacnews being created/present.
Inform user about pacsave being created.
Current behavior is to ignore modified templates, which ends up with issues like these:
% grep micr /etc/mkinitcpio.d/linux-zen.preset
ALL_microcode=(/boot/*-ucode.img)
% pacman -S linux-zen
...
==> WARNING: Deprecated option 'ALL_microcode' found. Update '/etc/mkinitcpio.d/linux-zen.preset' to use the 'microcode' hook instead.
...
% grep micr /etc/mkinitcpio.d/linux-zen.preset
ALL_microcode=(/boot/*-ucode.img)
This should, imo, be handled automatically (user did not modify preset -> overwrite), which does not currently seem feasible, so this PR creates a pacnew on kernel install, if the default preset is modified.
There was previously no STDOUT in the bash script, and I was not sure how to handle it.
The main script uses ==> WARNING:
syntax, so I used that, but main script also opt-out uses colors that I did not implement, which may be confusing when one warning is colored and the other isn't, feedback welcome.
Without implementing preset drop-in files as per #240, this will create a pacnew on every kernel update if people modify their presets, as there is no way to do it cleanly.
After that is implemented, perhaps the .pacnew solution can be dropped altogether and differing presets just overwritten, and users informed that the default preset is to not be modified outside of drop-ins.