#! /bin/sh

# copyright Thomas Lange 2001-2004, lange@debian.org

# generate locales on client
$ROOTCMD dpkg-reconfigure -u locales

# remove backup files from cfeninge
dirs="root etc var"
for path in $dirs; do
    find $target/$path -maxdepth 20 -name \*.cfedited -o -name \*.cfsaved | xargs -r rm
done

# if no separate /tmp partition exists, make link /tmp -> /var/tmp
ifclass TMP_PARTITION || {
    rm -rf $target/tmp
    ln -s  /var/tmp $target/tmp
}

[ "$FAI_DEBMIRROR" ] && 
echo "#$FAI_DEBMIRROR $MNTPOINT nfs ro 0 0" >> $target/etc/fstab

# set bios clock
case "$UTC" in
   no|"") hwopt="--localtime" ;;
   yes)   hwopt="--utc"       ;;
esac
$ROOTCMD hwclock $hwopt --systohc

# Make sure everything is configured properly
echo "Running \"apt-get -f install\" for the last time."
$ROOTCMD apt-get -f install

# copy sources.list
fcopy /etc/apt/sources.list

# the system is now configured
rm -f $target/sbin/unconfigured.sh
