Skip to content

Commit 2dcf34f

Browse files
committed
Corrected setup:
- to work from different working dirs - to replace existing changes in config.txt
1 parent 7a7aa16 commit 2dcf34f

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

setup

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.0
1+
v1.1

0 commit comments

Comments
 (0)