summaryrefslogtreecommitdiff
path: root/system/microcode_ctl/doinst.sh
diff options
context:
space:
mode:
authorAndrzej Telszewski <atelszewski@gmail.com>2014-07-22 05:58:22 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-07-22 06:13:20 +0700
commitcfc82f0a12d557e82b7a4aa66fc210b89b00dc85 (patch)
treee0f68240cb54a75b25054ee1e90f23497e76d4c9 /system/microcode_ctl/doinst.sh
parent256a0c56a072cb1f1632e49adff009e372a82bf6 (diff)
downloadslackbuilds-cfc82f0a12d557e82b7a4aa66fc210b89b00dc85.tar.gz
system/microcode_ctl: Updated for version 1.26.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
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 c78bd94e8b..ec0c991ed4 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