@@ -54,23 +54,22 @@ if [ $scriptAction == 'INSTALL' ] ; then
5454 logMessage " ++ Installing VeFanControl with the following settings:"
5555
5656 # read config entries to get the pwm pin
57- eval ` python3 read_config.py`
58-
59- if [ $( grep -c " VeFanControl" " $configFile " ) == 0 ]; then
60- logMessage " activating VeFanControl settings in $configFile "
61- cp $configFile $configFile .tmp
62- # remove any previouos lines added by this script
63- sed -i -e " /#### begin VeFanControl/,/#### end VeFanControl/d" " $configFile .tmp"
64-
65- echo " " >> " $configFile .tmp"
66- echo " #### begin VeFanControl" >> " $configFile .tmp"
67- echo " dtoverlay=pwm,pin=$pwm_pin ,func=$pin_func " >> " $configFile .tmp"
68- echo " #### end VeFanControl" >> " $configFile .tmp"
69- echo " " >> " $configFile .tmp"
70- rebootNeeded=true
57+ pushd $scriptDir && eval ` python3 read_config.py` && popd
58+
59+ logMessage " activating VeFanControl settings in $configFile "
60+ cp $configFile $configFile .tmp
61+
62+ # remove any previouos lines added by this script
63+ sed -i -e " /#### begin VeFanControl/,/#### end VeFanControl/d" " $configFile .tmp"
7164
72- [ -f " $overlayFile " ] || logMessage " installing PWM overlay" && rebootNeeded=true && updateActiveFile " $overlayFile "
73- fi
65+ echo " " >> " $configFile .tmp"
66+ echo " #### begin VeFanControl" >> " $configFile .tmp"
67+ echo " dtoverlay=pwm,pin=$pwm_pin ,func=$pin_func " >> " $configFile .tmp"
68+ echo " #### end VeFanControl" >> " $configFile .tmp"
69+ echo " " >> " $configFile .tmp"
70+
71+ [ -f " $overlayFile " ] || logMessage " installing PWM overlay" && rebootNeeded=true && updateActiveFile " $overlayFile "
72+
7473 # detect changes
7574 cmp -s $configFile " $configFile .tmp" > /dev/null
7675 if (( $? == 1 )) ; then
0 commit comments