This file is indexed.

config is in redmine 2.4.2-1.

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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/bin/sh

set -e
#set -x

# variants must be placed before to be automatically configured
redLocales="ar, bg, bs, ca, cs, da, de, el, en-gb, en, es, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt-br, pt, ro, ru, sk, sl, sq, sr-yu, sr, sv, th, tr, uk, vi, zh-tw, zh"

. /usr/share/debconf/confmodule
db_version 2.0
# This conf script is capable of backing up
db_capb backup

OUTSTATE=2
STATE=1

while [ "$STATE" != "0" -a "$STATE" != "$OUTSTATE" ]; do
	fIndex=$(($STATE / 10))
	fState=$(($STATE % 10))
	fNextState=$((($fIndex+1)*10))
	if [ $STATE -eq 1 ]; then
		# upgrade debconf db if we detect an old redmine version (<= 0.9.0~svn2819) was installed
		# detection
		fCode=0
		db_get redmine/dbconfig-install || fCode=$?
		if [ $fCode -eq 0 ]; then
			echo "Old redmine version detected, migrating dbconfig common data..."
			# remove deprecated debconf templates
			db_unregister redmine/reconfigure-webserver || true
			db_unregister redmine/restart-webserver || true
			db_unregister redmine/webserver-install || true
			# copy all current questions to instances/default ones
			# get old questions
			fOldQuest=$(debconf-show redmine)
			OLD_IFS=$IFS
			# ugly, if somebody can tell me how to escape \n, please send me an email to kapouer@melix.org
			fNewline="
"
			IFS=$fNewline
			# for each line, we want to get the three fields, seen, question, value
			for lLine in $fOldQuest; do
				IFS=$OLD_IFS
				lSeen="${lLine%% *}"
				if [ "$lSeen" = "*" ]; then
					lSeen="true"
					lStr="${lLine#\* }"
				else
					lSeen="false"
					lStr="${lLine#  }"
				fi
				lName="${lStr%%\:*}"
				if [ "${lName#redmine/instances/}" = "$lName" ]; then
					fCode=0
					db_get $lName || fCode=$?
					lVal=""
					if [ $fCode -eq 0 ]; then
						lVal="$RET"
					fi
					lNewname="redmine/instances/default${lName#redmine}"
					if [ -n "$lVal" ]; then
						db_register "$lName" "$lNewname"
						db_set "$lNewname" "$lVal"
						db_fset "$lNewname" seen "$lSeen"
					fi
					if [ "$lName" != "redmine/default-language" ]; then
						# we need redmine/default-language later
						db_unregister "$lName" || true
					fi
				fi
				IFS=$fNewline
			done
			IFS=$OLD_IFS
			
			# setup default as an old instance
			db_set redmine/current-instances "default"
			db_input high redmine/notify-migration || true
		fi
		db_get redmine/current-instances || true
		gOldInstances="${RET}"
		
		# what is that for ? we just got it.
		# db_set redmine/current-instances $gOldInstances
		db_input medium redmine/current-instances || true
		if db_go; then
			STATE=$fNextState
		else
			STATE=0
		fi
		db_get redmine/current-instances || true
		gInstances="${RET}"
		gRemovedInstances=""
		for lOld in $gOldInstances; do
			lFound=0
			for lCur in $gInstances; do
				if [ $lCur = $lOld ]; then
					lFound=1
					break
				fi
			done
			if [ $lFound -eq 0 ]; then
				if [ -z "$gRemovedInstances" ]; then gRemovedInstances="$lOld";
				else gRemovedInstances="$gRemovedInstances $lOld";
				fi
			fi
		done
		db_set redmine/old-instances "$gRemovedInstances"
		gNb=$(echo "$gInstances" | wc -w)
		OUTSTATE=$((($gNb+1) * 10))
	else
		fIndex=$(($STATE / 10))
		fState=$(($STATE % 10))
		fNextState=$((($fIndex+1)*10))
		fInstance=$(eval "echo \"$gInstances\" | awk '{print \$$fIndex}'")
		case "$fState" in
		0)
			if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
				dbc_dbtypes="sqlite3, pgsql, mysql"
				dbc_authmethod_user="password"
				# per-instance dbuser to avoid #695774 - and behave like dbname
				fCode=0
				db_get redmine/instances/$fInstance/db/app-user || fCode=$?
				if [ $fCode -eq 0 -a -n "$RET" ]; then
					dbc_dbuser="$RET"
				else
					dbc_dbuser=redmine_$fInstance
				fi
				# use same dbname if one has been registered in debconf before
				# this is also needed for migration from version <= 0.9.0~svn2819
				fCode=0
				db_get redmine/instances/$fInstance/db/dbname || fCode=$?
				if [ $fCode -eq 0 -a -n "$RET" ]; then
					dbc_dbname="$RET"
				else
					dbc_dbname=redmine_$fInstance
				fi
				fCode=0
				db_get redmine/instances/$fInstance/db/basepath || fCode=$?
				if [ $fCode -eq 0 -a -n "$RET" ]; then
					dbc_basepath="$RET"
				else
					dbc_basepath=""
				fi
				( . /usr/share/dbconfig-common/dpkg/config ; dbc_go redmine/instances/$fInstance $@ )
				if [ $? -ne 0 ] ; then
					if [ $fIndex -gt 0 ];then
						STATE=$((($fIndex-1)*10 + 1))
					else
						STATE=0
					fi
					continue
				fi
				db_get redmine/instances/$fInstance/dbconfig-install || true
				if [ "$RET" != "true" ]; then
					STATE=$fNextState
				else
					STATE=$(($STATE + 1))
				fi
			else
				STATE=$OUTSTATE
			fi
		;;
		1)
			# supported locales
			
			# now check if current LANG correspond to one of those locales, only if LANG is like aa_BB.YY
			locstr=${LANG%.*}
			locMin=${locstr%_*}
			locMaj=$(echo ${locstr#*_} | tr "[:upper:]" "[:lower:]")
			locTrans="$locMin-$locMaj"
			OLD_IFS=$IFS
			IFS=", "
			locAv="en"
			for i in $redLocales; do
				if [ "$locTrans" = "$i" ];then
					locAv=$i
					break
				elif [ "$locMin" = "$i" ];then
					locAv=$i
					break
				fi
			done
			IFS=$OLD_IFS
			questionLanguage="redmine/instances/${fInstance}/default-language"
			# register only if needed
			fCode=0
			db_get $questionLanguage || fCode=$?
			if [ $fCode -eq 10 ]; then
				db_register "redmine/default-language" $questionLanguage
			fi
			db_subst $questionLanguage availableLocales $redLocales
			db_subst $questionLanguage defaultLocale $locAv
			db_set $questionLanguage $locAv
			db_input medium $questionLanguage || true
			
			if db_go; then
				STATE=$fNextState
			else
				STATE=$(($STATE - 1))
			fi
		;;
		esac
	fi
done