diff options
author | Robert Alessi <alessi@robertalessi.net> | 2018-09-10 10:41:38 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2018-09-10 10:41:38 +0200 |
commit | 63712843c3541afcf25bcc8f24b46de7bbc8b400 (patch) | |
tree | a9c54f91074a51314dfb48713a727498477df5a2 | |
download | x200-my-2c17808a2ff86e901d2eedf8461addb3eb893f7a.tar.gz |
initial commit0.1-2
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | PKGBUILD | 28 | ||||
-rw-r--r-- | x200-my-lid.sh | 2 | ||||
-rw-r--r-- | x200-my-sleep.sh | 2 | ||||
-rw-r--r-- | x200-my.initd | 18 | ||||
-rw-r--r-- | x200-my.install | 9 | ||||
-rw-r--r-- | x200-my.sh | 31 |
7 files changed, 92 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..80e3807 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | # emacs backups | ||
2 | *~ | ||
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..d411376 --- /dev/null +++ b/PKGBUILD | |||
@@ -0,0 +1,28 @@ | |||
1 | # Maintainer: Robert Alessi <alessi@robertalessi.net> | ||
2 | |||
3 | pkgname=x200-my | ||
4 | pkgver=0.1 | ||
5 | pkgrel=2 | ||
6 | pkgdesc="Service which removes whining noise from Thinkpads X200. Also powers off the wifi on shutdown." | ||
7 | arch=(any) | ||
8 | license=(GPL2) | ||
9 | url="http://git.robertalessi.net/x200-my" | ||
10 | depends=('sysvinit' 'networkmanager' 'acpid') | ||
11 | install=x200-my.install | ||
12 | source=('x200-my.initd' | ||
13 | 'x200-my-lid.sh' | ||
14 | 'x200-my-sleep.sh' | ||
15 | 'x200-my.sh') | ||
16 | sha512sums=('af5ade50214a9ffe0a24d0a0c8ad93d9802a6bfab64c53a832f0d21ef4abf9c465aec88e8be6b1af90c5bb02f9718aa3a495bcb8ed496f8de2c1ad130afdf70f' | ||
17 | '0dc141f1a26f2cd570d49a05bcc9496ba4c49fde39afad46f5a0783e83c07ec810ca81454a28c3241bcffc62ac31274e2a8d726bbd3c1e91d8cf5315b783c3f8' | ||
18 | '610564aa853c5dbc4e370ec2a4d3b5590e53ed235a1960927c0986a31f6c77d135086b1f5752b56fd511ea4a0294082fc7e98ee2fa7b69b37776a59f45c2ec34' | ||
19 | 'cb765075f02b5cd16bcfc31571cf7c31ddcd74ff3aa832df1acd96bd8feb62855c0cf90c31c3e0028180765a51eafc5c74fb1f0406dd9172bdc0f5ec02b39f8c') | ||
20 | |||
21 | package() { | ||
22 | install -Dm755 x200-my.initd "$pkgdir"/etc/init.d/x200-my | ||
23 | sed -e 's|#!/sbin/openrc-run|#!/usr/bin/openrc-run|g' \ | ||
24 | -i $pkgdir/etc/init.d/x200-my | ||
25 | install -Dm644 "x200-my-lid.sh" "$pkgdir/etc/acpi/events/x200-my-lid" | ||
26 | install -Dm644 "x200-my-sleep.sh" "$pkgdir/etc/acpi/events/x200-my-sleep" | ||
27 | install -Dm755 "x200-my.sh" "$pkgdir/etc/acpi/x200-my.sh" | ||
28 | } | ||
diff --git a/x200-my-lid.sh b/x200-my-lid.sh new file mode 100644 index 0000000..2390706 --- /dev/null +++ b/x200-my-lid.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | event=button/lid.* | ||
2 | action=/etc/acpi/x200-my.sh %e | ||
diff --git a/x200-my-sleep.sh b/x200-my-sleep.sh new file mode 100644 index 0000000..ecbf2f6 --- /dev/null +++ b/x200-my-sleep.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | event=button/sleep.* | ||
2 | action=/etc/acpi/x200-my.sh %e | ||
diff --git a/x200-my.initd b/x200-my.initd new file mode 100644 index 0000000..9d8442d --- /dev/null +++ b/x200-my.initd | |||
@@ -0,0 +1,18 @@ | |||
1 | #!/sbin/openrc-run | ||
2 | # Copyright 2018 Robert Alessi | ||
3 | # Distributed under the terms of the GNU General Public License v2 | ||
4 | |||
5 | description="Removes whining noise from Thinkpads X200 and powers off the wifi on shutdown." | ||
6 | |||
7 | start() { | ||
8 | if [ "${RC_CMD}" = "restart" ]; | ||
9 | then | ||
10 | /usr/bin/nmcli radio all off | ||
11 | fi | ||
12 | |||
13 | /usr/bin/intel_reg write 0x00061254 0x8bb7b16dc5b6a 2>/dev/null | ||
14 | } | ||
15 | |||
16 | stop() { | ||
17 | /usr/bin/nmcli radio all off | ||
18 | } | ||
diff --git a/x200-my.install b/x200-my.install new file mode 100644 index 0000000..f26d50b --- /dev/null +++ b/x200-my.install | |||
@@ -0,0 +1,9 @@ | |||
1 | post_install() { | ||
2 | echo "Enabling x200-my service..." | ||
3 | rc-update add x200-my default | ||
4 | } | ||
5 | |||
6 | pre_remove() { | ||
7 | echo "Disabling x200-my service..." | ||
8 | rc-update del x200-my default | ||
9 | } | ||
diff --git a/x200-my.sh b/x200-my.sh new file mode 100644 index 0000000..1b72c62 --- /dev/null +++ b/x200-my.sh | |||
@@ -0,0 +1,31 @@ | |||
1 | #!/bin/bash | ||
2 | # Default acpi script that takes an entry for all actions | ||
3 | |||
4 | case "$1" in | ||
5 | button/sleep) | ||
6 | case "$2" in | ||
7 | SLPB|SBTN) | ||
8 | logger 'SleepButton pressed' | ||
9 | rc-service x200-my restart | ||
10 | ;; | ||
11 | *) | ||
12 | logger "ACPI action undefined: $2" | ||
13 | ;; | ||
14 | esac | ||
15 | ;; | ||
16 | button/lid) | ||
17 | case "$3" in | ||
18 | close) | ||
19 | logger 'LID closed' | ||
20 | ;; | ||
21 | open) | ||
22 | logger 'LID opened' | ||
23 | rc-service x200-my restart | ||
24 | ;; | ||
25 | *) | ||
26 | logger "ACPI action undefined: $3" | ||
27 | ;; | ||
28 | esac | ||
29 | ;; | ||
30 | esac | ||
31 | |||