some cleanup
[brisk.git] / bin / conf_check.sh
1 #!/bin/bash
2 CONFFILE=$HOME/.brisk_install
3
4 webbase_get () {
5     local p="$1"
6  
7     while [ "$p" ]; do
8         if [ -d "${p}/Etc" ]; then
9             echo "${p}/Etc"
10             return 0
11         fi
12         if [ "$p" = "/" ]; then
13             return 1
14         fi
15         p="$(dirname "$p")"
16     done
17 }
18
19 if [ -f "$CONFFILE" ]; then
20     source "$CONFFILE"
21 else
22     echo "$CONFFILE not found"
23     exit 1
24 fi
25
26 WEBBASE="$(webbase_get "$web_path")"
27 if [ $? -ne 0 ]; then
28     echo "Etc directory not found"
29     return 1
30 fi
31
32 BRISKCONF="${WEBBASE}/brisk.conf.pho"
33 if [ ! -f "$BRISKCONF" ]; then
34     echo "$BRISKCONF not found"
35     exit 2
36 fi
37 echo "Check $BRISKCONF with web/Obj/brisk.conf-templ.pho ... " | tr -d '\n'
38 diff -u <(sed 's/ *=.*//g' web/Obj/brisk.conf-templ.pho | grep -v '^[   ]*//' | sort) <(sed 's/ *=.*//g' "$BRISKCONF" | grep -v '^[     ]*//' | sort)
39 if [ $? -eq 0 ]; then
40     echo "vars match."
41 fi
42
43