aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2019-12-19 16:17:58 +0100
committerRobert Alessi <alessi@robertalessi.net>2019-12-19 16:17:58 +0100
commit1c7e1f3efef80b9dc3e77b1231dde78eccae954f (patch)
tree475dc83900123bfaa5069150abd94d70b091469c
parent867df0cf3d06a789a92c0c7a012393a5e1a89369 (diff)
downloadx200-my-1c7e1f3efef80b9dc3e77b1231dde78eccae954f.tar.gz
removed dependency to NetworkManager. added 'privacy settings'0.5
-rw-r--r--PKGBUILD8
-rw-r--r--x200-my.confd39
-rw-r--r--x200-my.initd39
3 files changed, 72 insertions, 14 deletions
diff --git a/PKGBUILD b/PKGBUILD
index bc17e95..c063046 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,13 +1,13 @@
1# Maintainer: Robert Alessi <alessi@robertalessi.net> 1# Maintainer: Robert Alessi <alessi@robertalessi.net>
2 2
3pkgname=x200-my 3pkgname=x200-my
4pkgver=0.4 4pkgver=0.5
5pkgrel=1 5pkgrel=1
6pkgdesc="Service to remove whining noise from Thinkpads X200, power off the wifi on shutdown and optionally backup directories." 6pkgdesc="Service to remove whining noise from Thinkpads X200, power off the wifi on shutdown and optionally backup directories."
7arch=(any) 7arch=(any)
8license=(GPL2) 8license=(GPL2)
9url="http://git.robertalessi.net/x200-my" 9url="http://git.robertalessi.net/x200-my"
10depends=('sysvinit' 'networkmanager' 'acpid' 'intel-gpu-tools' 'rsync') 10depends=('sysvinit' 'acpid' 'intel-gpu-tools' 'rsync' 'macchanger' 'dhcpcd')
11optdepends=('rsnapshot: for incremental backups') 11optdepends=('rsnapshot: for incremental backups')
12install=x200-my.install 12install=x200-my.install
13source=('x200-my.initd' 13source=('x200-my.initd'
@@ -15,8 +15,8 @@ source=('x200-my.initd'
15 'x200-my-lid.sh' 15 'x200-my-lid.sh'
16 'x200-my-sleep.sh' 16 'x200-my-sleep.sh'
17 'x200-my.sh') 17 'x200-my.sh')
18sha512sums=('40d74cc2bce559cc2a08ebcd707279e148d802a5cdeb675cfb5c3abfed453378028a9f78b1be31269d908ad6aacaaaf53b48b13f97d019cdb73156ff92f507b5' 18sha512sums=('22401ceed6c1bf0be9c2afb6ffc1cb3e72c6e0a961f806dab5f7516596e8225fe729e96ee695855f8a8bdd98840939d1413a6eafb80de7075326a10e25a5cbdd'
19 'bf6513589b39daad03e4365e61f2026a4cb1801af9d061f38f502c4caa5732d03e529d43f2ec87a4ded952b6a299fdec1c18f302162b0dd28c540299be8987cf' 19 'e0bc650377f593484185438d1ea8e7b6a298fb2ab4d1cf9a99191d878d250c82a998d1ead8f1a0bd6518105e068c0b0926409b9497d8283444c6b734debe3599'
20 '0dc141f1a26f2cd570d49a05bcc9496ba4c49fde39afad46f5a0783e83c07ec810ca81454a28c3241bcffc62ac31274e2a8d726bbd3c1e91d8cf5315b783c3f8' 20 '0dc141f1a26f2cd570d49a05bcc9496ba4c49fde39afad46f5a0783e83c07ec810ca81454a28c3241bcffc62ac31274e2a8d726bbd3c1e91d8cf5315b783c3f8'
21 '610564aa853c5dbc4e370ec2a4d3b5590e53ed235a1960927c0986a31f6c77d135086b1f5752b56fd511ea4a0294082fc7e98ee2fa7b69b37776a59f45c2ec34' 21 '610564aa853c5dbc4e370ec2a4d3b5590e53ed235a1960927c0986a31f6c77d135086b1f5752b56fd511ea4a0294082fc7e98ee2fa7b69b37776a59f45c2ec34'
22 'cb765075f02b5cd16bcfc31571cf7c31ddcd74ff3aa832df1acd96bd8feb62855c0cf90c31c3e0028180765a51eafc5c74fb1f0406dd9172bdc0f5ec02b39f8c') 22 'cb765075f02b5cd16bcfc31571cf7c31ddcd74ff3aa832df1acd96bd8feb62855c0cf90c31c3e0028180765a51eafc5c74fb1f0406dd9172bdc0f5ec02b39f8c')
diff --git a/x200-my.confd b/x200-my.confd
index 35d26bd..4de394d 100644
--- a/x200-my.confd
+++ b/x200-my.confd
@@ -1,9 +1,46 @@
1# /etc/conf.d/x200-my: config file for /etc/init.d/x200-my 1# /etc/conf.d/x200-my: config file for /etc/init.d/x200-my
2 2
3# Options to pass to the x200-my daemon. 3#########################################
4# Options to pass to the x200-my daemon #
5#########################################
6
7# Is this machine a Thinkpad X200? If so, x200-my can eliminate the
8# whining noise that is noticeable when the brightness of the screen
9# is lowered.
10
11is_thinkpad_x200="yes" # (yes|no)
4 12
5PWMFREQ_RATE="0x8bb7b16dc5b6a" 13PWMFREQ_RATE="0x8bb7b16dc5b6a"
6 14
15####################
16# Privacy settings #
17####################
18
19# To enable privacy settings, set enable_privacy to 'true' and supply
20# the right name of the wired internet interface that may or may not
21# be connected to the internet so that its MAC address can be spoofed
22# at startup. Additionally, x200-my will delete /etc/dhcpcd.duid,
23# which will make dhcpcd generate a new DUID-LLT based file with an
24# updated timestamp and the link-layer address of the network
25# interface that is connected to the DHCP device at the time that the
26# DUID is generated.
27
28# IMPORTANT NOTICE: As dhcpcd uses ANY ONE network interface that is
29# connected to the DHCP device to generate the DIUD-LLT file, the
30# wireless interface MUST have its MAC address spoofed as well. To
31# make wpa_supplicant handle this, add the following two lines in
32# /etc/wpa_supplicant/wpa_supplicant.conf:
33# mac_addr=1
34# preassoc_mac_addr=1
35
36# Finally, it is advisable to set the hostname to "localhost" and have
37# "hostname_short" in /etc/dhcpcd.conf so that the actual hostname of
38# the machine should not be sent to the DHCP server.
39
40enable_privacy="false" # either 'true' or 'false'
41wired_interface="" # supply the actual interface name! In case of
42 # doubt, see the output of 'ls /sys/class/net/'
43
7################## 44##################
8# Backup options # 45# Backup options #
9################## 46##################
diff --git a/x200-my.initd b/x200-my.initd
index de88ff0..e4303e6 100644
--- a/x200-my.initd
+++ b/x200-my.initd
@@ -1,13 +1,13 @@
1#!/sbin/openrc-run 1#!/usr/bin/openrc-run
2# Copyright 2018-2019 Robert Alessi 2# Copyright 2018-2019 Robert Alessi
3# Distributed under the terms of the GNU General Public License v2 3# Distributed under the terms of the GNU General Public License v2
4 4
5description="Removes whining noise from Thinkpads X200, powers off the wifi on shutdown and optionally backups directories." 5description="Removes whining noise from Thinkpads X200, powers off the wifi on shutdown and optionally backups directories."
6 6
7command="/usr/bin/intel_reg" 7x200_cmdfreq="/usr/bin/intel_reg"
8pwmfreq="${PWMFREQ_RATE}" 8pwmfreq="${PWMFREQ_RATE}"
9 9
10command_args="write 0x00061254 $pwmfreq" 10x200_cmdfreq_args="write 0x00061254 $pwmfreq"
11 11
12extra_started_commands="initbackup" 12extra_started_commands="initbackup"
13 13
@@ -23,12 +23,17 @@ else
23 backup_args="-aAX --relative --delete --quiet" 23 backup_args="-aAX --relative --delete --quiet"
24fi 24fi
25 25
26depend() {
27 need localmount
28 before net
29}
30
26do_listofpackages() { 31do_listofpackages() {
27 /usr/bin/pacman -Qqetn > "$backup_path"/pkglist.txt 32 /usr/bin/pacman -Qqetn > "$backup_path"/pkglist.txt
28 /usr/bin/pacman -Qqem > "$backup_path"/foreignpkglist.txt 33 /usr/bin/pacman -Qqem > "$backup_path"/foreignpkglist.txt
29} 34}
30 35
31do_backup () { 36do_backup() {
32 if [ $autobackup = "true" ] 37 if [ $autobackup = "true" ]
33 then 38 then
34 if [ -e "$backup_path"/"$control_file" ] 39 if [ -e "$backup_path"/"$control_file" ]
@@ -50,20 +55,36 @@ do_backup () {
50 fi 55 fi
51} 56}
52 57
58do_privacy() {
59 if [ $enable_privacy = "true" ]
60 then
61 if [ -n ${wired_interface:+1} ]
62 then
63 rm -rf /etc/dhcpcd.duid
64 /sbin/macchanger -r $wired_interface
65 fi
66 fi
67}
68
53initbackup() { 69initbackup() {
54 do_backup 70 do_backup
55} 71}
56 72
57start() { 73start() {
58 if [ "${RC_CMD}" = "restart" ]; 74 if [ "${RC_CMD}" = "restart" ]
59 then 75 then
60 /usr/bin/nmcli radio all off 76 /usr/sbin/rfkill block all
77 else
78 do_privacy
79 fi
80 /usr/sbin/rfkill block all
81 if [ $is_thinkpad_x200 = "yes" ]
82 then
83 exec $x200_cmdfreq $x200_cmdfreq_args 2>/dev/null
61 fi 84 fi
62
63 exec $command $command_args 2>/dev/null
64} 85}
65 86
66stop() { 87stop() {
67 /usr/bin/nmcli radio all off 88 /usr/sbin/rfkill block all
68 do_backup 89 do_backup
69} 90}