diff options
author | Aaditya Bagga | 2015-06-09 08:24:08 +0530 |
---|---|---|
committer | Aaditya Bagga | 2015-06-09 08:24:08 +0530 |
commit | c438af0d387a46baa96b2860847152a70b1b3aa7 (patch) | |
tree | 51bd139c6faec0d991617c7fdb91a7c4ffe487b1 /tlp-pmu.install | |
download | aur-c438af0d387a46baa96b2860847152a70b1b3aa7.tar.gz |
tlp-pmu: initial commit
Diffstat (limited to 'tlp-pmu.install')
-rw-r--r-- | tlp-pmu.install | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tlp-pmu.install b/tlp-pmu.install new file mode 100644 index 000000000000..c796c0270b56 --- /dev/null +++ b/tlp-pmu.install @@ -0,0 +1,33 @@ +post_install() { +# Mask conflicting pm-utils hooks +if [ -d /usr/lib/pm-utils/power.d ] && [ -d /etc/pm/power.d ]; then + for i in $(find /usr/lib/pm-utils/power.d -type f -printf "%f\n"); do + if [ -x /usr/lib/pm-utils/power.d/$i ]; then + # Executable hook in /usr/lib/pm-utils/power.d/ exists + if [ -f /etc/pm/power.d/$i ]; then + # Exclude symlinks to tlp-nop + if [ "$( readlink -s /etc/pm/power.d/$i )" != "/usr/lib/tlp-pm/tlp-nop" ]; then + # Move aside superseding hook of same name in /etc/pm/power.d/ + mv -n /etc/pm/power.d/$i /etc/pm/power.d/$i.tlp-save + fi + fi + # Make a soft link to tlp-nop in /etc/pm/power.d/ + # to disable corresponding hook /usr/lib/pm-utils/power.d/ + ln -sf /usr/lib/tlp-pm/tlp-nop /etc/pm/power.d/$i + fi + done +fi +} + +post_upgrade() { + post_install +} + +post_remove() { +# Unmask pm-utils hooks +for i in $(find /etc/pm/power.d -printf "%f\n"); do + if [ "$( readlink /etc/pm/power.d/$i )" = "/usr/lib/tlp-pm/tlp-nop" ]; then + rm /etc/pm/power.d/$i + fi +done +} |