config is in gforge-db-postgresql 5.1.1-2.
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 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | #!/bin/sh -e
# Source debconf library.
. /usr/share/debconf/confmodule
#- beginning of included section from handle-mainconffile.config
###
# Functions to handle the main FusionForge configuration file
###
mainconfdir=/etc/fusionforge
mainconffile=$mainconfdir/fusionforge.conf
create_mainconffile () {
if [ ! -e $mainconfdir ] ; then
mkdir -p $mainconfdir
fi
if [ ! -e $mainconffile ] ; then
if [ -e /etc/gforge/gforge.conf ] ; then
cp -a /etc/gforge/gforge.conf $mainconffile
else
touch $mainconffile
fi
chmod 600 $mainconffile
fi
}
init_debconf_from_mainconffile () {
for i in $(grep -v "^ *#" $mainconffile | sort -u | cut -d= -f1) ; do
update_onevar_from_mainconfile $i
done
}
update_onevar_from_mainconfile () {
key=$1
update_onevar_from_mainconfile__retcode=0
value=$(grep ^$key= $mainconffile | tail -1 | cut -d= -f2-)
if [ ! -z "$value" ] ; then
db_set fusionforge/shared/$key $value || update_onevar_from_mainconfile__retcode=$? || true
# case $update_onevar_from_mainconfile__retcode in
# 0)
# echo "$key = $value injected into Debconf OK"
# db_fset fusionforge/shared/$key seen true || true
# ;;
# 10)
# echo "$key = $value not injected into Debconf (non-existing question maybe?)"
# ;;
# *)
# echo "Something wicked happened"
# exit 1
# ;;
# esac
fi
}
update_mainconffile () {
for key in $@ ; do
db_get fusionforge/shared/$key
val=$RET
update_onevar_mainconffile $key $val
done
}
update_onevar_mainconffile () {
key=$1
val=$2
if grep -q "^$key=" $mainconffile ; then
newval=$(echo $val | sed -e 's/@/\\@/g' -e 's/\$/\\$/g' -e 's/\//\\\//g')
perl -pi -e "s/^$key=.*/$key=$newval/" $mainconffile
else
echo "$key=$val" >> $mainconffile
fi
}
#- end of included section from handle-mainconffile.config
create_mainconffile
init_debconf_from_mainconffile
#- beginning of included section from get-pw-from-debconf.config
get_pw () { # Use Debconf to get a password
get_pw__pwname=$1
get_pw__priority=$2
get_pw__ok=''
while [ -z "$get_pw__ok" ] ; do
db_input ${get_pw__priority} ${get_pw__pwname} || get_pw__retcode=$? || true
db_input ${get_pw__priority} ${get_pw__pwname}_confirm || true
db_go
if [ "$get_pw__retcode" = 30 ] ; then
get_pw__ok="not-asked"
else
db_get ${get_pw__pwname} || true
get_pw__PW1=$RET
db_get ${get_pw__pwname}_confirm || true
get_pw__PW2=$RET
if [ "$get_pw__PW1" = "$get_pw__PW2" ] ; then
get_pw__ok="confirmed"
else
get_pw__ok="mismatch"
db_fset ${get_pw__pwname} seen false
db_fset ${get_pw__pwname}_confirm seen false
fi
fi
done
case $get_pw__ok in
not-asked)
echo "not-asked"
;;
confirmed)
echo "confirmed"
;;
*)
echo "SHOULDN'T HAVE HAPPENED"
exit 1
;;
esac
}
#- end of included section from get-pw-from-debconf.config
#- beginning of included section from create-random-pw.config
gen_random_pw () { # Generate a random password
if [ -c /dev/urandom ]; then # ...using /dev/urandom when possible
tmp=$(dd if=/dev/urandom count=1 bs=8 2> /dev/null | md5sum | cut -b1-8)
else # ...or something else if need be.
# Last I was told, the Hurd had no /dev/urandom
# (Correct me if it has changed)
# Suggestions form something more random than $(date) are welcome
tmp=$(date | md5sum | cut -b1-8)
fi
echo $tmp
}
#- end of included section from create-random-pw.config
#- beginning of included section from common-variables.config
db_get fusionforge/shared/domain_name || true
if [ -z "$RET" ] ; then
hostname=$(hostname -f 2>/dev/null) || hostname=localhost
db_set fusionforge/shared/domain_name $hostname
fi
db_input medium fusionforge/shared/domain_name || true
db_go || true
db_get fusionforge/shared/server_admin || true
if [ -z "$RET" ] ; then
db_get fusionforge/shared/domain_name || true
db_set fusionforge/shared/server_admin "webmaster@$RET"
fi
db_input medium fusionforge/shared/server_admin || true
db_input low fusionforge/shared/system_name || true
db_go || true
vars="system_name domain_name server_admin"
update_mainconffile $vars
#- end of included section from common-variables.config
#- beginning of included section from dbhost-variables.config
db_fget fusionforge/shared/db_host seen || true
[ "$RET" = "false" ] && db_set fusionforge/shared/db_host 127.0.0.1
db_input medium fusionforge/shared/db_host || true
db_fget fusionforge/shared/db_name seen || true
db_input medium fusionforge/shared/db_name || true
db_fget fusionforge/shared/db_user seen || true
db_input medium fusionforge/shared/db_user || true
db_go || true
vars="db_host db_name db_user"
update_mainconffile $vars
#- end of included section from dbhost-variables.config
#- beginning of included section from dbpasswd-variables.config
db_fget fusionforge/shared/db_password seen || true
if [ "$RET" = "false" ]; then
pw=$(gen_random_pw)
if [ -e /etc/gforge/config.ini.d/debian-install-secrets.ini ]; then
pw=$(grep '^database_password=' /etc/gforge/config.ini.d/debian-install-secrets.ini | sed 's/database_password=//')
echo "Since you asked not to see all the debconf questions, I reused the"
echo "password for the database that was already set in "
echo "/etc/gforge/config.ini.d/debian-install-secrets.ini."
echo "Use it if you want to have a peek at the database by hand."
else
echo "Since you asked not to see all the debconf questions, I generated a random"
echo "password for the database. Use it if you want to have a peek at the"
echo "database by hand. It is '$pw'."
fi
db_set fusionforge/shared/db_password $pw
db_get fusionforge/shared/db_password || true
db_fset fusionforge/shared/db_password seen true
fi
db_go || true
vars="db_password"
update_mainconffile $vars
#- end of included section from dbpasswd-variables.config
db_fget fusionforge/shared/admin_password seen || true
if [ "$RET" = "false" ]; then
if [ "$(get_pw fusionforge/shared/admin_password high)" = "not-asked" ] ; then
db_set fusionforge/shared/admin_password $(gen_random_pw)
db_get fusionforge/shared/admin_password || true
echo "Since you asked not to see all the debconf questions, I generated a random"
echo "password for the admin user. It is '${RET}'." ;
db_fset fusionforge/shared/admin_password seen true
fi
fi
#- beginning of included section from host-variables.config
db_fget fusionforge/shared/ip_address seen || true
if [ "$RET" = "false" ] ; then
db_get fusionforge/shared/domain_name
db_set fusionforge/shared/ip_address $(hostname -i | cut -f1 -d" ")
fi
db_input medium fusionforge/shared/ip_address || true
db_input medium fusionforge/shared/server_admin || true
db_go || true
vars="ip_address server_admin"
update_mainconffile $vars
#- end of included section from host-variables.config
#- beginning of included section from shellhost-variables.config
db_fget fusionforge/shared/shell_host seen || true
if [ "$RET" = "false" ] ; then
db_get fusionforge/shared/domain_name
db_set fusionforge/shared/shell_host shell.$RET
fi
db_input low fusionforge/shared/shell_host || true
db_go || true
vars="shell_host"
update_mainconffile $vars
#- end of included section from shellhost-variables.config
#- beginning of included section from users-variables.config
db_fget fusionforge/shared/users_host seen || true
if [ "$RET" = "false" ] ; then
db_get fusionforge/shared/domain_name
db_set fusionforge/shared/users_host users.$RET
fi
db_input medium fusionforge/shared/users_host || true
db_go || true
vars="users_host"
update_mainconffile $vars
#- end of included section from users-variables.config
#- beginning of included section from lists-variables.config
db_fget fusionforge/shared/lists_host seen || true
if [ "$RET" = "false" ] ; then
db_get fusionforge/shared/domain_name
db_set fusionforge/shared/lists_host lists.$RET
fi
db_input medium fusionforge/shared/lists_host || true
db_go || true
vars="lists_host"
update_mainconffile $vars
#- end of included section from lists-variables.config
#- beginning of included section from downloadhost-variables.config
db_fget fusionforge/shared/download_host seen || true
if [ "$RET" = "false" ] ; then
db_get fusionforge/shared/domain_name
db_set fusionforge/shared/download_host download.$RET
fi
db_input low fusionforge/shared/download_host || true
db_go || true
vars="download_host"
update_mainconffile $vars
#- end of included section from downloadhost-variables.config
#- beginning of included section from groupid-variables.config
db_input low fusionforge/shared/newsadmin_groupid || true
db_input low fusionforge/shared/statsadmin_groupid || true
db_input low fusionforge/shared/peerrating_groupid || true
db_go || true
vars="newsadmin_groupid statsadmin_groupid peerrating_groupid"
update_mainconffile $vars
#- end of included section from groupid-variables.config
db_go || true
vars="admin_password"
update_mainconffile $vars
db_stop
|