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
38 echo "Activating shadow passwords."
40 echo "Setting password for user root:"
43 if ! [ -f /etc/hosts ] ; then
44 echo "127.0.0.1 localhost $HOSTNAME" > /etc/hosts
47 if ! [ -f /etc/network/interfaces ] ; then
48 cat >> /etc/network/interfaces << EOF
49 iface lo inet loopback
57 if [ -n "$TIMEZONE" ] ; then
58 ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
61 if ! [ -f /etc/fstab ] ; then
62 cat >> /etc/fstab << EOF
63 sysfs /sys sysfs auto 0 0
64 proc /proc proc defaults 0 0
65 $TARGET / auto defaults,errors=remount-ro 0 1
66 # /dev/sda2 none swap sw 0 0
67 /dev/cdrom /mnt/cdrom0 iso9660 ro,user,noauto 0 0
71 # create default devices
72 echo "Creating generic devices in /dev - this might take a while..."
73 cd /dev && MAKEDEV generic
76 if [ -n "$INITRD" ] ; then
77 echo "Generating initrd."
78 update-initramfs -c -t -k $KERNEL
79 if [ -f "/boot/initrd.img-$KERNELVER" ] ; then
80 GRUBINITRD="initrd /boot/initrd.img-$KERNELVER"
81 LILOINITRD=" initrd=/boot/initrd.img-$KERNELVER"
85 # assume the first available kernel as our main kernel
86 KERNELIMG=$(ls -1 /boot/vmlinuz-* | head -1)
87 KERNELVER=${KERNELIMG#/boot/vmlinuz-}
89 if [ "$BOOTMGR" = 'grub' ] ; then
90 echo "Installing grub"
91 if ! [ -f /boot/grub/menu.lst ] ; then
94 cat >> /boot/grub/menu.lst << EOF
95 # Boot automatically after 30 secs.
98 # By default, boot the first entry.
101 # Fallback to the second entry.
104 title Debian Etch, kernel $KERNELVER (on $ARGET)
106 kernel $KERNELIMG root=$TARGET ro
109 # For booting Windows
111 # rootnoverify (hd0,0)
117 # copy stage-files to /boot/grub/
118 cp -i /usr/lib/grub/i386-pc/* /boot/grub/
120 # finally install grub
124 if [ "$BOOTMGR" = 'lilo' ] ; then
125 echo "Installing lilo"
126 # /usr/share/doc/lilo/examples/conf.sample
127 cat > /etc/lilo.conf << EOF
128 # This allows booting from any partition on disks with more than 1024 cylinders.
131 # Specifies the boot device
134 # Specifies the device that should be mounted as root.
137 # use Debian on software raid:
138 # raid-extra-boot=mbr-only
146 image=/boot/vmlinuz-2.6.17-grml
154 # unmount all filesystems in chroot, make sure nothing is left...
160 # finally exit the chroot
161 echo "Finished chroot installation, exiting."
164 ## END OF FILE #################################################################