diff options
-rw-r--r-- | README.md | 170 | ||||
-rw-r--r-- | about.html | 104 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 17 | ||||
-rw-r--r-- | debian/copyright | 29 | ||||
-rwxr-xr-x | debian/rules | 9 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | makefile | 47 | ||||
-rw-r--r-- | my-x200-lid.sh | 2 | ||||
-rw-r--r-- | my-x200-sleep.sh | 2 | ||||
-rw-r--r-- | my-x200.confd | 79 | ||||
-rw-r--r-- | my-x200.initd | 124 | ||||
-rw-r--r-- | my-x200.sh | 32 | ||||
-rw-r--r-- | my-x200_0.6-1.debian.tar.xz | bin | 0 -> 1388 bytes | |||
-rw-r--r-- | my-x200_0.6-1.dsc | 41 | ||||
-rw-r--r-- | my-x200_0.6-1_amd64.deb | bin | 0 -> 4652 bytes | |||
-rw-r--r-- | my-x200_0.6.orig.tar.gz | bin | 0 -> 38550 bytes |
18 files changed, 663 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a7dcf2 --- /dev/null +++ b/README.md | |||
@@ -0,0 +1,170 @@ | |||
1 | --- | ||
2 | author: | ||
3 | - Robert Alessi | ||
4 | title: 'The my-x200 package – README file' | ||
5 | subtitle: 'A Debian/Devuan service dedicated to Thinkpads X200' | ||
6 | --- | ||
7 | |||
8 | License and Disclamer | ||
9 | ===================== | ||
10 | `my-x200` - A Debian/Devuan service dedicated to Thinkpads X200 | ||
11 | Copyright (C) 2021 Robert Alessi <alessi@robertalessi.net> | ||
12 | |||
13 | This program is free software; you can redistribute it and/or | ||
14 | modify it under the terms of the GNU General Public License | ||
15 | as published by the Free Software Foundation; either version 3 | ||
16 | of the License, or (at your option) any later version. | ||
17 | |||
18 | This program is distributed in the hope that it will be useful, | ||
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | GNU General Public License for more details. | ||
22 | |||
23 | You should have received a copy of the GNU General Public License | ||
24 | along with this program; if not, write to the Free Software | ||
25 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
26 | 02110-1301, USA. | ||
27 | |||
28 | Overview | ||
29 | ======== | ||
30 | `my-x200` is a simple script primarily designed to make the distinctive | ||
31 | whining noise of Thinkpads X200 disappear. But it can also be used on | ||
32 | other laptops. | ||
33 | |||
34 | It is written to be used on [Devuan | ||
35 | GNU+Linux](https://www.devuan.org/) but it should work on other | ||
36 | Debian-based distributions. | ||
37 | |||
38 | Configuration | ||
39 | ------------- | ||
40 | Once installed, `my-x200` is configured by editing | ||
41 | `/etc/default/my-x200`. | ||
42 | |||
43 | Noise Removal | ||
44 | ------------- | ||
45 | Set the variable `is_thinkpad_x200` to `yes` (which is the default | ||
46 | value). The default frequency rate should work. It may be change by | ||
47 | modifying the value of `PWMFREQ_RATE`. | ||
48 | |||
49 | Privacy Settings | ||
50 | ---------------- | ||
51 | `/etc/default/my-x200` also provides a “Privacy settings” section: if | ||
52 | `enable_privacy` is set to `true`, then the wired internet interface | ||
53 | that may or may not be connected to the internet will have its MAC | ||
54 | address spoofed at startup. (The wireless interfaces must also be | ||
55 | spoofed, but this can be handled by wpa_supplicant: see below.) | ||
56 | Additionally, `my-x200` will delete `/var/lib/dhcpcd/duid`, and use | ||
57 | `/proc/sys/kernel/random/boot_id` to generate a new DUID-LLT based | ||
58 | file with an updated timestamp. A new DUID is generated each time the | ||
59 | computer is started. | ||
60 | |||
61 | Backup | ||
62 | ------ | ||
63 | Finally `my-x200` has the ability to backup essential files or | ||
64 | directories—for instance to a backup disk mounted inside the dock. Of | ||
65 | course, the backup process is triggered on certain conditions only: | ||
66 | |||
67 | 1. The option must be enabled in the `/etc/default/my-x200` file. | ||
68 | 2. The disk must be mounted. | ||
69 | 3. An (empty) `dobackup` file must be present in the backup directory. | ||
70 | |||
71 | Then, once these conditions are met, the backup process is triggered | ||
72 | whenever the service is stopped. | ||
73 | |||
74 | Installation | ||
75 | ============ | ||
76 | |||
77 | 1. Clone this repository locally. | ||
78 | 2. Do `make debian`. | ||
79 | 3. Install the generated `my-x200` `.deb` package as root with `dpkg | ||
80 | -i`. | ||
81 | 4. Edit `/etc/default/my-x200`. | ||
82 | |||
83 | Alternatively, a `.deb` file ready to be installed and its associated | ||
84 | `.dsc` source package file are provided in this repository. Once | ||
85 | these two files and the corresponding two source files `.orig.tar.gz` | ||
86 | and `debian.tar.xz` are downloaded in the same directory, it is | ||
87 | advisable to verify the signature like so:— | ||
88 | |||
89 | 1. Download `my-x200` master tarball: <> | ||
90 | 2. Import the developer's [public PGP | ||
91 | key](https://pgp.ocf.berkeley.edu/pks/lookup?search=0x1773e9248085c8c7), | ||
92 | like so: `gpg --recv-keys 8085C8C7` | ||
93 | 3. Verify the signature: `dscverify --keyring ~/.gnupg/pubring.gpg | ||
94 | my-x200_<ver>.dsc` (Replace `<ver>` with the actual release | ||
95 | number.) | ||
96 | |||
97 | For a good GPG cheat sheet, see [here](https://guides.library.illinois.edu/data_encryption/gpgcheatsheet). | ||
98 | |||
99 | Use and recommended configuration | ||
100 | --------------------------------- | ||
101 | > The command `rc-update` that is used below refer to `openrc`. Other | ||
102 | > init systems use other commands. Please adapt. | ||
103 | |||
104 | It is advisable to use my-x200 in conjunction with `wpa_supplicant` | ||
105 | and `dhcpcd` only. In addition, `wpagui` and `dhcpcd-gtk` are also | ||
106 | recommended to be able to configure the network from systray | ||
107 | applets. If so, `wicd` may be disabled: as root, simply do `rc-update | ||
108 | del wicd`. | ||
109 | |||
110 | ### `wpa_supplicant` | ||
111 | For this to work properly, it is important to have these lines in | ||
112 | `/etc/wpa_supplicant/wpa_supplicant.conf`: | ||
113 | |||
114 | ```` | ||
115 | ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev | ||
116 | update_config=1 | ||
117 | mac_addr=1 | ||
118 | preassoc_mac_addr=1 | ||
119 | ```` | ||
120 | |||
121 | (For additional security, do (as root) `chmod 700 | ||
122 | /etc/wpa_supplicant`) | ||
123 | |||
124 | ### `dhcpcd` | ||
125 | And these settings in `/etc/dhcpcd.conf`: | ||
126 | |||
127 | ```` | ||
128 | hostname "localhost" | ||
129 | hostname_short | ||
130 | ```` | ||
131 | |||
132 | ### `/etc/network/interfaces` | ||
133 | Finally, `/etc/network/interfaces` should look like this:— | ||
134 | |||
135 | ```` | ||
136 | # This file describes the network interfaces available on your system | ||
137 | # and how to activate them. For more information, see interfaces(5). | ||
138 | |||
139 | source /etc/network/interfaces.d/* | ||
140 | |||
141 | # The loopback network interface | ||
142 | auto lo | ||
143 | iface lo inet loopback | ||
144 | |||
145 | # The primary network interface | ||
146 | allow-hotplug eth0 | ||
147 | iface eth0 inet manual | ||
148 | |||
149 | # wlan interface | ||
150 | allow-hotplug wlan0 | ||
151 | iface wlan0 inet manual | ||
152 | wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf | ||
153 | ```` | ||
154 | |||
155 | Do Not Use | ||
156 | ---------- | ||
157 | 1. NetworkManager | ||
158 | 2. Avahi | ||
159 | |||
160 | To disable `avahi`, do (as root): | ||
161 | |||
162 | ```` | ||
163 | rc-update del avahi-daemon | ||
164 | chmod -x /etc/network/if-up.d/avahi-daemon | ||
165 | ```` | ||
166 | |||
167 | Further Information | ||
168 | ------------------- | ||
169 | More information in `my-x200` initd file: | ||
170 | <https://git.robertalessi.net/my-x200/tree/my-x200.confd> | ||
diff --git a/about.html b/about.html new file mode 100644 index 0000000..30290f6 --- /dev/null +++ b/about.html | |||
@@ -0,0 +1,104 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> | ||
3 | <head> | ||
4 | <meta charset="utf-8" /> | ||
5 | <meta name="generator" content="pandoc" /> | ||
6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> | ||
7 | <meta name="author" content="Robert Alessi" /> | ||
8 | <title>The my-x200 package – README file</title> | ||
9 | <style type="text/css"> | ||
10 | code{white-space: pre-wrap;} | ||
11 | span.smallcaps{font-variant: small-caps;} | ||
12 | span.underline{text-decoration: underline;} | ||
13 | div.column{display: inline-block; vertical-align: top; width: 50%;} | ||
14 | </style> | ||
15 | </head> | ||
16 | <body> | ||
17 | <header> | ||
18 | <h1 class="title">The my-x200 package – README file</h1> | ||
19 | <p class="subtitle">A Debian/Devuan service dedicated to Thinkpads X200</p> | ||
20 | <p class="author">Robert Alessi</p> | ||
21 | </header> | ||
22 | <h1 id="license-and-disclamer">License and Disclamer</h1> | ||
23 | <p><code>my-x200</code> - A Debian/Devuan service dedicated to Thinkpads X200 Copyright (C) 2021 Robert Alessi <a href="mailto:alessi@robertalessi.net">alessi@robertalessi.net</a></p> | ||
24 | <p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.</p> | ||
25 | <p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p> | ||
26 | <p>You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</p> | ||
27 | <h1 id="overview">Overview</h1> | ||
28 | <p><code>my-x200</code> is a simple script primarily designed to make the distinctive whining noise of Thinkpads X200 disappear. But it can also be used on other laptops.</p> | ||
29 | <p>It is written to be used on <a href="https://www.devuan.org/">Devuan GNU+Linux</a> but it should work on other Debian-based distributions.</p> | ||
30 | <h2 id="configuration">Configuration</h2> | ||
31 | <p>Once installed, <code>my-x200</code> is configured by editing <code>/etc/default/my-x200</code>.</p> | ||
32 | <h2 id="noise-removal">Noise Removal</h2> | ||
33 | <p>Set the variable <code>is_thinkpad_x200</code> to <code>yes</code> (which is the default value). The default frequency rate should work. It may be change by modifying the value of <code>PWMFREQ_RATE</code>.</p> | ||
34 | <h2 id="privacy-settings">Privacy Settings</h2> | ||
35 | <p><code>/etc/default/my-x200</code> also provides a “Privacy settings” section: if <code>enable_privacy</code> is set to <code>true</code>, then the wired internet interface that may or may not be connected to the internet will have its MAC address spoofed at startup. (The wireless interfaces must also be spoofed, but this can be handled by wpa_supplicant: see below.) Additionally, <code>my-x200</code> will delete <code>/var/lib/dhcpcd/duid</code>, and use <code>/proc/sys/kernel/random/boot_id</code> to generate a new DUID-LLT based file with an updated timestamp. A new DUID is generated each time the computer is started.</p> | ||
36 | <h2 id="backup">Backup</h2> | ||
37 | <p>Finally <code>my-x200</code> has the ability to backup essential files or directories—for instance to a backup disk mounted inside the dock. Of course, the backup process is triggered on certain conditions only:</p> | ||
38 | <ol type="1"> | ||
39 | <li>The option must be enabled in the <code>/etc/default/my-x200</code> file.</li> | ||
40 | <li>The disk must be mounted.</li> | ||
41 | <li>An (empty) <code>dobackup</code> file must be present in the backup directory.</li> | ||
42 | </ol> | ||
43 | <p>Then, once these conditions are met, the backup process is triggered whenever the service is stopped.</p> | ||
44 | <h1 id="installation">Installation</h1> | ||
45 | <ol type="1"> | ||
46 | <li>Clone this repository locally.</li> | ||
47 | <li>Do <code>make debian</code>.</li> | ||
48 | <li>Install the generated <code>my-x200</code> <code>.deb</code> package as root with <code>dpkg -i</code>.</li> | ||
49 | <li>Edit <code>/etc/default/my-x200</code>.</li> | ||
50 | </ol> | ||
51 | <p>Alternatively, a <code>.deb</code> file ready to be installed and its associated <code>.dsc</code> source package file are provided in this repository. Once these two files and the corresponding two source files <code>.orig.tar.gz</code> and <code>debian.tar.xz</code> are downloaded in the same directory, it is advisable to verify the signature like so:—</p> | ||
52 | <ol type="1"> | ||
53 | <li>Download <code>my-x200</code> master tarball: <></li> | ||
54 | <li>Import the developer’s <a href="https://pgp.ocf.berkeley.edu/pks/lookup?search=0x1773e9248085c8c7">public PGP key</a>, like so: <code>gpg --recv-keys 8085C8C7</code></li> | ||
55 | <li>Verify the signature: <code>dscverify --keyring ~/.gnupg/pubring.gpg my-x200_<ver>.dsc</code> (Replace <code><ver></code> with the actual release number.)</li> | ||
56 | </ol> | ||
57 | <p>For a good GPG cheat sheet, see <a href="https://guides.library.illinois.edu/data_encryption/gpgcheatsheet">here</a>.</p> | ||
58 | <h2 id="use-and-recommended-configuration">Use and recommended configuration</h2> | ||
59 | <blockquote> | ||
60 | <p>The command <code>rc-update</code> that is used below refer to <code>openrc</code>. Other init systems use other commands. Please adapt.</p> | ||
61 | </blockquote> | ||
62 | <p>It is advisable to use my-x200 in conjunction with <code>wpa_supplicant</code> and <code>dhcpcd</code> only. In addition, <code>wpagui</code> and <code>dhcpcd-gtk</code> are also recommended to be able to configure the network from systray applets. If so, <code>wicd</code> may be disabled: as root, simply do <code>rc-update del wicd</code>.</p> | ||
63 | <h3 id="wpa_supplicant"><code>wpa_supplicant</code></h3> | ||
64 | <p>For this to work properly, it is important to have these lines in <code>/etc/wpa_supplicant/wpa_supplicant.conf</code>:</p> | ||
65 | <pre><code>ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev | ||
66 | update_config=1 | ||
67 | mac_addr=1 | ||
68 | preassoc_mac_addr=1</code></pre> | ||
69 | <p>(For additional security, do (as root) <code>chmod 700 /etc/wpa_supplicant</code>)</p> | ||
70 | <h3 id="dhcpcd"><code>dhcpcd</code></h3> | ||
71 | <p>And these settings in <code>/etc/dhcpcd.conf</code>:</p> | ||
72 | <pre><code>hostname "localhost" | ||
73 | hostname_short</code></pre> | ||
74 | <h3 id="etcnetworkinterfaces"><code>/etc/network/interfaces</code></h3> | ||
75 | <p>Finally, <code>/etc/network/interfaces</code> should look like this:—</p> | ||
76 | <pre><code># This file describes the network interfaces available on your system | ||
77 | # and how to activate them. For more information, see interfaces(5). | ||
78 | |||
79 | source /etc/network/interfaces.d/* | ||
80 | |||
81 | # The loopback network interface | ||
82 | auto lo | ||
83 | iface lo inet loopback | ||
84 | |||
85 | # The primary network interface | ||
86 | allow-hotplug eth0 | ||
87 | iface eth0 inet manual | ||
88 | |||
89 | # wlan interface | ||
90 | allow-hotplug wlan0 | ||
91 | iface wlan0 inet manual | ||
92 | wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf</code></pre> | ||
93 | <h2 id="do-not-use">Do Not Use</h2> | ||
94 | <ol type="1"> | ||
95 | <li>NetworkManager</li> | ||
96 | <li>Avahi</li> | ||
97 | </ol> | ||
98 | <p>To disable <code>avahi</code>, do (as root):</p> | ||
99 | <pre><code>rc-update del avahi-daemon | ||
100 | chmod -x /etc/network/if-up.d/avahi-daemon</code></pre> | ||
101 | <h2 id="further-information">Further Information</h2> | ||
102 | <p>More information in <code>my-x200</code> initd file: <a href="https://git.robertalessi.net/my-x200/tree/my-x200.confd" class="uri">https://git.robertalessi.net/my-x200/tree/my-x200.confd</a></p> | ||
103 | </body> | ||
104 | </html> | ||
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..ed968ce --- /dev/null +++ b/debian/changelog | |||
@@ -0,0 +1,5 @@ | |||
1 | my-x200 (0.6-1) UNRELEASED; urgency=medium | ||
2 | |||
3 | * Initial release. | ||
4 | |||
5 | -- Robert Alessi <alessi@robertalessi.net> Sat, 06 Feb 2021 11:14:01 +0100 | ||
diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat | |||
@@ -0,0 +1 @@ | |||
10 | |||
diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b3cc4bd --- /dev/null +++ b/debian/control | |||
@@ -0,0 +1,17 @@ | |||
1 | Source: my-x200 | ||
2 | Maintainer: Robert Alessi <alessi@robertalessi.net> | ||
3 | Section: misc | ||
4 | Priority: optional | ||
5 | Standards-Version: 4.3.0 | ||
6 | Build-Depends: debhelper (>= 10) | ||
7 | Homepage: http://git.robertalessi.net/my-x200 | ||
8 | |||
9 | Package: my-x200 | ||
10 | Architecture: any | ||
11 | Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base, intel-gpu-tools, rsync, | ||
12 | macchanger, rfkill, acpi-support-base | ||
13 | Recommends: rsnapshot | ||
14 | Description: Service dedicated to Thinkpads X200 | ||
15 | my-x200 is a simple service primarily designed to make the | ||
16 | distinctive whining noise of Thinkpads X200 disappear. But it can | ||
17 | also be used on other laptops. | ||
diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..3c6cb99 --- /dev/null +++ b/debian/copyright | |||
@@ -0,0 +1,29 @@ | |||
1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
2 | Upstream-Name: my-x200 | ||
3 | Source: <http://git.robertalessi.net/my-x200> | ||
4 | |||
5 | Files: * | ||
6 | Copyright: 2021 Robert Alessi <alessi@robertalessi.net> | ||
7 | License: GPL-3.0+ | ||
8 | |||
9 | Files: debian/* | ||
10 | Copyright: 2021 Robert Alessi <alessi@robertalessi.net> | ||
11 | License: GPL-3.0+ | ||
12 | |||
13 | License: GPL-3.0+ | ||
14 | This program is free software: you can redistribute it and/or modify | ||
15 | it under the terms of the GNU General Public License as published by | ||
16 | the Free Software Foundation, either version 3 of the License, or | ||
17 | (at your option) any later version. | ||
18 | . | ||
19 | This package is distributed in the hope that it will be useful, | ||
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | GNU General Public License for more details. | ||
23 | . | ||
24 | You should have received a copy of the GNU General Public License | ||
25 | along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
26 | . | ||
27 | On Debian systems, the complete text of the GNU General | ||
28 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". | ||
29 | |||
diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..8344154 --- /dev/null +++ b/debian/rules | |||
@@ -0,0 +1,9 @@ | |||
1 | #!/usr/bin/make -f | ||
2 | %: | ||
3 | dh $@ | ||
4 | |||
5 | override_dh_auto_install: | ||
6 | $(MAKE) DESTDIR=$$(pwd)/debian/my-x200/ install | ||
7 | |||
8 | override_dh_installinit: | ||
9 | dh_installinit --onlyscripts | ||
diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..46ebe02 --- /dev/null +++ b/debian/source/format | |||
@@ -0,0 +1 @@ | |||
3.0 (quilt) \ No newline at end of file | |||
diff --git a/makefile b/makefile new file mode 100644 index 0000000..68dd4a8 --- /dev/null +++ b/makefile | |||
@@ -0,0 +1,47 @@ | |||
1 | pkgname = my-x200 | ||
2 | exts := md html confd initd sh deb dsc orig.tar.gz debian.tar.xz | ||
3 | findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)") | ||
4 | pkgver := 0.6 | ||
5 | |||
6 | all: install | ||
7 | |||
8 | clean: | ||
9 | rm -rf .backup | ||
10 | find -iname "*~" | xargs rm -rf | ||
11 | rm -rf $(pkgname)-$(pkgver) | ||
12 | find ./* -type f -iname "makefile" $(findopts) > ls-R | ||
13 | find ./* -type d -iname "debian" >> ls-R | ||
14 | rm -rf etc | ||
15 | rsync -avPr --files-from=ls-R . .backup | ||
16 | rm -rf * | ||
17 | cp -p -r .backup/* . | ||
18 | rm -rf .backup | ||
19 | pandoc -s README.md -o about.html | ||
20 | |||
21 | prepare: | ||
22 | rm -rf $(pkgname)-$(pkgver) | ||
23 | debian/rules clean | ||
24 | rsync -avPr ./ $(pkgname)-$(pkgver) | ||
25 | tar czf $(pkgname)_$(pkgver).orig.tar.gz $(pkgname)-$(pkgver) | ||
26 | |||
27 | debian: prepare | ||
28 | $(MAKE) --directory=$(pkgname)-$(pkgver) debian_package | ||
29 | |||
30 | debian_package: | ||
31 | debuild | ||
32 | |||
33 | install: | ||
34 | install -Dm755 my-x200.initd $(DESTDIR)etc/init.d/my-x200 | ||
35 | install -Dm644 my-x200.confd $(DESTDIR)etc/default/my-x200 | ||
36 | install -Dm644 my-x200-lid.sh $(DESTDIR)etc/acpi/events/my-x200-lid | ||
37 | install -Dm644 my-x200-sleep.sh $(DESTDIR)etc/acpi/events/my-x200-sleep | ||
38 | install -Dm755 my-x200.sh $(DESTDIR)etc/acpi/my-x200.sh | ||
39 | |||
40 | uninstall: | ||
41 | rm -rf $(DESTDIR)etc/init.d/my-x200 | ||
42 | rm -rf $(DESTDIR)etc/default/my-x200 | ||
43 | rm -rf $(DESTDIR)etc/acpi/events/my-x200-lid | ||
44 | rm -rf $(DESTDIR)etc/acpi/events/my-x200-sleep | ||
45 | rm -rf $(DESTDIR)etc/acpi/my-x200.sh | ||
46 | |||
47 | .PHONY: all clean install uninstall prepare debian debian_package | ||
diff --git a/my-x200-lid.sh b/my-x200-lid.sh new file mode 100644 index 0000000..ee3bca6 --- /dev/null +++ b/my-x200-lid.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | event=button/lid.* | ||
2 | action=/etc/acpi/my-x200.sh %e | ||
diff --git a/my-x200-sleep.sh b/my-x200-sleep.sh new file mode 100644 index 0000000..65ce536 --- /dev/null +++ b/my-x200-sleep.sh | |||
@@ -0,0 +1,2 @@ | |||
1 | event=button/sleep.* | ||
2 | action=/etc/acpi/my-x200.sh %e | ||
diff --git a/my-x200.confd b/my-x200.confd new file mode 100644 index 0000000..74b941e --- /dev/null +++ b/my-x200.confd | |||
@@ -0,0 +1,79 @@ | |||
1 | # /etc/default/my-x200: config file for /etc/init.d/my-x200 | ||
2 | |||
3 | ######################################### | ||
4 | # Options to pass to the my-x200 daemon # | ||
5 | ######################################### | ||
6 | |||
7 | # Is this machine a Thinkpad X200? If so, my-x200 can eliminate the | ||
8 | # whining noise that is noticeable when the brightness of the screen | ||
9 | # is lowered. | ||
10 | |||
11 | is_thinkpad_x200="yes" # (yes|no) | ||
12 | |||
13 | PWMFREQ_RATE="0x8bb7b16dc5b6a" | ||
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, my-x200 will delete /var/lib/dhcpcd/duid, | ||
23 | # and generate a new DUID-LLT based file with an updated timestamp. | ||
24 | |||
25 | # IMPORTANT NOTICE: As dhcpcd uses ANY ONE network interface that is | ||
26 | # connected to the DHCP device to generate the DIUD-LLT file, the | ||
27 | # wireless interface MUST have its MAC address spoofed as well. To | ||
28 | # make wpa_supplicant handle this, add the following lines in | ||
29 | # /etc/wpa_supplicant/wpa_supplicant.conf: | ||
30 | # ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev | ||
31 | # update_config=1 | ||
32 | # mac_addr=1 | ||
33 | # preassoc_mac_addr=1 | ||
34 | |||
35 | # Finally, it is advisable to set the hostname to "localhost" and have | ||
36 | # "hostname_short" in /etc/dhcpcd.conf so that the actual hostname of | ||
37 | # the machine should not be sent to the DHCP server. | ||
38 | |||
39 | enable_privacy="false" # either 'true' or 'false' | ||
40 | wired_interface="" # supply the actual interface name! In case of | ||
41 | # doubt, see the output of 'ls /sys/class/net/' | ||
42 | |||
43 | ################## | ||
44 | # Backup options # | ||
45 | ################## | ||
46 | |||
47 | # Activate autobackup on shutdown (true/false)? | ||
48 | conf_autobackup="false" | ||
49 | # Use rsnaphot (true/false)? 'false' means 'use rsync': | ||
50 | use_rsnapshot="false" | ||
51 | |||
52 | ############################ | ||
53 | # rsync/rsnapshot settings # | ||
54 | ############################ | ||
55 | |||
56 | # Path to backup directory (note that rsnapshot additionally needs | ||
57 | # this to be specified as 'snapshot_root' in /etc/rsnapshot.conf): | ||
58 | conf_backup_path="/mnt/disk/snapshots" | ||
59 | |||
60 | # The following option applies both to rsync and rsnapshot. | ||
61 | # Control file. This (empty) file must exist in the backup directory: | ||
62 | conf_control_file="dobackup" | ||
63 | |||
64 | ###################### | ||
65 | # rsync-only setting # | ||
66 | ###################### | ||
67 | |||
68 | # rsync only option: | ||
69 | # Directories to backup: | ||
70 | conf_backup_dirs="/etc /root /usr/local /home" | ||
71 | |||
72 | ########################## | ||
73 | # rsnapshot-only setting # | ||
74 | ########################## | ||
75 | |||
76 | # Use the following line to have specific arguments passed to | ||
77 | # rsnapshot such as 'daily' or the like. By default, my-x200 uses | ||
78 | # 'alpha', which is already defined in /etc/rsnapshot.conf: | ||
79 | rsnapshot_args="alpha" | ||
diff --git a/my-x200.initd b/my-x200.initd new file mode 100644 index 0000000..5e1e7c1 --- /dev/null +++ b/my-x200.initd | |||
@@ -0,0 +1,124 @@ | |||
1 | #! /bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: my-x200 | ||
4 | # X-Start-Before: dhcpcd | ||
5 | # Required-Start: $remote_fs $local_fs | ||
6 | # Required-Stop: $remote_fs $local_fs | ||
7 | # X-Stop-After: xdm | ||
8 | # Default-Start: 2 3 4 5 | ||
9 | # Default-Stop: 0 1 6 | ||
10 | # Short-Description: Starts and stops my-x200 | ||
11 | # Description: Removes whining noise from Thinkpads X200, powers off the wifi on shutdown and optionally backups directories. | ||
12 | ### END INIT INFO | ||
13 | |||
14 | # Copyright 2018-2021 Robert Alessi | ||
15 | # Distributed under the terms of the GNU General Public License v2 | ||
16 | |||
17 | # Set variables | ||
18 | NAME=my-x200 | ||
19 | |||
20 | # Source init functions | ||
21 | . /lib/lsb/init-functions | ||
22 | |||
23 | # Read configuration variable file if it is present | ||
24 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
25 | |||
26 | x200_cmdfreq="/usr/bin/intel_reg" | ||
27 | pwmfreq="${PWMFREQ_RATE}" | ||
28 | x200_cmdfreq_args="write 0x00061254 $pwmfreq" | ||
29 | autobackup="${conf_autobackup}" | ||
30 | backup_path="${conf_backup_path}" | ||
31 | control_file="${conf_control_file}" | ||
32 | if [ "$use_rsnapshot" = "true" ] | ||
33 | then | ||
34 | backup_cmd="/usr/bin/rsnapshot" | ||
35 | backup_args="${rsnapshot_args}" | ||
36 | else | ||
37 | backup_cmd="/usr/bin/rsync" | ||
38 | backup_args="-aAX --relative --delete --quiet" | ||
39 | fi | ||
40 | |||
41 | set_pwmfreq() { | ||
42 | if [ "$is_thinkpad_x200" = "yes" ] | ||
43 | then | ||
44 | exec $x200_cmdfreq $x200_cmdfreq_args 2>/dev/null | ||
45 | fi | ||
46 | } | ||
47 | |||
48 | do_backup() { | ||
49 | if [ "$autobackup" = "true" ] | ||
50 | then | ||
51 | if [ -e "$backup_path"/"$control_file" ] | ||
52 | then | ||
53 | if [ "$use_rsnapshot" = "true" ] | ||
54 | then | ||
55 | $backup_cmd $backup_args | ||
56 | else | ||
57 | $backup_cmd $backup_args $conf_backup_dirs "$backup_path" | ||
58 | fi | ||
59 | fi | ||
60 | fi | ||
61 | } | ||
62 | |||
63 | do_privacy() { | ||
64 | if [ "$enable_privacy" = "true" ] | ||
65 | then | ||
66 | if [ -n "${wired_interface}" ] | ||
67 | then | ||
68 | printf '0004' > /var/lib/dhcpcd/duid | ||
69 | cat /proc/sys/kernel/random/boot_id >> /var/lib/dhcpcd/duid | ||
70 | /usr/bin/macchanger -r $wired_interface | ||
71 | fi | ||
72 | fi | ||
73 | } | ||
74 | |||
75 | do_refresh() { | ||
76 | set_pwmfreq | ||
77 | } | ||
78 | |||
79 | do_initbackup() { | ||
80 | do_backup | ||
81 | } | ||
82 | |||
83 | do_start() { | ||
84 | if [ "${RC_CMD}" = "restart" ] | ||
85 | then | ||
86 | /usr/sbin/rfkill block all | ||
87 | else | ||
88 | do_privacy | ||
89 | fi | ||
90 | /usr/sbin/rfkill block all | ||
91 | set_pwmfreq | ||
92 | } | ||
93 | |||
94 | do_stop() { | ||
95 | /usr/sbin/rfkill block all | ||
96 | do_backup | ||
97 | } | ||
98 | |||
99 | do_restart() { | ||
100 | /usr/sbin/rfkill block all | ||
101 | set_pwmfreq | ||
102 | } | ||
103 | |||
104 | case "$1" in | ||
105 | start) | ||
106 | do_start | ||
107 | ;; | ||
108 | stop) | ||
109 | do_stop | ||
110 | ;; | ||
111 | restart|force-reload) | ||
112 | do_restart | ||
113 | ;; | ||
114 | refresh) | ||
115 | do_refresh | ||
116 | ;; | ||
117 | initbackup) | ||
118 | do_initbackup | ||
119 | ;; | ||
120 | *) | ||
121 | echo "Usage: $NAME {start|stop|refresh|initbackup}" >&2 | ||
122 | exit 3 | ||
123 | ;; | ||
124 | esac | ||
diff --git a/my-x200.sh b/my-x200.sh new file mode 100644 index 0000000..a34d9b0 --- /dev/null +++ b/my-x200.sh | |||
@@ -0,0 +1,32 @@ | |||
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 | /bin/loginctl suspend | ||
10 | rc-service my-x200 restart | ||
11 | ;; | ||
12 | *) | ||
13 | logger "ACPI action undefined: $2" | ||
14 | ;; | ||
15 | esac | ||
16 | ;; | ||
17 | button/lid) | ||
18 | case "$3" in | ||
19 | close) | ||
20 | /bin/loginctl suspend | ||
21 | logger 'LID closed' | ||
22 | ;; | ||
23 | open) | ||
24 | logger 'LID opened' | ||
25 | rc-service my-x200 restart | ||
26 | ;; | ||
27 | *) | ||
28 | logger "ACPI action undefined: $3" | ||
29 | ;; | ||
30 | esac | ||
31 | ;; | ||
32 | esac | ||
diff --git a/my-x200_0.6-1.debian.tar.xz b/my-x200_0.6-1.debian.tar.xz new file mode 100644 index 0000000..5f56380 --- /dev/null +++ b/my-x200_0.6-1.debian.tar.xz | |||
Binary files differ | |||
diff --git a/my-x200_0.6-1.dsc b/my-x200_0.6-1.dsc new file mode 100644 index 0000000..c8ab0f8 --- /dev/null +++ b/my-x200_0.6-1.dsc | |||
@@ -0,0 +1,41 @@ | |||
1 | -----BEGIN PGP SIGNED MESSAGE----- | ||
2 | Hash: SHA256 | ||
3 | |||
4 | Format: 3.0 (quilt) | ||
5 | Source: my-x200 | ||
6 | Binary: my-x200 | ||
7 | Architecture: any | ||
8 | Version: 0.6-1 | ||
9 | Maintainer: Robert Alessi <alessi@robertalessi.net> | ||
10 | Homepage: http://git.robertalessi.net/my-x200 | ||
11 | Standards-Version: 4.3.0 | ||
12 | Build-Depends: debhelper (>= 10) | ||
13 | Package-List: | ||
14 | my-x200 deb misc optional arch=any | ||
15 | Checksums-Sha1: | ||
16 | 48169cfbdeedfaf9d6e5df7ee7a1efbcf8eee301 38550 my-x200_0.6.orig.tar.gz | ||
17 | 5ca2ffe91f4cabf2a9aadde92070528bde371c41 1388 my-x200_0.6-1.debian.tar.xz | ||
18 | Checksums-Sha256: | ||
19 | 245f193a55cbd0189f205460540c9e1caf19ba20ff5203ceaaad8c74f109e6ba 38550 my-x200_0.6.orig.tar.gz | ||
20 | c0890645148489f9ecd1e4a7a33d113146f7fd260398f0024c079c73506165d7 1388 my-x200_0.6-1.debian.tar.xz | ||
21 | Files: | ||
22 | e6135a04e73234cfa798726cc4ef58bc 38550 my-x200_0.6.orig.tar.gz | ||
23 | 3ff241ea3fb1a13aec56937db4e0be50 1388 my-x200_0.6-1.debian.tar.xz | ||
24 | |||
25 | -----BEGIN PGP SIGNATURE----- | ||
26 | |||
27 | iQJMBAEBCAA2FiEERaXhpjEUeDwRCTLxF3PpJICFyMcFAmAfrxAYHGFsZXNzaUBy | ||
28 | b2JlcnRhbGVzc2kubmV0AAoJEBdz6SSAhcjHpgUP/00JQYIUyOJolq39TSEbN3I6 | ||
29 | xdGWfi9/SEEqE19TA8g9H4PZT0vKfuCtLqxwLyFT46gwfOD8ZhWucL6WJ8dQEL+0 | ||
30 | kj2WAmF0tVnMKcIE6AqPBvX/jmqVSB736abCy8F+356yt8m48cEyI5O+mxbJ2g1q | ||
31 | qM7gOlBr1MpOoroR81ilLSDcMyDhDRYZ1PeMR/Y+pVBIy9bXpBDSeq5p7aO/+SKZ | ||
32 | lzoVObhUMX50Qr3dbI37SGDQmtTY7Deb8ORo8affZfKKlfZHdz3iwEajh0Blxp9O | ||
33 | 9Wt37Vs/HrVX49ej8hB1FT2voaUXEUuf+y3tmQghSOaMrYETYdfAsO+VPGSgkHZP | ||
34 | czSB9a71Ct2yYwmOGuuexT97quxj1GhhPWUdL7EuwNN/ILzzmScyDhN++V3HemUt | ||
35 | lzpYJHCCwXFOnvpPR/8bmcPQ6sdkVCecBf6ziSHGBIJPK13GWnTJ1nwRikFx0ZyZ | ||
36 | +6l0Lx26FHumA3sFX1lGSW4A2PDmy2FfIwILc992Mzatu0tlpMmWU8LCs8mQZ2LR | ||
37 | Btjvq5ATBNll1VH3pjudSX421Y1ZPVIkcL7KtEdslA3gFN8DC0cA/DpxnG8K4xkr | ||
38 | Vzrhhq/2vRo/KAe97Ak3VdtEThaFvmjtScnCcHqJX94TouBH0k/BskvqrZjBbTJi | ||
39 | AgU/jsnFd9p/9Oi3CLwd | ||
40 | =p1JE | ||
41 | -----END PGP SIGNATURE----- | ||
diff --git a/my-x200_0.6-1_amd64.deb b/my-x200_0.6-1_amd64.deb new file mode 100644 index 0000000..8cd54a6 --- /dev/null +++ b/my-x200_0.6-1_amd64.deb | |||
Binary files differ | |||
diff --git a/my-x200_0.6.orig.tar.gz b/my-x200_0.6.orig.tar.gz new file mode 100644 index 0000000..cb9f27c --- /dev/null +++ b/my-x200_0.6.orig.tar.gz | |||
Binary files differ | |||