1
0
Fork 0
mirror of git://slackware.nl/current.git synced 2025-01-15 15:41:54 +01:00
slackware-current/source/a/grub/doinst.sh
Patrick J Volkerding 87d711229c Sun Jun 23 22:54:10 UTC 2024
a/grub-2.12-x86_64-5.txz:  Rebuilt.
  Preserve permissions on scripts in /etc/grub.d/. Thanks to LuckyCyborg.
2024-06-24 01:28:16 +02:00

29 lines
688 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
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
done
config etc/default/grub.new