coLinux
Advertisement

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

cat >$CO_MOUNT/etc/apt/sources.list <<EOF
deb http://http.us.debian.org/debian testing main contrib non-free
deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free
deb http://security.debian.org stable/updates main contrib non-free
EOF

cat >$CO_MOUNT/etc/hosts <<EOF
127.0.0.1     localhost colinux
192.168.0.40  colinux
192.168.0.1   windows
EOF

cat >$CO_MOUNT/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
  address 192.168.0.40
  gateway 192.168.0.1
  netmask 255.255.255.0
#iface eth0 inet dhcp
EOF

cat >>$CO_MOUNT/etc/default/rcS <<EOF
HWCLOCKACCESS=no
EOF

cat >$CO_MOUNT/etc/fstab <<EOF
/dev/cobd0 / ext3 defaults 0 1
#/dev/cobd1 none swap sw 0 0
proc /proc proc defaults 0 0
EOF

chroot $CO_MOUNT apt-get update
chroot $CO_MOUNT apt-get autoclean
chroot $CO_MOUNT passwd -d root

umount $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

Advertisement