slackware-current/source/a/grub/doinst.sh
Patrick J Volkerding b6d2c7f5fa Wed Sep 11 17:47:14 UTC 2024
a/efibootmgr-18-x86_64-1.txz:  Upgraded.
a/grub-2.12-x86_64-16.txz:  Rebuilt.
  Long ago, we began giving all the scripts in /etc/grub.d/ the .new treatment
  to prevent local customizations from being overwritten with a package
  upgrade. But, this no longer appears to be a good idea, especially if we're
  ever going to offer the possibility to automate grub-install and grub-update.
  So, we are no longer going to preserve the contents of these files when the
  grub package is upgraded. We *will* however preserve the existing
  permissions, so you'll be able to turn off scripts that you don't want
  running, and you'll be able to make new scripts, or make edited and renamed
  copies of the scripts shipped in this package, so there's no real loss of
  functionality here.
  It looks like 40_custom is intended to be locally edited, so we make an
  exception and do not overwrite that one.
d/python-setuptools-74.1.2-x86_64-1.txz:  Upgraded.
kde/okteta-0.26.17-x86_64-1.txz:  Upgraded.
l/gobject-introspection-1.80.1-x86_64-2.txz:  Rebuilt.
  Fix running against python-setuptools-74.1.2:
  [PATCH] giscanner: remove dependency on distutils.msvccompiler.
l/python-importlib_metadata-8.5.0-x86_64-1.txz:  Upgraded.
n/curl-8.10.0-x86_64-1.txz:  Upgraded.
2024-09-11 20:35:16 +02:00

36 lines
1,017 B
Bash

config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
# Also preserve timestamp:
touch -r $NEW ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
# Process config files in etc/grub.d/:
for file in etc/grub.d/*.new ; do
preserve_perms $file
# Move it into place. These are not intended to be edited locally - make new custom scripts!
# We'll skip moving 40_custom.new, though.
if [ -r $file -a ! "$file" = "etc/grub.d/40_custom.new" ]; then
mv $file $(dirname $file)/$(basename $file .new)
fi
done
config etc/default/grub.new