summaryrefslogtreecommitdiffstats
path: root/get_all_tcos_vars.sh
blob: bbf55a665f9fee7f1d67f56a4343944d309b5a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
#/*
#* get_all_tcos_vars.sh: display DEBUG table of vars in TCOS templates
#*
#* Copyright (C) 2006,2007,2008  mariodebian at gmail
#*
#* This program is free software; you can redistribute it and/or
#* modify it under the terms of the GNU General Public License
#* as published by the Free Software Foundation; either version 2
#* of the License, or (at your option) any later version.
#*
#* This program is distributed in the hope that it will be useful,
#* but WITHOUT ANY WARRANTY; without even the implied warranty of
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#* GNU General Public License for more details.
#*
#* You should have received a copy of the GNU General Public License
#* along with this program; if not, write to the Free Software
#* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#*/


ALL_VARS1=$(rgrep "\$TCOS_" * |grep -v svn |grep -v "\.py" |grep -v "debian/" | awk -F'TCOS_' '{print "TCOS_"$2}' | \
 awk '{print $1}' | awk -F"=" '{print $1}' | awk -F"/" '{print $1}' | \
 sed 's/)//g' | sed 's/}//g' | sed 's/"//g'| sed 's/;//g' |sort | uniq)

ALL_VARS2=$(rgrep "^TCOS_" conf/ |grep -v svn | awk -F":" '{print $2}' |awk -F"=" '{print $1}' |sort | uniq)

ALL_VARS=$(echo $ALL_VARS1 $ALL_VARS2 | sort | uniq)

eline(){
  echo "------------------------------------------------------------------------------------------------------------------"
}

TEMPLATES="conf/tcos.conf.all conf/tcos.conf.low conf/tcos.conf.nfs"

is_in_template() {
  value=""
  for tpl in $TEMPLATES; do
    if [ $(grep -c "^${1}=" $tpl) != 0 ]; then
      tmp=$(grep "^${1}=" $tpl | awk -F"=" '{print $2}')
      value="$value $(basename $tpl):'$tmp'"
    fi
  done
  echo $value
}


printf "%30s |%5s| %8s| %10s| %5s| %36s|\n" "VARNAME" "base" "value" "" "needed in base" "in templates"
eline


number=0
for VAR in $ALL_VARS; do
  base=$(grep -c "^${VAR}=" conf/base.conf)
  basevalue=$( grep "^${VAR}=" conf/base.conf | awk -F"=" '{print $2}')
  tcos=$(grep -c "^${VAR}=" conf/tcos.conf)
  iit=$(is_in_template $VAR)
  if [ $base = 0 ] && [ $tcos = 0 ]; then
    needbase="FIXME"
  else
    needbase=""
  fi
  printf "%30s |%5s| %8s| %15s| %5s| %40s|\n" "$VAR" "$base" "$basevalue" "" "$needbase" "$iit"
  tnumber=$((number/5))
  [ $number = $((tnumber*5)) ] && eline
  number=$((number+1))
done