-#!/bin/sh
+#!/bin/bash
# Filename: /etc/debootstrap/chroot-script
# Purpose: script executed in chroot when installing Debian via grml-debootstrap
# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# this script as /bin/chroot-script on your new installed system
################################################################################
+# error_handler {{{
+if [ "$REPORT_TRAP_ERR" = "yes" ] || [ "$FAIL_TRAP_ERR" = "yes" ]; then
+ set -E
+ set -o pipefail
+ trap "error_handler" ERR
+fi
+# }}}
+
. /etc/debootstrap/config || exit 1
. /etc/debootstrap/variables || exit 1
APTUPGRADE="aptitude -y safe-upgrade $DPKG_OPTIONS"
fi
else
- APTINSTALL="apt-get --force-yes -y --no-install-recommends install $DPKG_OPTIONS"
+ APTINSTALL="apt-get -y --no-install-recommends install $DPKG_OPTIONS"
APTUPDATE="apt-get update $DPKG_OPTIONS"
- APTUPGRADE="apt-get --force-yes -y upgrade $DPKG_OPTIONS"
+ APTUPGRADE="apt-get -y upgrade $DPKG_OPTIONS"
fi
if [ -z "$STAGES" ] ; then
fi
if [ -z "$COMPONENTS" ] ; then
- COMPONENTS='main contrib non-free'
+ COMPONENTS='main'
fi
echo "Using repository components $COMPONENTS"
apt-get update $DPKG_OPTIONS
else
# make sure we have the keys available for aptitude
- gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787
- gpg --export F61E2E7CECDEA787 | apt-key add - || true # not yet sure
+ gpg --keyserver subkeys.pgp.net --recv-keys 709BCE51568573EBC160E590F61E2E7CECDEA787
+ gpg --export 709BCE51568573EBC160E590F61E2E7CECDEA787 | apt-key add - || true # not yet sure
# why it's necessary, sometimes we get an error even though it works [mika]
fi
return 0
fi
- case $ARCH in
- i386) KARCH=686 ;;
- amd64) KARCH=amd64 ;;
+ local KARCH
+
+ case "$ARCH" in
+ i386)
+ case "$RELEASE" in
+ lenny|squeeze|wheezy) KARCH='686' ;;
+ # since jessie the linux-image-686 image doesn't exist any longer
+ *) KARCH='686-pae' ;;
+ esac
+ ;;
+ amd64)
+ KARCH='amd64'
+ ;;
*)
echo "Only i386 and amd64 are currently supported" >&2
return 1
KVER=$(get_kernel_version)
if [ -n "$KVER" ] ; then
# note: install busybox to be able to debug initramfs
- KERNELPACKAGES="linux-image-$KVER linux-headers-$KVER busybox firmware-linux-free firmware-linux"
+ KERNELPACKAGES="linux-image-$KVER linux-headers-$KVER busybox firmware-linux-free"
+ # only add firmware-linux if we have non-free as a component
+ if expr "$COMPONENTS" : '.*non-free' >/dev/null ; then
+ KERNELPACKAGES="$KERNELPACKAGES firmware-linux"
+ fi
DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL $KERNELPACKAGES
else
echo "Warning: Could not find a kernel for your system. Your system won't be able to boot itself!"
return 0
fi
+ # make sure this is pre-defined so we have sane settings for automated
+ # upgrades, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711019
+ echo "Setting grub-pc debconf configuration for install device to $GRUB"
+ echo "grub-pc grub-pc/install_devices multiselect $GRUB" | debconf-set-selections
+
if ! dpkg --list grub-pc 2>/dev/null | grep -q '^ii' ; then
echo "Notice: grub option set but no grub-pc package, installing it therefore."
DEBIAN_FRONTEND=$DEBIAN_FRONTEND $APTINSTALL grub-pc
echo "Installing grub on ${GRUB}:"
grub-install --no-floppy "$GRUB"
done
+ rm -f /boot/grub/device.map
else
echo "Installing grub on ${GRUB}:"
- grub-install --no-floppy "$GRUB"
+ case "$RELEASE" in
+ lenny|squeeze|wheezy)
+ grub-install --no-floppy "$(readlink -f "${GRUB}")"
+ rm -f /boot/grub/device.map
+ ;;
+ *)
+ echo "(hd0) ${GRUB}" > /boot/grub/device.map
+ grub-install "(hd0)"
+ rm /boot/grub/device.map
+ ;;
+ esac
fi
echo "Adjusting grub configuration for use on ${GRUB}."