2 # Filename: /etc/debootstrap/chroot-script
3 # Purpose: script executed in chroot when installing Debian via grml-debootstrap
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 # Latest change: Fre Nov 03 11:17:14 CET 2006 [mika]
8 ################################################################################
12 . /etc/debootstrap/config || exit 1
14 [ -r /proc/1 ] || mount -t proc none /proc
16 if [ -n "$RECONFIGURE" ] ; then
17 for package in $RECONFIGURE ; do
18 dpkg --list $package && dpkg-reconfigure $package || echo "Warning: $package does not exist, can not reconfigure it."
22 # install additional packages
23 if [ "$PACKAGES" = 'yes' ] ; then
24 if ! [ -r /etc/debootstrap/packages ] ; then
25 echo "Error: /etc/debootstrap/packages not found, exiting."
29 apt-get install $(cat /etc/debootstrap/packages)
33 # set password of user root
37 if ! [ -f /etc/hosts ] ; then
38 echo "127.0.0.1 localhost $HOSTNAME" > /etc/hosts
41 if ! [ -f /etc/network/interfaces ] ; then
42 cat >> /etc/network/interfaces << EOF
43 iface lo inet loopback
51 if [ -n "$TIMEZONE" ] ; then
52 ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
55 if ! [ -f /etc/fstab ] ; then
56 cat >> /etc/fstab << EOF
57 sysfs /sys sysfs auto 0 0
58 proc /proc proc defaults 0 0
59 $TARGET / auto defaults,errors=remount-ro 0 1
60 # /dev/sda2 none swap sw 0 0
61 /dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0
65 # create default devices
66 echo "Creating generic devices in /dev - this might take a while..."
67 cd /dev && MAKEDEV generic
70 if [ -n "$INITRD" ] ; then
71 echo "Generating initrd."
72 update-initramfs -c -t -k $KERNEL
73 if [ -f "/boot/initrd.img-$KERNELVER" ] ; then
74 GRUBINITRD="initrd /boot/initrd.img-$KERNELVER"
75 LILOINITRD=" initrd=/boot/initrd.img-$KERNELVER"
79 # assume the first available kernel as our main kernel
80 KERNELIMG=$(ls -1 /boot/vmlinuz-* | head -1)
81 KERNELVER=${KERNELIMG#/boot/vmlinuz-}
83 if [ "$BOOTMGR" = 'grub' ] ; then
84 echo "Installing grub"
85 if ! [ -f /boot/grub/menu.lst ] ; then
88 cat >> /boot/grub/menu.lst << EOF
89 # Boot automatically after 30 secs.
92 # By default, boot the first entry.
95 # Fallback to the second entry.
98 title Debian Etch, kernel $KERNELVER (on $ARGET)
100 kernel $KERNELIMG root=$TARGET ro
103 # For booting Windows
105 # rootnoverify (hd0,0)
111 # copy stage-files to /boot/grub/
112 cp -i /usr/lib/grub/i386-pc/* /boot/grub/
114 # finally install grub
118 if [ "$BOOTMGR" = 'lilo' ] ; then
119 echo "Installing lilo"
120 # /usr/share/doc/lilo/examples/conf.sample
121 cat > /etc/lilo.conf << EOF
122 # This allows booting from any partition on disks with more than 1024 cylinders.
125 # Specifies the boot device
128 # Specifies the device that should be mounted as root.
131 # use Debian on software raid:
132 # raid-extra-boot=mbr-only
140 image=/boot/vmlinuz-2.6.17-grml
148 # unmount all filesystems in chroot
151 # finally exit the chroot
152 echo "Finished chroot installation, exiting."
155 ## END OF FILE #################################################################