#!/bin/sh linktarget=`readlink /bin` binless=${linktarget%/bin} domain=${binless#/http/} echo "Installing release with root URL of: $domain" read -p "What Disk Do you want to format (hda, sda, etc.) ?" rootdisk echo "When you're done, make sure to mark the partition as 'active'" fdisk /dev/$rootdisk dd conv=notrunc bs=440 count=1 if=/usr/lib/syslinux/mbr.bin of=/dev/$rootdisk fdisk -l /dev/$rootdisk read -p "Which partition (all partitions on $rootdisk listed above) Do you want to install on? (e.g. ${rootdisk}1, ${rootdisk}2, etc) " partition #if [ "$partition" == `cat /bootstrap` ] #then # echo "Sorry, you must boot off of something else to format $partition" # exit 1 #fi #mdev -s mkfs.ext3 /dev/$partition mkdir /tmp/installhere mount /dev/$partition /tmp/installhere cd /tmp/installhere mkdir dev etc http proc sys tmp var configs home #.crestcache #bin lib sbin usr boot ln -s /http/$domain/bin bin ln -s /http/$domain/lib lib ln -s /http/$domain/sbin sbin ln -s /http/$domain/usr usr ln -s /http/$domain/boot boot cp -R /dev/* dev mkdir etc/davfs2 ln -s /tmp/.davfs_secretsfile etc/davfs2/secrets ln -s /http/$domain/etc/nsswitch.conf etc/ ln -s /http/$domain/etc/inittab etc/ ln -s /tmp/resolv.conf etc/resolv.conf ln -s /configs/wpa_supplicant.conf etc/wpa_supplicant.conf ln -s /proc/mounts etc/mtab touch etc/mdev.conf echo "root::0:0:Primary User:/home:/bin/ash" > etc/passwd echo "davfs2::0:0:DAV-fs user alias:/home:/bin/ash" >> etc/passwd echo "root::0:root" > etc/group echo "davfs2::0:davfs2" >> etc/group mkdir var/run mkdir -p var/cache/davfs2 #make emergency shell echo "#!/.crestcache/$domain/bin/busybox ash" > emergencyshell echo "exec /.crestcache/$domain/bin/busybox ash" >> emergencyshell chmod +x emergencyshell #ln -s /http/$domain/boot/bzImage boot/bzImage md5sum boot/bzImage md5sum boot/grub/* # have to do that symlink and boot thing BEFORE we do the copy! cp -R /.crestcache .crestcache ln -s /.crestcache/$domain http/$domain #mkdir boot/grub #echo "hiddenmenu" > boot/grub/grub.conf #echo "timeout 0" >> boot/grub/grub.conf #echo "title Normal Boot" >> boot/grub/grub.conf #echo "kernel /boot/bzImage" >> boot/grub/grub.conf # had to change this, it was copying the 'live' configs *into* the configs directory, not *over* cp -R /configs . #this could be iso or sys linux - not sure! use wildcards #mv /tmp/installhere/boot/???linux /tmp/installhere/boot/extlinux #mv /tmp/installhere/boot/extlinux/???linux.cfg /tmp/installhere/boot/extlinux/extlinux.conf #mv /tmp/installhere/boot/bstrap.cfs /tmp/installhere/boot/bootstrap.cramfs #mv /tmp/installhere/boot/extlinux/extlinux.cfg /tmp/installhere/boot/extlinux/extlinux.conf #mkdir /tmp/installhere/.crestfs_metadata_rootnode #extlinux -i /tmp/installhere/boot/extlinux mv boot newboot #mkdir -p boot/grub #cp newboot/grub/*stage* boot/grub/ ln -s .crestcache/$domain/boot boot echo "We are installing grub on the _partition_, not the whole drive" grub-install --root-directory=/tmp/installhere /dev/$partition rm boot mv newboot boot cd / umount /tmp/installhere rmdir /tmp/installhere read -p "Installation Complete. Press return to continue" morecrappo