From 8c77a6981602d68e953f1395ce63e0ddb7cfd953 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 25 Jun 2023 21:57:04 +0800 Subject: improved scripts syntax and made them more logical --- polybar-temp-autofix.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 polybar-temp-autofix.sh (limited to 'polybar-temp-autofix.sh') diff --git a/polybar-temp-autofix.sh b/polybar-temp-autofix.sh new file mode 100755 index 0000000..e18a77a --- /dev/null +++ b/polybar-temp-autofix.sh @@ -0,0 +1,16 @@ +#!/usr/bin/bash +if [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon3 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then + printf "fixing hwmon4 to hwmon3\n" + sed -i 's#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input#g' /home/system/.config/polybar/modules.ini + exit 0 +elif [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon4 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then + printf "fixing hwmon3 to hwmon4\n" + sed -i 's#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input#hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input#g' /home/system/.config/polybar/modules.ini + exit 0 +elif [[ -e /sys/devices/platform/coretemp.0/hwmon/hwmon3 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon3/temp1_input" /home/system/.config/polybar/modules.ini) || -e /sys/devices/platform/coretemp.0/hwmon/hwmon4 && $(grep -i "hwmon-path = /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input" /home/system/.config/polybar/modules.ini) ]]; then + printf "Nothing left to fix\n" + exit 0 +else + printf "ERROR had occured\n" + exit 1 +fi -- cgit v1.2.3