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:37:19 CET 2006 [mika]
8 ################################################################################
12 . /etc/debootstrap/config || exit 1
14 [ -r /proc/1 ] || mount -t proc none /proc
16 if [ -n "MIRROR_LIST" ] ; then
17 echo $MIRROR_LIST > /etc/apt/sources.list
20 # install additional packages
21 if [ "$PACKAGES" = 'yes' ] ; then
22 if ! [ -r /etc/debootstrap/packages ] ; then
23 echo "Error: /etc/debootstrap/packages not found, exiting."
27 apt-get install $(cat /etc/debootstrap/packages)
31 if [ -n "$RECONFIGURE" ] ; then
32 for package in $RECONFIGURE ; do
33 dpkg --list $package && dpkg-reconfigure $package || echo "Warning: $package does not exist, can not reconfigure it."
37 # set password of user root
41 if ! [ -f /etc/hosts ] ; then
42 echo "127.0.0.1 localhost $HOSTNAME" > /etc/hosts
45 if ! [ -f /etc/network/interfaces ] ; then
46 cat >> /etc/network/interfaces << EOF
47 iface lo inet loopback
55 if [ -n "$TIMEZONE" ] ; then
56 ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
59 if ! [ -f /etc/fstab ] ; then
60 cat >> /etc/fstab << EOF
61 sysfs /sys sysfs auto 0 0
62 proc /proc proc defaults 0 0
63 $TARGET / auto defaults,errors=remount-ro 0 1
64 # /dev/sda2 none swap sw 0 0
65 /dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0
69 # create default devices
70 echo "Creating generic devices in /dev - this might take a while..."
71 cd /dev && MAKEDEV generic
74 if [ -n "$INITRD" ] ; then
75 echo "Generating initrd."
76 update-initramfs -c -t -k $KERNEL
77 if [ -f "/boot/initrd.img-$KERNELVER" ] ; then
78 GRUBINITRD="initrd /boot/initrd.img-$KERNELVER"
79 LILOINITRD=" initrd=/boot/initrd.img-$KERNELVER"
83 # assume the first available kernel as our main kernel
84 KERNELIMG=$(ls -1 /boot/vmlinuz-* | head -1)
85 KERNELVER=${KERNELIMG#/boot/vmlinuz-}
87 if [ "$BOOTMGR" = 'grub' ] ; then
88 echo "Installing grub"
89 if ! [ -f /boot/grub/menu.lst ] ; then
92 cat >> /boot/grub/menu.lst << EOF
93 # Boot automatically after 30 secs.
96 # By default, boot the first entry.
99 # Fallback to the second entry.
102 title Debian Etch, kernel $KERNELVER (on $ARGET)
104 kernel $KERNELIMG root=$TARGET ro
107 # For booting Windows
109 # rootnoverify (hd0,0)
115 # copy stage-files to /boot/grub/
116 cp -i /usr/lib/grub/i386-pc/* /boot/grub/
118 # finally install grub
122 if [ "$BOOTMGR" = 'lilo' ] ; then
123 echo "Installing lilo"
124 # /usr/share/doc/lilo/examples/conf.sample
125 cat > /etc/lilo.conf << EOF
126 # This allows booting from any partition on disks with more than 1024 cylinders.
129 # Specifies the boot device
132 # Specifies the device that should be mounted as root.
135 # use Debian on software raid:
136 # raid-extra-boot=mbr-only
144 image=/boot/vmlinuz-2.6.17-grml
152 # unmount all filesystems in chroot, make sure nothing is left...
158 # finally exit the chroot
159 echo "Finished chroot installation, exiting."
162 ## END OF FILE #################################################################