aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2021-02-07 11:50:26 +0100
committerRobert Alessi <alessi@robertalessi.net>2021-02-07 11:50:26 +0100
commit7d0a96e7b5cf4541b07570d54829e152ff9b9a5c (patch)
tree349c3fc6cb6a3a44eb28f12c281ac4616d59775f
downloadmy-x200-7d0a96e7b5cf4541b07570d54829e152ff9b9a5c.tar.gz
initial Debian/Devuan commit
-rw-r--r--README.md170
-rw-r--r--about.html104
-rw-r--r--debian/changelog5
-rw-r--r--debian/compat1
-rw-r--r--debian/control17
-rw-r--r--debian/copyright29
-rwxr-xr-xdebian/rules9
-rw-r--r--debian/source/format1
-rw-r--r--makefile47
-rw-r--r--my-x200-lid.sh2
-rw-r--r--my-x200-sleep.sh2
-rw-r--r--my-x200.confd79
-rw-r--r--my-x200.initd124
-rw-r--r--my-x200.sh32
-rw-r--r--my-x200_0.6-1.debian.tar.xzbin0 -> 1388 bytes
-rw-r--r--my-x200_0.6-1.dsc41
-rw-r--r--my-x200_0.6-1_amd64.debbin0 -> 4652 bytes
-rw-r--r--my-x200_0.6.orig.tar.gzbin0 -> 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---
2author:
3- Robert Alessi
4title: 'The my-x200 package – README file'
5subtitle: 'A Debian/Devuan service dedicated to Thinkpads X200'
6---
7
8License and Disclamer
9=====================
10`my-x200` - A Debian/Devuan service dedicated to Thinkpads X200
11Copyright (C) 2021 Robert Alessi <alessi@robertalessi.net>
12
13This program is free software; you can redistribute it and/or
14modify it under the terms of the GNU General Public License
15as published by the Free Software Foundation; either version 3
16of the License, or (at your option) any later version.
17
18This program is distributed in the hope that it will be useful,
19but WITHOUT ANY WARRANTY; without even the implied warranty of
20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21GNU General Public License for more details.
22
23You should have received a copy of the GNU General Public License
24along with this program; if not, write to the Free Software
25Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2602110-1301, USA.
27
28Overview
29========
30`my-x200` is a simple script primarily designed to make the distinctive
31whining noise of Thinkpads X200 disappear. But it can also be used on
32other laptops.
33
34It is written to be used on [Devuan
35GNU+Linux](https://www.devuan.org/) but it should work on other
36Debian-based distributions.
37
38Configuration
39-------------
40Once installed, `my-x200` is configured by editing
41`/etc/default/my-x200`.
42
43Noise Removal
44-------------
45Set the variable `is_thinkpad_x200` to `yes` (which is the default
46value). The default frequency rate should work. It may be change by
47modifying the value of `PWMFREQ_RATE`.
48
49Privacy 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
53that may or may not be connected to the internet will have its MAC
54address spoofed at startup. (The wireless interfaces must also be
55spoofed, but this can be handled by wpa_supplicant: see below.)
56Additionally, `my-x200` will delete `/var/lib/dhcpcd/duid`, and use
57`/proc/sys/kernel/random/boot_id` to generate a new DUID-LLT based
58file with an updated timestamp. A new DUID is generated each time the
59computer is started.
60
61Backup
62------
63Finally `my-x200` has the ability to backup essential files or
64directories—for instance to a backup disk mounted inside the dock. Of
65course, the backup process is triggered on certain conditions only:
66
671. The option must be enabled in the `/etc/default/my-x200` file.
682. The disk must be mounted.
693. An (empty) `dobackup` file must be present in the backup directory.
70
71Then, once these conditions are met, the backup process is triggered
72whenever the service is stopped.
73
74Installation
75============
76
771. Clone this repository locally.
782. Do `make debian`.
793. Install the generated `my-x200` `.deb` package as root with `dpkg
80 -i`.
814. Edit `/etc/default/my-x200`.
82
83Alternatively, a `.deb` file ready to be installed and its associated
84`.dsc` source package file are provided in this repository. Once
85these two files and the corresponding two source files `.orig.tar.gz`
86and `debian.tar.xz` are downloaded in the same directory, it is
87advisable to verify the signature like so:—
88
891. Download `my-x200` master tarball: <>
902. Import the developer's [public PGP
91 key](https://pgp.ocf.berkeley.edu/pks/lookup?search=0x1773e9248085c8c7),
92 like so: `gpg --recv-keys 8085C8C7`
933. Verify the signature: `dscverify --keyring ~/.gnupg/pubring.gpg
94 my-x200_<ver>.dsc` (Replace `<ver>` with the actual release
95 number.)
96
97For a good GPG cheat sheet, see [here](https://guides.library.illinois.edu/data_encryption/gpgcheatsheet).
98
99Use 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
104It is advisable to use my-x200 in conjunction with `wpa_supplicant`
105and `dhcpcd` only. In addition, `wpagui` and `dhcpcd-gtk` are also
106recommended to be able to configure the network from systray
107applets. If so, `wicd` may be disabled: as root, simply do `rc-update
108del wicd`.
109
110### `wpa_supplicant`
111For this to work properly, it is important to have these lines in
112`/etc/wpa_supplicant/wpa_supplicant.conf`:
113
114````
115ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
116update_config=1
117mac_addr=1
118preassoc_mac_addr=1
119````
120
121(For additional security, do (as root) `chmod 700
122/etc/wpa_supplicant`)
123
124### `dhcpcd`
125And these settings in `/etc/dhcpcd.conf`:
126
127````
128hostname "localhost"
129hostname_short
130````
131
132### `/etc/network/interfaces`
133Finally, `/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
139source /etc/network/interfaces.d/*
140
141# The loopback network interface
142auto lo
143iface lo inet loopback
144
145# The primary network interface
146allow-hotplug eth0
147iface eth0 inet manual
148
149# wlan interface
150allow-hotplug wlan0
151iface wlan0 inet manual
152wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
153````
154
155Do Not Use
156----------
1571. NetworkManager
1582. Avahi
159
160To disable `avahi`, do (as root):
161
162````
163rc-update del avahi-daemon
164chmod -x /etc/network/if-up.d/avahi-daemon
165````
166
167Further Information
168-------------------
169More 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: &lt;&gt;</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_&lt;ver&gt;.dsc</code> (Replace <code>&lt;ver&gt;</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
66update_config=1
67mac_addr=1
68preassoc_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 &quot;localhost&quot;
73hostname_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
79source /etc/network/interfaces.d/*
80
81# The loopback network interface
82auto lo
83iface lo inet loopback
84
85# The primary network interface
86allow-hotplug eth0
87iface eth0 inet manual
88
89# wlan interface
90allow-hotplug wlan0
91iface wlan0 inet manual
92wpa-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
100chmod -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 @@
1my-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 @@
1Source: my-x200
2Maintainer: Robert Alessi <alessi@robertalessi.net>
3Section: misc
4Priority: optional
5Standards-Version: 4.3.0
6Build-Depends: debhelper (>= 10)
7Homepage: http://git.robertalessi.net/my-x200
8
9Package: my-x200
10Architecture: any
11Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base, intel-gpu-tools, rsync,
12 macchanger, rfkill, acpi-support-base
13Recommends: rsnapshot
14Description: 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 @@
1Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2Upstream-Name: my-x200
3Source: <http://git.robertalessi.net/my-x200>
4
5Files: *
6Copyright: 2021 Robert Alessi <alessi@robertalessi.net>
7License: GPL-3.0+
8
9Files: debian/*
10Copyright: 2021 Robert Alessi <alessi@robertalessi.net>
11License: GPL-3.0+
12
13License: 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
5override_dh_auto_install:
6 $(MAKE) DESTDIR=$$(pwd)/debian/my-x200/ install
7
8override_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 @@
1pkgname = my-x200
2exts := md html confd initd sh deb dsc orig.tar.gz debian.tar.xz
3findopts := $(foreach ext,$(exts),-or -iname "*.$(ext)")
4pkgver := 0.6
5
6all: install
7
8clean:
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
21prepare:
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
27debian: prepare
28 $(MAKE) --directory=$(pkgname)-$(pkgver) debian_package
29
30debian_package:
31 debuild
32
33install:
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
40uninstall:
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 @@
1event=button/lid.*
2action=/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 @@
1event=button/sleep.*
2action=/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
11is_thinkpad_x200="yes" # (yes|no)
12
13PWMFREQ_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
39enable_privacy="false" # either 'true' or 'false'
40wired_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)?
48conf_autobackup="false"
49# Use rsnaphot (true/false)? 'false' means 'use rsync':
50use_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):
58conf_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:
62conf_control_file="dobackup"
63
64######################
65# rsync-only setting #
66######################
67
68# rsync only option:
69# Directories to backup:
70conf_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:
79rsnapshot_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
18NAME=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
26x200_cmdfreq="/usr/bin/intel_reg"
27pwmfreq="${PWMFREQ_RATE}"
28x200_cmdfreq_args="write 0x00061254 $pwmfreq"
29autobackup="${conf_autobackup}"
30backup_path="${conf_backup_path}"
31control_file="${conf_control_file}"
32if [ "$use_rsnapshot" = "true" ]
33then
34 backup_cmd="/usr/bin/rsnapshot"
35 backup_args="${rsnapshot_args}"
36else
37 backup_cmd="/usr/bin/rsync"
38 backup_args="-aAX --relative --delete --quiet"
39fi
40
41set_pwmfreq() {
42 if [ "$is_thinkpad_x200" = "yes" ]
43 then
44 exec $x200_cmdfreq $x200_cmdfreq_args 2>/dev/null
45 fi
46}
47
48do_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
63do_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
75do_refresh() {
76 set_pwmfreq
77}
78
79do_initbackup() {
80 do_backup
81}
82
83do_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
94do_stop() {
95 /usr/sbin/rfkill block all
96 do_backup
97}
98
99do_restart() {
100 /usr/sbin/rfkill block all
101 set_pwmfreq
102}
103
104case "$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 ;;
124esac
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
4case "$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 ;;
32esac
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-----
2Hash: SHA256
3
4Format: 3.0 (quilt)
5Source: my-x200
6Binary: my-x200
7Architecture: any
8Version: 0.6-1
9Maintainer: Robert Alessi <alessi@robertalessi.net>
10Homepage: http://git.robertalessi.net/my-x200
11Standards-Version: 4.3.0
12Build-Depends: debhelper (>= 10)
13Package-List:
14 my-x200 deb misc optional arch=any
15Checksums-Sha1:
16 48169cfbdeedfaf9d6e5df7ee7a1efbcf8eee301 38550 my-x200_0.6.orig.tar.gz
17 5ca2ffe91f4cabf2a9aadde92070528bde371c41 1388 my-x200_0.6-1.debian.tar.xz
18Checksums-Sha256:
19 245f193a55cbd0189f205460540c9e1caf19ba20ff5203ceaaad8c74f109e6ba 38550 my-x200_0.6.orig.tar.gz
20 c0890645148489f9ecd1e4a7a33d113146f7fd260398f0024c079c73506165d7 1388 my-x200_0.6-1.debian.tar.xz
21Files:
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
27iQJMBAEBCAA2FiEERaXhpjEUeDwRCTLxF3PpJICFyMcFAmAfrxAYHGFsZXNzaUBy
28b2JlcnRhbGVzc2kubmV0AAoJEBdz6SSAhcjHpgUP/00JQYIUyOJolq39TSEbN3I6
29xdGWfi9/SEEqE19TA8g9H4PZT0vKfuCtLqxwLyFT46gwfOD8ZhWucL6WJ8dQEL+0
30kj2WAmF0tVnMKcIE6AqPBvX/jmqVSB736abCy8F+356yt8m48cEyI5O+mxbJ2g1q
31qM7gOlBr1MpOoroR81ilLSDcMyDhDRYZ1PeMR/Y+pVBIy9bXpBDSeq5p7aO/+SKZ
32lzoVObhUMX50Qr3dbI37SGDQmtTY7Deb8ORo8affZfKKlfZHdz3iwEajh0Blxp9O
339Wt37Vs/HrVX49ej8hB1FT2voaUXEUuf+y3tmQghSOaMrYETYdfAsO+VPGSgkHZP
34czSB9a71Ct2yYwmOGuuexT97quxj1GhhPWUdL7EuwNN/ILzzmScyDhN++V3HemUt
35lzpYJHCCwXFOnvpPR/8bmcPQ6sdkVCecBf6ziSHGBIJPK13GWnTJ1nwRikFx0ZyZ
36+6l0Lx26FHumA3sFX1lGSW4A2PDmy2FfIwILc992Mzatu0tlpMmWU8LCs8mQZ2LR
37Btjvq5ATBNll1VH3pjudSX421Y1ZPVIkcL7KtEdslA3gFN8DC0cA/DpxnG8K4xkr
38Vzrhhq/2vRo/KAe97Ak3VdtEThaFvmjtScnCcHqJX94TouBH0k/BskvqrZjBbTJi
39AgU/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