diff options
Diffstat (limited to 'x200-my.initd')
-rw-r--r-- | x200-my.initd | 39 |
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 | ||
5 | description="Removes whining noise from Thinkpads X200, powers off the wifi on shutdown and optionally backups directories." | 5 | description="Removes whining noise from Thinkpads X200, powers off the wifi on shutdown and optionally backups directories." |
6 | 6 | ||
7 | command="/usr/bin/intel_reg" | 7 | x200_cmdfreq="/usr/bin/intel_reg" |
8 | pwmfreq="${PWMFREQ_RATE}" | 8 | pwmfreq="${PWMFREQ_RATE}" |
9 | 9 | ||
10 | command_args="write 0x00061254 $pwmfreq" | 10 | x200_cmdfreq_args="write 0x00061254 $pwmfreq" |
11 | 11 | ||
12 | extra_started_commands="initbackup" | 12 | extra_started_commands="initbackup" |
13 | 13 | ||
@@ -23,12 +23,17 @@ else | |||
23 | backup_args="-aAX --relative --delete --quiet" | 23 | backup_args="-aAX --relative --delete --quiet" |
24 | fi | 24 | fi |
25 | 25 | ||
26 | depend() { | ||
27 | need localmount | ||
28 | before net | ||
29 | } | ||
30 | |||
26 | do_listofpackages() { | 31 | do_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 | ||
31 | do_backup () { | 36 | do_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 | ||
58 | do_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 | |||
53 | initbackup() { | 69 | initbackup() { |
54 | do_backup | 70 | do_backup |
55 | } | 71 | } |
56 | 72 | ||
57 | start() { | 73 | start() { |
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 | ||
66 | stop() { | 87 | stop() { |
67 | /usr/bin/nmcli radio all off | 88 | /usr/sbin/rfkill block all |
68 | do_backup | 89 | do_backup |
69 | } | 90 | } |