aboutsummaryrefslogtreecommitdiff
path: root/x200-my.initd
diff options
context:
space:
mode:
Diffstat (limited to 'x200-my.initd')
-rw-r--r--x200-my.initd39
1 files changed, 30 insertions, 9 deletions
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}