aboutsummaryrefslogtreecommitdiff
path: root/system/microcode_ctl/doinst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'system/microcode_ctl/doinst.sh')
-rw-r--r--system/microcode_ctl/doinst.sh37
1 files changed, 21 insertions, 16 deletions
diff --git a/system/microcode_ctl/doinst.sh b/system/microcode_ctl/doinst.sh
index c78bd94e8b7f..ec0c991ed409 100644
--- a/system/microcode_ctl/doinst.sh
+++ b/system/microcode_ctl/doinst.sh
@@ -1,22 +1,27 @@
config() {
+ for infile in $1; do
+ NEW="$infile"
+ 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...
+ done
+}
+
+preserve_perms() {
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
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
fi
- # Otherwise, we leave the .new copy for the admin to consider...
+ config $NEW
}
-# Keep same perms on rc.microcode_ctl.new:
-if [ -e etc/rc.d/rc.microcode_ctl ]; then
- cp -a etc/rc.d/rc.microcode_ctl etc/rc.d/rc.microcode_ctl.new.incoming
- cat etc/rc.d/rc.microcode_ctl.new > etc/rc.d/rc.microcode_ctl.new.incoming
- mv etc/rc.d/rc.microcode_ctl.new.incoming etc/rc.d/rc.microcode_ctl.new
-fi
-
-config etc/rc.d/rc.microcode_ctl.new
-
+preserve_perms etc/rc.d/rc.microcode_ctl.new