Merge pull request 'pwmconfig: Deal with relative paths for the config file.' (#386) from misieck/RelPath into master

Reviewed-on: http://localhost:8888/hramrach/lm-sensors/pulls/386
This commit is contained in:
hramrach committed 2023-12-24 12:00:46 +01:00
commit d2c15ac572
1 file changed
+8 -3
+8 -3
View File
@@ -31,6 +31,7 @@
LM_VERSION='3.6.0+git'
PIDFILE="/var/run/fancontrol.pid"
USERDIR=$(pwd)
if [ -f "$PIDFILE" ]
then
@@ -614,6 +615,10 @@ function AskPath()
then
FCCONFIG="/etc/fancontrol"
fi
if [ ${FCCONFIG::1} != "/" ]
then
FCCONFIG=$(readlink -f "$USERDIR"/"$FCCONFIG")
fi
}
AskPath
@@ -663,7 +668,7 @@ function LoadConfig()
fi
}
LoadConfig $FCCONFIG
LoadConfig "$FCCONFIG"
# $1 = pwm value below which the fan is stopped
function TestMinStart()
@@ -815,8 +820,8 @@ function SaveConfig()
echo "MINSTOP=$MINSTOP" >>$tmpfile
[ -n "$MINPWM" ] && echo "MINPWM=$MINPWM" >>$tmpfile
[ -n "$MAXPWM" ] && echo "MAXPWM=$MAXPWM" >>$tmpfile
mv $tmpfile $FCCONFIG
chmod +r $FCCONFIG
mv $tmpfile "$FCCONFIG"
chmod +r "$FCCONFIG"
#check if file was written correctly
echo 'Configuration saved'
}