Turning Bluetooth off/on & Void Linux improvements (#269)

This commit is contained in:
Animesh Sahu 2021-11-04 07:32:50 +00:00 committed by GitHub
parent a48e9193fa
commit 4fee7b680b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 27 deletions

View File

@ -130,7 +130,7 @@ elif [ -f /etc/os-release ];then
;; ;;
void) void)
detected_distro "Void Linux" detected_distro "Void Linux"
xbps-install -Suy python3 python3-pip python3-devel python3-setuptools base-devel dmidecode xbps-install -Sy python3 python3-pip python3-devel python3-setuptools base-devel dmidecode
;; ;;
*) #Any other distro *) #Any other distro
manual_install manual_install

View File

@ -14,6 +14,7 @@ import warnings
import configparser import configparser
from math import isclose from math import isclose
from pathlib import Path from pathlib import Path
from shutil import which
from subprocess import getoutput, call, run, check_output, DEVNULL from subprocess import getoutput, call, run, check_output, DEVNULL
@ -293,6 +294,7 @@ def deploy_daemon():
# deploy cpufreqctl script func call # deploy cpufreqctl script func call
cpufreqctl() cpufreqctl()
if which("bluetoothctl") is not None:
print("* Turn off bluetooth on boot") print("* Turn off bluetooth on boot")
btconf = Path("/etc/bluetooth/main.conf") btconf = Path("/etc/bluetooth/main.conf")
try: try:
@ -305,6 +307,8 @@ def deploy_daemon():
f.write(content.replace(orig_set, change_set)) f.write(content.replace(orig_set, change_set))
except Exception as e: except Exception as e:
print(f"\nERROR:\nWas unable to turn off bluetooth on boot\n{repr(e)}") print(f"\nERROR:\nWas unable to turn off bluetooth on boot\n{repr(e)}")
else:
print("* Turn off bluetooth on boot [skipping] (package providing bluetooth access is not present)")
auto_cpufreq_stats_path.touch(exist_ok=True) auto_cpufreq_stats_path.touch(exist_ok=True)
@ -329,6 +333,7 @@ def remove():
print("\n" + "-" * 21 + " Removing auto-cpufreq daemon " + "-" * 22 + "\n") print("\n" + "-" * 21 + " Removing auto-cpufreq daemon " + "-" * 22 + "\n")
if which("bluetoothctl") is not None:
print("* Turn on bluetooth on boot") print("* Turn on bluetooth on boot")
btconf = "/etc/bluetooth/main.conf" btconf = "/etc/bluetooth/main.conf"
try: try:
@ -341,6 +346,8 @@ def remove():
f.write(content.replace(change_set, orig_set)) f.write(content.replace(change_set, orig_set))
except Exception as e: except Exception as e:
print(f"\nERROR:\nWas unable to turn on bluetooth on boot\n{repr(e)}") print(f"\nERROR:\nWas unable to turn on bluetooth on boot\n{repr(e)}")
else:
print("* Turn on bluetooth on boot [skipping] (package providing bluetooth access is not present)")
# run auto-cpufreq daemon install script # run auto-cpufreq daemon install script
call("/usr/bin/auto-cpufreq-remove", shell=True) call("/usr/bin/auto-cpufreq-remove", shell=True)

View File

@ -37,7 +37,6 @@ sv_cmd() {
if [ "$(ps h -o comm 1)" = "runit" ];then if [ "$(ps h -o comm 1)" = "runit" ];then
if [ -f /etc/os-release ];then if [ -f /etc/os-release ];then
eval "$(cat /etc/os-release)" eval "$(cat /etc/os-release)"
separator
case $ID in case $ID in
void) void)
runit_ln /etc /var runit_ln /etc /var

View File

@ -25,7 +25,6 @@ rm_sv() {
if [ "$(ps h -o comm 1)" = "runit" ];then if [ "$(ps h -o comm 1)" = "runit" ];then
if [ -f /etc/os-release ];then if [ -f /etc/os-release ];then
eval "$(cat /etc/os-release)" eval "$(cat /etc/os-release)"
separator
case $ID in case $ID in
void) void)
rm_sv /etc /var ;; rm_sv /etc /var ;;