diff options
author | Aaditya Bagga <aaditya_gnulinux@zoho.com> | 2014-04-25 08:00:09 +0700 |
---|---|---|
committer | Erik Hanson <erik@slackbuilds.org> | 2014-04-27 12:18:16 -0500 |
commit | 1dd344df330172d72239982ae9c37f35188e3586 (patch) | |
tree | 622eaca6dbf33fedfbc5f23443857bdae0afca65 /system/TLP/doinst.sh | |
parent | 439167b13392d202238e25c87cd0ea9e31ca4feb (diff) |
system/TLP: Updated for version 0.5.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/TLP/doinst.sh')
-rw-r--r-- | system/TLP/doinst.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/system/TLP/doinst.sh b/system/TLP/doinst.sh new file mode 100644 index 0000000000000..d21b756e2afdf --- /dev/null +++ b/system/TLP/doinst.sh @@ -0,0 +1,26 @@ +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 +} + +config etc/default/tlp.new +preserve_perms etc/rc.d/rc.tlp.new |