diff options
| author | littleblack111 <jerrylam110209@gmail.com> | 2023-06-25 21:57:04 +0800 |
|---|---|---|
| committer | littleblack111 <jerrylam110209@gmail.com> | 2023-06-25 21:57:04 +0800 |
| commit | 8c77a6981602d68e953f1395ce63e0ddb7cfd953 (patch) | |
| tree | aaf0cd0af3a9c00cc7a289402db71ea5f6a40384 /polybar-temp-autofix.sh | |
| parent | 75872eeadab8825bcad715970fb531990089853c (diff) | |
improved scripts syntax and made them more logical
Diffstat (limited to 'polybar-temp-autofix.sh')
| -rwxr-xr-x | polybar-temp-autofix.sh | 16 |
1 files changed, 16 insertions, 0 deletions
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 |
