+ if [ -n "$KERNEL" ] ; then
+ $APTUPDATE
+ if [ "$RELEASE" = 'sarge' ] ; then
+ KERNELPACKAGES="kernel-image-$KERNEL kernel-headers-$KERNEL"
+ else
+ KERNELPACKAGES="linux-image-$KERNEL linux-headers-$KERNEL"
+ fi
+ DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $KERNELPACKAGES
+ fi
+}
+# }}}
+
+# reconfigure packages {{{
+reconfigure() {
+ if [ -n "$RECONFIGURE" ] ; then
+ for package in $RECONFIGURE ; do
+ dpkg --list $package 1>/dev/null 2>/dev/null && \
+ DEBIAN_FRONTEND=$DEBIAN_FRONTEND dpkg-reconfigure $package || \
+ echo "Warning: $package does not exist, can not reconfigure it."
+ done
+ fi
+}
+# }}}
+
+# set password of user root {{{
+setpassword() {
+# Set a password, via chpasswd.
+# Use perl rather than echo, to avoid the password
+# showing in the process table. (However, this is normally
+# only called when first booting the system, when root has no
+# password at all, so that should be an unnecessary precaution).
+#
+# Pass in three arguments: the user, the password, and 'true' if the
+# password has been pre-crypted (by preseeding).
+#
+# Taken from /var/lib/dpkg/info/passwd.config
+ SETPASSWD_PW="$2"
+ export SETPASSWD_PW
+
+ # This is very annoying. chpasswd cannot handle generating md5
+ # passwords as it is not PAM-aware. Thus, I have to work around
+ # that by crypting the password myself if md5 is used.
+ USE_MD5=1
+ export USE_MD5
+
+ if [ "$3" = true ]; then
+ PRECRYPTED=1
+ else
+ PRECRYPTED=''
+ fi
+ export PRECRYPTED
+ LC_ALL=C LANGUAGE=C LANG=C perl -e '
+ sub CreateCryptSalt {
+ my $md5 = shift;