Cobootstrap
From coLinux
[edit] cobootstrap.sh
This is a small script that should give you an idea how to create your own colinux Debian image. This script uses debootstrap to download the nessesary basic packages. By default it build a 150mb image, just change =CO_SIZE= to your preferred size. Because this script uses debootstrap it will run only on a Debian system with this package installed but it may give you a good hint how to do this with other distribution.
#!/bin/sh
# cobootstrap.sh: Build a colinux-debian image. Works on top of debootstrap
# (c) Thomas Fritzsche
#
CO_SIZE=150000
CO_WD=`pwd`
cd `dirname $0`
CO_ROOT=`pwd`
cd $CO_ROOT
CO_IMAGE=./image
CO_LOG=$CO_ROOT/log
cp /dev/null $CO_LOG >> $CO_LOG 2>&1
CO_MOUNT=$CO_ROOT/mnt
dd bs=1k count=$CO_SIZE if=/dev/zero of=$CO_IMAGE
mkfs.ext3 -J size=1 -F -m 0 $CO_IMAGE
if ! test -f $CO_MOUNT ; then
mkdir -p $CO_MOUNT
fi
mount -o loop -t ext3 $CO_IMAGE $CO_MOUNT
debootstrap --verbose --include=libssl0.9.6,zlib1g,ssh --exclude=pcmcia-cs \
--arch i386 woody $CO_MOUNT ftp://ftp.uk.debian.org/debian
for i in 0 1 2 3 4
do
if ! test -f $CO_MOUNT/dev/cobd$i ; then
mknod $CO_MOUNT/dev/cobd$i b 117 $i >> $CO_LOG 2>&1
fi
done
CO_APT=$CO_MOUNT/etc/apt/sources.list
echo -e "deb http://http.us.debian.org/debian testing main contrib non-free" \
> $CO_APT
echo -e "deb http://non-us.debian.org/debian-non-US testing/non-US " \
"main contrib non-free" >> $CO_APT
echo -e "deb http://security.debian.org stable/updates " \
"main contrib non-free" >> $CO_APT
CO_HOSTS=$CO_MOUNT/etc/hosts
echo -e "127.0.0.1 localhost colinux" > $CO_HOSTS
echo -e "192.168.0.40 colinux" >> $CO_HOSTS
echo -e "192.168.0.1 windows" >> $CO_HOSTS
CO_INTERFACES=$CO_MOUNT/etc/network/interfaces
echo -e "auto lo eth0" > $CO_INTERFACES
echo -e "iface lo inet loopback" >> $CO_INTERFACES
echo -e "iface eth0 inet static\n address 192.168.0.40" >> $CO_INTERFACES
echo -e " gateway 192.168.0.1\n netmask 255.255.255.0" >> $CO_INTERFACES
CO_FSTAB=$CO_MOUNT/etc/fstab
echo -e "/dev/cobd0 / ext3 defaults 0 1" > $CO_FSTAB
#echo -e "/dev/cobd1 none swap sw 0 0" >> $CO_FSTAB
echo -e "proc /proc proc defaults 0 0" >> $CO_FSTAB
rm -f $CO_MOUNT/var/cache/apt/archives/*
umount $CO_MOUNT
exit 0
MassTranslated on 25 Dec 2004.
MassTranslated on Sun Apr 23 17:35:41 UTC 2006
