#! /bin/sh # install debian system on hard disk # default target disk is /dev/hdb (slave on primary IDE) # 2005-12-03 Rafael Skodlar # http://www.inittab.de/manuals/debootstrap.html # Define disk drive DISK=/dev/hdb MPOINT=/mnt/hdb1 fdisk $DISK mkpartitions() { for i in 1 2 5 6 7 do echo "=====> ${DISK}$i" mke2fs -m 2 -j ${DISK}$i done for i in 1 2 5 6 7 do echo "=====> ${DISK}$i" fsck ${DISK}$i done [ ! -d $MPOINT ] && mkdir $MPOINT mount ${DISK}1 $MPOINT mkdir ${DISK}1/usr mkdir ${DISK}1/var mkdir ${DISK}1/tmp mkdir ${DISK}1/home mount ${DISK}2 ${MPOINT}/usr mount ${DISK}5 ${MPOINT}/var mount ${DISK}6 ${MPOINT}/tmp mount ${DISK}7 ${MPOINT}/home } mkdir ${MPOINT}/home/var.cache.apt cd ${MPOINT}/var/cache mv apt/* ../../home/var.cache.apt rmdir /var/cache/apt ln -s ../../home/var.cache.apt apt aptsource() { cat << EOM > ${MPOINT}/etc/apt/sources.list deb http://ftp.us.debian.org/debian/ stable main non-free contrib deb-src http://ftp.us.debian.org/debian/ stable main non-free contrib deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free deb-src http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free deb http://security.debian.org/ stable/updates main contrib non-free #deb http://pkg-kde.alioth.debian.org/kde-3.4.0/ ./ #deb http://www.morphix.org/debian ./ #deb http://ftp.us.debian.org/debian/ testing main #deb-src http://ftp.us.debian.org/debian/ testing main EOM } # export DEBOOTSTRAP_DIR=/tmp/debootstrap/ debootstrap sarge $MPOINT http://ftp.us.debian.org/debian echo "Please wait ..." # wait for ---> I: Base system installed successfully. mkfstab() { cat << EOM > /etc/fstab # /etc/fstab: static file system information. # # file mount part. # system point type options dump pass /dev/hda1 / ext3 errors=remount-ro 0 1 /dev/hda3 none swap sw 0 0 proc /proc proc defaults 0 0 /dev/hda2 /usr ext2 defaults 0 2 /dev/hda5 /var ext2 defaults 0 2 /dev/hda6 /tmp ext2 defaults 0 2 /dev/hda7 /home ext2 defaults 0 2 /dev/fd0 /floppy auto user,noauto 0 0 /dev/cdrom /cdrom iso9660 ro,user,noauto 0 0 EOM } chroot $MPOINT apt-get update apt-get upgrade apt-get install grub grub-install $DISK /etc/lilo.conf: Sample LILO boot loader configuration. boot=/dev/hda root=/dev/hda1 compact install=/boot/boot.b map=/boot/map vga=ask delay=20 image=/boot/vmlinuz root=/dev/hda1 label=Linux initrd=/initrd.img read-only install package mkinitrd-tools and modify /etc/mkinitrd/mkinitrd.conf so $ROOT points to your new root partition (autodetection will fail in chroot). These steps are only required if you want to use one of the Debian kernel-images. mount /proc /proc -t proc apt-get install initrd-tools ============================ check /etc/mkinitrd/mkinitrd.conf (SCSI) MODULES=most DELAY=0 ROOT=/dev/sda1 # This controls the permission of the resulting initrd image. UMASK=022 # generate the initrd image. MKIMAGE='mkcramfs %s %s > /dev/null' ---------------------------- chroot# mount /proc and install a kernel image (kernel-image-2.4.18-xxx xxx=386,..,686 mount /proc /proc -t proc apt-get install kernel-image-2.4.18-686 apt-get install kernel-image-2.6.8-2-686 add the initrd to lilo.conf and run lilo again before leaving the chroot. chroot# exit umount /mnt/hda1/proc umount /mnt/hda1 reboot