2 # Filename: grml-bootstrap
3 # Purpose: wrapper around debootstrap for installing plain Debian via grml
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 15:34:02 CET 2006 [mika]
8 ################################################################################
9 # http://www.debian.org/releases/stable/i386/apcs04.html.en
11 set -e # exit on any error
13 . /etc/grml/lsb-functions
14 . /etc/grml/script-functions
16 check4progs debootstrap || exit 1
18 if [ -r /etc/debootstrap/config ] ; then
19 . /etc/debootstrap/config
21 echo "/etc/debootstrap/config could not be read, exiting."
25 if [ -z "$TARGET" ] ; then
26 eerror "Please adjust /etc/debootstrap/config before running ${0}" ; eend 1
30 if [ -n "$MKFS" ] ; then
31 einfo "Running $MKFS on $TARGET"
36 if [ -n "$TUNE2FS" ] ; then
37 einfo "Disabling automatic filesystem check on $TARGET via tune2fs"
42 # now mount the new partition
43 if grep -q $TARGET /proc/mounts ; then
44 eerror "$TARGEt already mounted, exiting."
46 einfo "Mounting $TARGET to $MNTPOINT"
47 mount -o rw,suid,dev $TARGET $MNTPOINT
51 # get main packages from a debian-mirror
52 einfo "Running $DEBOOTSTRAP for release $RELEASE using mirror $MIRROR"
53 $DEBOOTSTRAP $RELEASE $MNTPOINT $MIRROR
56 einfo "Preparing chroot system"
57 cp $CONFFILES/chroot-script $MNTPOINT/bin/chroot-script
58 chmod 755 $MNTPOINT/bin/chroot-script
59 mkdir $MNTPOINT/etc/debootstrap/
61 # make sure we have our files for later use via chroot-script
62 cp /etc/debootstrap/config $MNTPOINT/etc/debootstrap/
63 cp /etc/debootstrap/packages $MNTPOINT/etc/debootstrap/packages
65 # copy any existing existing files to chroot
66 [ -d /etc/debootstrap/boot ] && cp -a /etc/debootstrap/boot/* $MNTPOINT/boot/
67 [ -d /etc/debootstrap/etc ] && cp -a /etc/debootstrap/etc/* $MNTPOINT/etc/
68 [ -d /etc/debootstrap/share ] && cp -a /etc/debootstrap/share/* $MNTPOINT/share/
69 [ -d /etc/debootstrap/usr ] && cp -a /etc/debootstrap/usr/* $MNTPOINT/usr/
70 [ -d /etc/debootstrap/var ] && cp -a /etc/debootstrap/var/* $MNTPOINT/var/
73 einfo "Executing chroot-script now"
74 chroot $MNTPOINT /bin/chroot-script
77 einfo "Unmount $MNTPOINT"
81 if [ "$FSCK" = 'yes' ] ; then
82 [ -n "$FSCKTOOL" ] || FSCKTOOL="fsck.${MKFS#mkfs.}"
83 einfo "Checking filesystem on $TARGET using $FSCKTOOL"
88 einfo "Finished execution of $0 - enjoy your Debian system." ; eend 0
90 ## END OF FILE #################################################################