~allison/ubuntu/oneiric/backuppc/no-perl-suid

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
#!/bin/sh -e

. /usr/share/debconf/confmodule

db_version 2.0

db_input high backuppc/reconfigure-webserver || true
db_input low backuppc/restart-webserver || true
db_go

if [ ! -f /etc/backuppc/htpasswd ]; then
    db_get "backuppc/tmppass"
    PASS=$RET
    if [ "$PASS" != "" ]; then
	# already set... do nothing
	echo
    else
	PASS=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..8)'`
	db_set "backuppc/tmppass" "$PASS"
    fi
    db_subst "backuppc/configuration-note" "site" `hostname -f`
    db_subst "backuppc/configuration-note" "pass" "$PASS"    
    db_input high "backuppc/configuration-note" || true
    db_go
fi

db_stop
exit 0