#!/bin/sh -e

. /usr/share/debconf/confmodule ||exit

db_version 2.0
if [ -r /etc/openafs/ThisCell ] ; then
    read cell </etc/openafs/ThisCell
    db_set openafs-client/thiscell $cell
    fi
db_get openafs-client/thiscell || true
if [ "x$RET" = "x" ] ; then
	db_set openafs-client/thiscell `dnsdomainname | tr 'A-Z' 'a-z'`
	fi
if [ -r /etc/openafs/cacheinfo ] ; then
    IFS=: read mountpoint cachedir cachesize  </etc/openafs/cacheinfo
    db_set openafs-client/cachesize $cachesize
    fi
db_input medium openafs-client/thiscell ||true
db_input critical openafs-client/cachesize ||true
db_go
test -f /etc/openafs/afs.conf &&. /etc/openafs/afs.conf
if [ "x$AFS_CLIENT" != "x" ] ; then
    db_set openafs-client/run-client  $AFS_CLIENT
    fi
db_input low openafs-client/run-client || true
if [ "x$AFS_AFSDB" != "x" ] ;then
    db_set openafs-client/afsdb $AFS_AFSDB
    fi
if [ "x$AFS_DYNROOT" != "x" ] ; then
    db_set openafs-client/dynroot $AFS_DYNROOT
    fi
if [ x$AFS_FAKESTAT != "x" ] ; then
    db_set openafs-client/fakestat $AFS_FAKESTAT
fi

db_beginblock
db_input low openafs-client/afsdb ||true
db_input low openafs-client/crypt || true
db_input medium openafs-client/dynroot || true
db_input low openafs-client/fakestat ||true
db_endblock
db_go
