summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-02-10 14:49:01 +0100
committerLinus Nordberg <linus@nordu.net>2017-02-10 14:49:01 +0100
commit5111d0ec7f9acc4b6232eba4168b9abf4dc589ce (patch)
tree7257a8ce54b0e4a2867f004b1bd5244e40a39fb1
parent116d1d725aad42a585ef71306762ec61a1298838 (diff)
Make getconfig.sh not require a running system.
-rwxr-xr-xtools/getconfig.sh25
1 files changed, 16 insertions, 9 deletions
diff --git a/tools/getconfig.sh b/tools/getconfig.sh
index aaab7ee..9b75ce9 100755
--- a/tools/getconfig.sh
+++ b/tools/getconfig.sh
@@ -11,19 +11,26 @@ localconfig=$1
globalconfig=$2
plopcontrolfile=$3
-plopcontrolport=$(cat ${plopcontrolfile})
-configversion=$(echo "configversion" | nc 127.0.0.1 ${plopcontrolport})
+plopcontrolport=
+configversion="unknown"
+if [ "${plopcontrolfile}" != "force-compile" -a -f ${plopcontrolfile} ]; then
+ plopcontrolport=$(cat ${plopcontrolfile})
+ configversion=$(echo "configversion" | nc 127.0.0.1 ${plopcontrolport} || echo unreachable)
+fi
+
echo "version before reload: $configversion"
getconfigresult=$(${BINDIR}/getconfig.py --localconfig ${localconfig} --dest ${globalconfig})
-if [ "$getconfigresult" = "newconfig" ]; then
+if [ "${plopcontrolfile}" = "force-compile" -o "$getconfigresult" = "newconfig" ]; then
${BINDIR}/compileconfig.py --localconfig ${localconfig} --config ${globalconfig}
- reloadresult=$(echo "reload" | nc 127.0.0.1 ${plopcontrolport})
- echo $reloadresult
- if [ "$reloadresult" != "reload completed" ]; then
- exit 1
+ if [ "${plopcontrolport}" != "" ]; then
+ reloadresult=$(echo "reload" | nc 127.0.0.1 ${plopcontrolport} || echo unreachable)
+ echo $reloadresult
+ if [ "$reloadresult" != "reload completed" ]; then
+ exit 1
+ fi
+ configversion=$(echo "configversion" | nc 127.0.0.1 ${plopcontrolport} || echo unreachable)
+ echo "version after reload: $configversion"
fi
- configversion=$(echo "configversion" | nc 127.0.0.1 ${plopcontrolport})
- echo "version after reload: $configversion"
else
echo "reload not needed"
fi