From 1c7e1f3efef80b9dc3e77b1231dde78eccae954f Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Thu, 19 Dec 2019 16:17:58 +0100 Subject: removed dependency to NetworkManager. added 'privacy settings' --- x200-my.initd | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'x200-my.initd') 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 @@ -#!/sbin/openrc-run +#!/usr/bin/openrc-run # Copyright 2018-2019 Robert Alessi # Distributed under the terms of the GNU General Public License v2 description="Removes whining noise from Thinkpads X200, powers off the wifi on shutdown and optionally backups directories." -command="/usr/bin/intel_reg" +x200_cmdfreq="/usr/bin/intel_reg" pwmfreq="${PWMFREQ_RATE}" -command_args="write 0x00061254 $pwmfreq" +x200_cmdfreq_args="write 0x00061254 $pwmfreq" extra_started_commands="initbackup" @@ -23,12 +23,17 @@ else backup_args="-aAX --relative --delete --quiet" fi +depend() { + need localmount + before net +} + do_listofpackages() { /usr/bin/pacman -Qqetn > "$backup_path"/pkglist.txt /usr/bin/pacman -Qqem > "$backup_path"/foreignpkglist.txt } -do_backup () { +do_backup() { if [ $autobackup = "true" ] then if [ -e "$backup_path"/"$control_file" ] @@ -50,20 +55,36 @@ do_backup () { fi } +do_privacy() { + if [ $enable_privacy = "true" ] + then + if [ -n ${wired_interface:+1} ] + then + rm -rf /etc/dhcpcd.duid + /sbin/macchanger -r $wired_interface + fi + fi +} + initbackup() { do_backup } start() { - if [ "${RC_CMD}" = "restart" ]; + if [ "${RC_CMD}" = "restart" ] then - /usr/bin/nmcli radio all off + /usr/sbin/rfkill block all + else + do_privacy + fi + /usr/sbin/rfkill block all + if [ $is_thinkpad_x200 = "yes" ] + then + exec $x200_cmdfreq $x200_cmdfreq_args 2>/dev/null fi - - exec $command $command_args 2>/dev/null } stop() { - /usr/bin/nmcli radio all off + /usr/sbin/rfkill block all do_backup } -- cgit v1.2.3