if I haven't forgotten something...
famous last words... I forgot a few things. but this version puts you much closer to having a working system in 90 minutes or less. All you need to do is:
boot off of life CD mkdir /mnt/flash mount /dev/sda1 /mnt/flash #(don't forget -t vfat if necessary) edit /mnt/flash/gentoo/config #(to meet your requirements) bash /mnt/flash/gentoo/phase1.sh #( to start everything off)
when it comes time, menuconfig will come up and let you configure the kernel.
current problems are getting modules to automatically load and automatically setting the password. I may just used to make the root password go away at login so you can get in without first putting single user mode but I'm not really comfortable with that for obvious reasons. on the module loading problem, I'm coming to the opinion that if you need a module at boot time, it should just be built into the kernel. YKMV.
I think this will be the last posting of this code, eventually I will put up Web accessible page or two on these pieces and I will post a notice at that point.
---eric
-- http://www.wired.com/wired/archive/13.03/view.html?pg=5
The result of the duopoly that currently defines "competition" is that prices and service suck. We're the world's leader in Internet technology - except that we're not.
# config variables HOST_NAME=rufus DOMAIN_NAME=harvee.org DRIVE=/dev/hda
# CPUTYPE="i686" CPUTYPE="pentium3" MKFS2="mke2fs" MKFS3="mke2fs -j" MKFSR="mkreiserfs -q" MKSWP="mkswap" PART_ROOT="3" DRIVE_ROOT="/dev/hda" # format of the filesystem list is: # partition number:filesystem command # create the entries in the order in which they will be created and # mounted. PART_ORDER=(1 2 3) # order of the elements in each entry: # partition number: mount point: file system format command PART_LIST[1]="3:/mnt/gentoo:${MKFSR}" PART_LIST[2]="1:/mnt/gentoo/boot:${MKFS3}" PART_LIST[3]="2::${MKSWP}" # proxy configurations to say to wear and tear gentoo servers # replicated below in constructing make.conf SYNC="rsync://192.168.25.11/gentoo-portage" http_proxy=http://192.168.25.11:8080 RESUMECOMMAND=" /usr/bin/wget -t 5 --passive-ftp \${URI} -O \${DISTDIR}/\${FILE}" # if ethernet module is not detected automatically, list module here ETHERMODULE="" # DHCP usually requires nothing but if module is manually loaded. # activate command here DHCPCD_CMD="dhcpcd" #otherwise enter static IP information. Note, DHCP takes priority #over static information # static IP address IP_ADDR=192.168.25.11 BROADCAST=192.168.25.0 NETMASK=255.255.255.0 GATEWAY=192.168.25.254 NAMESERVER=192.168.25.1 # PCMCIA?? "Y" to turn on "" to turn off PCMCIA="y" # bail if config only if [ -z $1 ] ; then # partitions # describe your partitions here in sfdisk format PARTITIONS=`mktemp `|| exit 1 cat > $PARTITIONS <<EOF 0,200,L ,1000,S ,,L ; EOF # your default make.conf MAKE_CONF=`mktemp `|| exit 1 cat > $MAKE_CONF <<EOF MAKEOPTS="-j3" AUTOCLEAN="yes" PORTDIR_OVERLAY=/usr/local/portage USE="mmx sse alsa oss aim emacs fastcgi gphoto2 imap maildir mozilla pcmcia python usb gdbm pam png berkdb apache2 perl qt readline gif gtk gtk2 ldap mbox mcal ncurses ssl wxwindows zlib" SYNC="rsync://xeno/gentoo-portage" http_proxy=http://xeno:8080 RESUMECOMMAND=" /usr/bin/wget -t 5 --passive-ftp \${URI} -O \${DISTDIR}/\${FILE }" EOF # stage grub.conf and any other needed data GRUB_CONF=`mktemp `|| exit 1 cat > $GRUB_CONF <<EOF PCMCIA=${PCMCIA} DRIVE_ROOT=${DRIVE_ROOT} PART_ROOT=${PART_ROOT} cat > /boot/grub/grub.conf <<PHASE2 # Which listing to boot as default. 0 is the first, 1 the second etc. default 0 # How many seconds to wait before the default listing is booted. timeout 30 # Nice, fat splash-image to spice things up :) # Comment out if you don't have a graphics card installed #splashimage=(hd0,0)/grub/splash.xpm.gz title=Gentoo \${KERNEL_VERSION} # Partition where the kernel image (or operating system) is located root (hd0,0) kernel /\${KERNEL_VERSION} root=${DRIVE_ROOT}${PART_ROOT} PHASE2 EOF FSTAB=`mktemp `|| exit 1 cat > $FSTAB <<EOF # /etc/fstab: static file system information. # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $ # # noatime turns off atimes for increased performance (atimes normally aren't # needed; notail increases performance of ReiserFS (at the expense of storage # efficiency). It's safe to drop the noatime options if you want and to # switch between notail and tail freely. # <fs> <mountpoint> <type> <opts> <dump/pass> # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. /dev/hda3 / reiserfs noatime 0 0 /dev/hda1 /boot ext3 noatime 1 1 /dev/hda2 none swap sw 0 0 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0 #/dev/fd0 /mnt/floppy auto noauto 0 0 # NOTE: The next line is critical for boot! none /proc proc defaults 0 0 # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for # POSIX shared memory (shm_open, shm_unlink). # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will # use almost no memory if not populated with files) # Adding the following line to /etc/fstab should take care of this: none /dev/shm tmpfs defaults 0 0 EOF fi
#!/bin/bash #phase one of gentoo install . /mnt/flash/gentoo/config # changes passwd #passwd ### place network configuration set up here # if ethernet module is not detected automatically, load it here # modprobe <your Ethernet module here> if [ -n "$ETHERMODULE" ] ; then modprobe $ETHERMODULE fi if [ -n "$DHCPCD_CMD" ] ; then eval $DHCPCD_CMD else ifconfig eth0 ${IP_ADDR} broadcast ${BROADCAST} netmask ${NETMASK} up route add default gw ${GATEWAY} cat > /etc/resolv.conf <<EOF nameserver ${NAMESERVER} EOF fi # start sshd /etc/init.d/sshd start # get portage if no copy locally. This won't get the latest copy # unless there is none if [ ! -f /mnt/flash/gentoo/stages/portage ]; then # ask the user for a portage mirror site eval X`mirrorselect -i -o` # grab the first selection PORTAGE_SITE=`echo ${XGENTOO_MIRRORS}| cut -f1 -d" "` PORTAGE_PATH=${PORTAGE_SITE}snapshots/ wget --proxy=off -O /tmp/index.html $PORTAGE_PATH PORTAGE=`cat /tmp/index.html | egrep -v "md5sum|gpgsig"| grep portage| \ tail -n 1| cut -d" " -f 8| cut -f 2 -d">"| cut -f 1 -d"<"` wget --proxy=off ${PORTAGE_PATH}/${PORTAGE} -O /mnt/flash/gentoo/stages/portage fi # partition your disk. # *CAUTION* this can really screw up your system. # this creates four partitions. First field is the start, second field # is the size in MB, and third field is the Linux or swap. # it should be possible to add extended partitions but I haven't needed # them yet /sbin/sfdisk -uM ${DRIVE} < $PARTITIONS # create swap space and file systems on the partitions created # previously for x in ${PART_ORDER[*]} do i=${PART_LIST[$x]} PART=`echo $i | cut -d":" -f1` MNTPT=`echo $i | cut -d":" -f2` MKFS=`echo $i | cut -d":" -f3` eval $MKFS ${DRIVE}${PART} if [ "${MKFS}" == "${MKSWP}" ]; then swapon ${DRIVE}${PART} else # mount up partitions mkdir -p $MNTPT mount ${DRIVE}${PART} $MNTPT fi done # install the stage you want. It's probably a good idea to download and # store the appropriate stage image on the USB flash. Saves trying to # figure out which mirror to get from and its just convenient. cd /mnt/gentoo tar -xjpf /mnt/flash/gentoo/stages/stage?-${CPUTYPE}*.tar.bz2 -C /mnt/gentoo tar -xjf /mnt/flash/gentoo/stages/portage -C /mnt/gentoo/usr # and add the gentoo mirrors mirrorselect -a -s4 -o |grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf # set up DNS for the new system cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf # set up domain name echo ${HOST_NAME} > /mnt/gentoo/etc/hostname echo ${DOMAIN_NAME} > /mnt/gentoo/etc/dnsdomainname rc-update add domainname default # and set up the /proc environment. mount -t proc none /mnt/gentoo/proc # copy all of the phases to the new drive in preparation # for the rest of the installation process cp /mnt/flash/gentoo/phase*.sh /mnt/gentoo/ cp /mnt/flash/gentoo/config /mnt/gentoo/ cp $GRUB_CONF /mnt/gentoo/grub.transient cp $FSTAB /mnt/gentoo/etc/fstab cat $MAKE_CONF >> /mnt/gentoo/etc/make.conf if [[ -f /mnt/flash/gentoo/kernel_config ]]; then cp /mnt/flash/gentoo/kernel_config /mnt/gentoo/ fi # set up the network interface if [ -z "${DHCPCD_CMD}" ] ; then grep -v "^iface_eth0" /mnt/gentoo/etc/conf.d/net > /tmp/net echo iface_eth0=\"${IP_ADDR} broadcast ${BROADCAST} netmask ${NETMASK}\">> /tmp/net echo gateway=\"eth0/${GATEWAY}\" >> /tmp/net cp /tmp/net /mnt/gentoo/etc/conf.d/net else echo "iface_eth0=\"dhcp\"" >> /mnt/gentoo/etc/conf.d/net fi # directories to build mkdir /mnt/gentoo/usr/local/portage # launch phase 2 chroot /mnt/gentoo /bin/bash -c "bash phase2.sh"
#!/bin/bash #this is the chroot side of the installation process #set up the new environment env-update source /etc/profile # update the portage tree emerge --sync #get the kernel emerge vanilla-sources # at this point, one could copy in a predefined configuration # file or one could just manually configure. cd /usr/src/linux #let's manually configure if [[ -f /kernel_config ]]; then cp /kernel_config /usr/src/linux/.config else make menuconfig fi # then build the kernel make && make modules_install # move it cd /usr/src KERNEL_VERSION=`ls -d linux-*` cd /usr/src/${KERNEL_VERSION}/ cp arch/i386/boot/bzImage /boot/${KERNEL_VERSION} cp System.map /boot/System.map-${KERNEL_VERSION} cp .config /boot/config-${KERNEL_VERSION} emerge syslog-ng rc-update add syslog-ng default emerge vixie-cron rc-update add vixie-cron default emerge dhcpcd emerge slocate emerge reiserfsprogs emerge grub emerge gentoolkit # finish creating grub file and installing grub . /grub.transient cp /proc/mounts /etc/mtab grub-install $DRIVE_BOOT # pickup pcmcia symbol in grub cross over. need better way. if [ -n $PCMCIA ] ; then USE="-X" emerge pcmcia-cs rc-update add pcmcia default fi # more start up processes rc-update add net.eth0 default rc-update add sshd default if [ -f /phase3 ] ; then bash /phase3 fi
#!/bin/bash TARGET=/dev/hda if [ ! -f /mnt/gentoo/etc/make.conf ]; then mount ${TARGET}3 /mnt/gentoo mount ${TARGET}1 /mnt/gentoo/boot # and set up the /proc environment. mount -t proc none /mnt/gentoo/proc fi cat >/mnt/gentoo/catch_chroot.sh <<EOF #set up the new environment env-update source /etc/profile bash EOF cat >/mnt/gentoo/mgk.sh <<EOF # then build the kernel make && make modules_install # move it cd /usr/src KERNEL_VERSION=\`ls -d linux-*\` cd /usr/src/\${KERNEL_VERSION}/ cp arch/i386/boot/bzImage /boot/\${KERNEL_VERSION} cp System.map /boot/System.map-\${KERNEL_VERSION} cp .config /boot/config-\${KERNEL_VERSION} EOF chroot /mnt/gentoo /bin/bash -c "bash /catch_chroot.sh"