X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=debian%2Fdiogenes.config;h=6cf127f97e34495a9b49910ad4bdcb167ad5de97;hb=7e17ed7462e2978bc760a11661a75bae5ab0beb4;hp=08221cbeb5a621d1c7b25a431c95b0e2fb9926a4;hpb=f3a0e7f138048b6d78f2a659754437870f75e0fc;p=diogenes.git diff --git a/debian/diogenes.config b/debian/diogenes.config index 08221cb..6cf127f 100644 --- a/debian/diogenes.config +++ b/debian/diogenes.config @@ -1,34 +1,5 @@ #!/bin/bash -e -RANDOMDEVICE=/dev/urandom -allowed=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./ -declare -a RVAL - -second () { - echo $2 -} - -create-random-pw() { - if ! read -n 0 < $RANDOMDEVICE ; then - echo 1>&2 "Warning, no random device found, password might be insecure" - for i in 0 1 2 3 4 5 6 7; do - RVAL[i]=$RANDOM - done - else - for i in 0 1 2 3 4 5 6 7; do - RVAL[i]=$(second $(od -N 1 -t d $RANDOMDEVICE)) - done - fi - - PW="" - for i in 0 1 2 3 4 5 6 7; do - idx=$((${RVAL[i]} & 0x3F)) - PW="${PW}${allowed:$idx:1}" - done - - printf "%s" $PW -} - # this function comes from wwwconfig-common's apache.func script getwwwoption() { getwwwoption="" @@ -84,31 +55,10 @@ else db_set "diogenes/webgroup" "$webgroup" fi -db_input "high" "diogenes/databasemgr_type" || true -db_go -db_get "diogenes/databasemgr_type" -dbtype="$RET" +# source dbconfig-common shell library, and call the hook function +if [ -f /usr/share/dbconfig-common/dpkg/config.mysql ]; then + . /usr/share/dbconfig-common/dpkg/config.mysql + dbc_go diogenes $@ +fi -if [ "$dbtype" = "Automatic" ] ; then - db_input "high" "diogenes/databasemgr_server" || true - db_go - db_input "high" "diogenes/dbmyadmin" || true - db_go - db_input "critical" "diogenes/dbadmpass" || true - db_go - db_input "medium" "diogenes/database_name" || true - db_go - db_input "medium" "diogenes/database_user" || true - db_go - db_input "medium" "diogenes/database_pass" || true - db_go - db_get "diogenes/database_pass" - dbpass="$RET" - if [ "$dbpass" = "auto" ]; then - dbpass=$(create-random-pw) - elif [ "$dbpass" = "none" ]; then - dbpass="" - fi - db_set "diogenes/database_pass" "$dbpass" -fi