From 4d4a12c8a0b21eea2f1d6660aa8dadbd6be083b2 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 20 Nov 2013 21:06:17 +0100 Subject: [PATCH] add configuration check script between current brisk.conf.pho file and the official config template --- TODO.txt | 3 ++- bin/conf_check.sh | 43 ++++++++++++++++++++++++++++++++++++ web/Obj/brisk.conf-templ.pho | 2 ++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 bin/conf_check.sh diff --git a/TODO.txt b/TODO.txt index 3f4974f..e18ee0c 100644 --- a/TODO.txt +++ b/TODO.txt @@ -10,7 +10,8 @@ . show licence ([show me later, yes, no]/[yes, no]) . switch-off date . opt - button on when arrived to the bottom of the licence - + . opt - download licence + . min - check licence version between config file and licence file . show guaranteer . email validation diff --git a/bin/conf_check.sh b/bin/conf_check.sh new file mode 100755 index 0000000..708c63c --- /dev/null +++ b/bin/conf_check.sh @@ -0,0 +1,43 @@ +#!/bin/bash +CONFFILE=$HOME/.brisk_install + +webbase_get () { + local p="$1" + + while [ "$p" ]; do + if [ -d "${p}/Etc" ]; then + echo "${p}/Etc" + return 0 + fi + if [ "$p" = "/" ]; then + return 1 + fi + p="$(dirname "$p")" + done +} + +if [ -f "$CONFFILE" ]; then + source "$CONFFILE" +else + echo "$CONFFILE not found" + exit 1 +fi + +WEBBASE="$(webbase_get "$web_path")" +if [ $? -ne 0 ]; then + echo "Etc directory not found" + return 1 +fi + +BRISKCONF="${WEBBASE}/brisk.conf.pho" +if [ ! -f "$BRISKCONF" ]; then + echo "$BRISKCONF not found" + exit 2 +fi +echo "Check $BRISKCONF with web/Obj/brisk.conf-templ.pho ... " | tr -d '\n' +diff -u <(sed 's/ *=.*//g' web/Obj/brisk.conf-templ.pho | grep -v '^[ ]*//' | sort) <(sed 's/ *=.*//g' "$BRISKCONF" | grep -v '^[ ]*//' | sort) +if [ $? -eq 0 ]; then + echo "vars match." +fi + + diff --git a/web/Obj/brisk.conf-templ.pho b/web/Obj/brisk.conf-templ.pho index 6b38d24..a258855 100644 --- a/web/Obj/brisk.conf-templ.pho +++ b/web/Obj/brisk.conf-templ.pho @@ -7,6 +7,8 @@ $G_dbpfx = "bsk_"; $G_lang = "it"; +$G_crypt_key = "cryptkey"; + $G_shutdown = FALSE; // list of allowed proxies IP address (strings) -- 2.17.1