This file is indexed.

config is in netmrg 0.20-7.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/bash

set -e

. /usr/share/debconf/confmodule

if [ "$DPKG_DEBUG" = "developer" ]; then
	set -x
fi

db_version 2.0

if [ "$1" = "reconfigure" ] ; then
	# Rotate old configuration
	configs="/etc/netmrg/netmrg.xml"
	for config in $configs ; do
		for i in $(seq 8 -1 0) ; do
			if [ -f ${config}.$i ]
				then mv ${config}.$i ${config}.$(($i +1))
			fi
		done
		cp ${config} ${config}.0
	done
fi

step=1
finished="false"
checkagain="true"
dbexists="false"
db_capb backup
while ! $finished ; do
    skip="false"
    password=""
    confirm=""
    case $step in
	1)	# Ask for web server type.
	    db_input medium "netmrg/webserver" || true
	    next=`expr $step + 1`
	    previous="-1"
	    ;;
	2)	# Ask on wich host the DBMS is installed.
	    db_input critical "netmrg/db/host" || true
	    previous=`expr $step - 1`
	    next=`expr $step + 1`
	    ;;
	3)	# Get the database administrator name and password.
	    db_get "netmrg/db/admin/name"
	    if [ -z "$RET" ] ; then
		    dbadmname="root"
				if [ -n "$dbadmname" ] ; then
		    		db_set "netmrg/db/admin/name" $dbadmname
				fi
	    fi
	    db_beginblock
	     db_input critical "netmrg/db/admin/name" || true
	     db_input critical "netmrg/db/admin/password" || true
	    db_endblock
	    previous=`expr $step - 1`
	    next=`expr $step + 1`
	    ;;
	4)	# Ask for DB name.
	    db_input critical "netmrg/db/name" || true
	    previous=`expr $step - 1`
	    next=`expr $step + 1`
	    ;;
	5)	# Check if DB already exists 
			if [ "$1" = "configure" ] ; then
				if $checkagain ; then 
					db_get "netmrg/db/name"
					dbname="$RET"
					db_get "netmrg/db/admin/name"
					dbadmin="$RET"
					db_get "netmrg/db/admin/password"
					dbadmpass="$RET"
					. /usr/share/wwwconfig-common/mysql.get
					if eval $mysqlcmd $dbname -e '"show tables;"' | grep graphs >/dev/null 2>&1 ; then
	    			db_subst "netmrg/db/exists" "dbname" $dbname
						db_input critical "netmrg/db/exists" || true
						db_go
#						db_fset  "netmrg/db/name" "seen" "false" || true
	    			db_input critical "netmrg/db/name" || true
						next=`expr $step + 1`
						previous=`expr $step - 1`
					else
						skip="true"
						next=`expr $step + 1`
					fi
					checkagain="false"
				else
					skip="true"
					next=`expr $step + 1`
				fi
			else
				checkagain="false"
				skip="true"
				next=`expr $step + 1`
			fi
	    ;;
	6)	# Get the DBMS account username
	    db_input critical "netmrg/db/user/name" || true
	    previous=`expr $step - 1`
	    next=`expr $step + 1`
	    ;;
	7) # Get the DBMS account password
	    db_beginblock
	     db_input critical "netmrg/db/user/password" || true
	     db_input critical "netmrg/db/user/password/confirm" || true
	    db_endblock
	    previous=`expr $step - 1`
	    next=`expr $step + 1`
	    ;;
	8)	# Check if passwords match.
	    db_get "netmrg/db/user/password"
	    password="$RET"
	    db_get "netmrg/db/user/password/confirm"
	    confirm="$RET"
	    if [ "$password" != "$confirm" ] ; then
		# Reset the template used
		db_reset "netmrg/db/user/password" || true
		db_fset  "netmrg/db/user/password" "seen" "false" || true
		db_reset "netmrg/db/user/password/confirm" || true
		db_fset  "netmrg/db/user/password/confirm" "seen" "false" || true
		# Promt the user
		db_input critical "netmrg/db/user/password/mismatch" || true
		# Do one step back anyway.
		next=`expr $step - 1`
		previous=`expr $step - 1`
	    else
		# Do not prompt, go to the next step.
		skip="true"
		next=`expr $step + 1`
	    fi
	    ;;
	9)	# Ask for deleting all the database on package purge.
	    db_input medium "netmrg/postrm" || true
	    next=`expr $step + 1`
	    previous=`expr $step - 1`
	    ;;
	10)	# Ask for web host.
	    db_input medium "netmrg/web/host" || true
	    next=`expr $step + 1`
			previous=`expr $step - 1`
	    ;;
	11)	# Ask for company name.
	    db_input medium "netmrg/company/name" || true
	    next=`expr $step + 1`
			previous=`expr $step - 1`
	    ;;
	12)	# Ask for company url.
	    db_input medium "netmrg/company/link" || true
	    next=-1
			previous=`expr $step - 1`
	    ;;
	-1) finished="true"
			# if this is an initial configure run and the database is fresh
			# then warn the user about the predefined password
			if [ "$1" = "configure" -a ! $dbexists ] ; then
				db_fset "netmrg/configuration/note" "seen" "false" || true
			fi
			db_beginblock
			db_subst "netmrg/configuration/note" "site" `hostname -f`
			db_input medium "netmrg/configuration/note" || true
			db_endblock
	    ;;
	*)
	    skip="true"
	    message="Unknown step #$step."
	    if [ $step -gt 12 ] || [ $step -le 0 ] ; then
		finished="true"
	    fi
	    ;;
    esac
	
    if ! $skip ; then
	db_title "netmrg" || true
	if db_go ; then
	    step=$next
	else
	    step=$previous
	fi
    else
	step=$next
    fi
done

db_stop

exit 0