George Hung | b67a01a | 2020-06-30 10:47:30 +0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | MARGIN_TABLE_FILE="/usr/share/read-margin-temp/config-margin.json" |
| 4 | |
| 5 | target_num="$(cat $MARGIN_TABLE_FILE | grep '"target"' | wc -l)" |
| 6 | |
| 7 | cpu_hwmon="$(ls -la /sys/class/hwmon | grep f0082000 | head -n 1 | tail -n +1 | cut -d '/' -f 11)" |
| 8 | |
| 9 | # replace by the real cpu temperature hwmon path in runtime |
| 10 | if [[ "$cpu_hwmon" != "" ]] |
| 11 | then |
| 12 | sed -i "s/cpu_hwmon/$cpu_hwmon/g" $MARGIN_TABLE_FILE |
| 13 | fi |
| 14 | |
| 15 | # wait target dbus |
| 16 | for ((i=0; i<$target_num; i++)) |
| 17 | do |
| 18 | line_num=$((i+1)) |
| 19 | path="$(cat $MARGIN_TABLE_FILE | grep '"target"' | head -n ${line_num} | tail -n +${line_num} | cut -d '"' -f 4)" |
| 20 | mapper wait $path |
| 21 | done |
| 22 | |
| 23 | # start read margin temp |
| 24 | /usr/bin/read-margin-temp & |
| 25 | |
| 26 | exit 0 |