#!/bin/sh #vliveinstall a script to install vectorlive to the hard disk # # # # Written By Uel Archuletta for VectorLinux vdir=/sbin . $vdir/vasm-functions check_root TMP=/var/log/setup/tmp mkdir -p $TMP # VARIABLES TP_X=${1:-/} if [ "$TP_X" = "/" ]; then ROOT_DIR="" else ROOT_DIR=$TP_X fi #find the livecd livecd="`cat /proc/mounts |grep -v loop |grep "/mnt" |grep -v "/mnt/live" |grep -v "/mnt/_" |grep -v "/mnt/cdrom_" |cut -d " " -f 2 |grep -v "/proc" | egrep -v "^/dev|^/sys|^proc|^/\$"`" menu_install() { ##check to see if more than 1 partition is available if only 1 use it partitions="`mount |grep -v dos|grep -v fat|grep -v ntfs|egrep -o "/mnt/[a-z]+[0-9]+" | uniq`" j="0" for i in $partitions; do ## was trying to eliminate partitions without enought space I havent found a good way yet this doesnt always work #if [ "`df -h|grep $i|cut -d G -f3|cut -d . -f1`" -gt 2 ] 2>/dev/null; then part[$j]="$i" j=`expr $j + 1` #fi done $DCMD --backtitle "$BACKTITLE" --title "Install to Partition" --menu "\n This program assumes you have mounted and formatted your partition\n If you have not done so yet please hit ESC otherwise go ahead\n Which partition would you like to install the livecd to?\n This will be your root partition. If all you see is the placeholder it means your partitions arent \n mounted or dont contain a linux filesystem\n Choose which partition you would like to use" \ 20 74 4 \ "placeholder" "Do not choose this" \ ${part[0]} ${part[0]} \ ${part[1]} ${part[1]} \ ${part[2]} ${part[2]} \ ${part[3]} ${part[3]} \ ${part[4]} ${part[4]} \ ${part[5]} ${part[5]} \ ${part[6]} ${part[6]} \ ${part[7]} ${part[7]} \ ${part[8]} ${part[8]} \ ${part[9]} ${part[9]} \ 2> $freply result=$? if [ $result != 0 ];then exit 0 fi TARGET="`cat $freply`" if [ $TARGET == "placeholder" ];then infobox "sorry that wont work try again" exit 0 fi dirs=`ls -1 / | egrep -v "^dev" | egrep -v "^proc" | egrep -v "^mnt" | egrep -v "^boot" | egrep -v "^sys" | egrep -v "^tmp"` yesnobox "would you like to use a seperate /home partition" if [ $? != 1 ]; then dir=`echo $dirs | egrep -v "^home"` partitions="`mount |grep -v dos|grep -v fat|grep -v ntfs|egrep -o "/mnt/[a-z]+[0-9]+" | uniq | grep -v $TARGET`" j="0" for i in $partitions; do home[$j]="$i" j=`expr $j + 1` done $DCMD --backtitle "$BACKTITLE" --title "Choose home Partition" --menu "\n Which partition would you like to use as your home Partition?\n If all you see is the placeholder then we cant find a partition to use, maybe your partitions arent mounted?\n Choose which partition you would like to use" \ 20 74 4 \ "placeholder" "Do not choose this" \ ${home[0]} ${home[0]} \ ${home[1]} ${home[1]} \ ${home[2]} ${home[2]} \ ${home[3]} ${home[3]} \ ${home[4]} ${home[4]} \ ${home[5]} ${home[5]} \ ${home[6]} ${home[6]} \ ${home[7]} ${home[7]} \ ${home[8]} ${home[8]} \ ${home[9]} ${home[9]} \ 2> $freply HOME="`cat $freply`" if [ $HOME == "placeholder" ];then infobox "sorry that wont work try again" exit 0 fi if [ "$HOME" != "" ]; then cp --preserve=all -R /home/* $HOME/ sephome="yes" else msgbox "sorry copying to /home failed you will have to do it manualy" fi else dir=`echo $dirs` fi infobox "hold tight this is going to take a while" #x=1 ##size should be the total installed size returned from df it is different between soho and standard #size="1998028" (for i in $dir; do cp --preserve=all -R /$i $TARGET/ #x=`expr $x + 10` done) | /sbin/dfgaugeX $TARGET $size "LiveCD" #/sbin/dfgauge $TARGET $size $i #progress 100 "done" mkdir -p $TARGET/{tmp,boot,mnt,dev,sys,proc} infobox "done copying on to initializing" cd $TARGET/ device=`mount |egrep $TARGET | cut -d " " -f 1` rootfs=`mount | grep $device | cut -d " " -f5` echo "$device / $rootfs defaults 1 1" > $TARGET/etc/fstab if [ $sephome == "yes" ]; then homefs=`mount | grep $HOME | cut -d " " -f5` echo "$HOME /home $homefs defaults 1 2" >> $TARGET/etc/fstab fi echo " devpts /dev/pts devpts gid=5,mode=620 0 0 proc /proc proc defaults 0 0 /dev/fd0 /mnt/floppy vfat,msdos noauto,users,suid,dev,exec 0 0" >> $TARGET/etc/fstab rm $TARGET/etc/mtab cp /boot/boot/vmlinuz $TARGET/boot cp /boot/boot/initrd.real $TARGET/boot/initrd cp --preserve -R /dev/null $TARGET/dev cp --preserve -R /dev/console $TARGET/dev cp /etc/lilo.conf $TARGET/etc/lilo.conf cd $TARGET/etc/rc.d/ && rm rc.S && ln -s rc.S.real rc.S cd $TARGET/etc/rc.d/ && rm rc.M && ln -s rc.M.real rc.M #cd $TARGET/etc/rc.d/ && rm rc.local && ln -s rc.local.real rc.local #cd $TARGET/etc/rc.d/ && rm rc.X && ln -s rc.X.real rc.X #cd $TARGET/etc/rc.d/ && rm rc.K && ln -s rc.K.real rc.K ##these are not needed for standard only for SOHO #cd $TARGET/opt/kde/share/config/kdm && rm kdmrc && mv kdmrc.bak kdmrc cd $TARGET/opt/kde/share/apps/kdm/themes/GlassLight if [ -e GlassLight.xml.bak ];then rm GlassLight.xml && mv GlassLight.xml.bak GlassLight.xml fi HardDisk=`fdisk -l | grep Disk | cut -d " " -f 2 | cut -c 1-8` #x=`echo $HardDisk | wc -w` #if [ $x != 1 ]; then root=$(cat /proc/mounts |grep ^/dev |grep $TARGET |cut -d " " -f 1) j="0" for i in $HardDisk; do hd[$j]="$i" j=`expr $j + 1` done $DCMD --backtitle "$BACKTITLE" --title "LILO INSTALL" --menu "\n LILO (Linux Loader) install lilo \n we need to know where you would like lilo to be written \n if you choose exit you will have to setup your boot manager manually \n Choose where you would like to install lilo" \ 20 74 4 \ ${hd[0]} ${hd[0]} \ ${hd[1]} ${hd[1]} \ ${hd[2]} ${hd[2]} \ ${hd[3]} ${hd[3]} \ ${part[0]} ${part[0]} \ ${part[1]} ${part[1]} \ ${part[2]} ${part[2]} \ ${part[3]} ${part[3]} \ ${part[4]} ${part[4]} \ ${part[5]} ${part[5]} \ ${part[6]} ${part[6]} \ ${part[7]} ${part[7]} \ ${part[8]} ${part[8]} \ ${part[9]} ${part[9]} \ "/dev/fd0" "Floppy" \ "Exit" "Do not install lilo" \ 2> $freply result="`cat $freply`" if [ $result == "Exit" ]; then infobox "Remeber to setup your boot manager" else LILO_TARGET=$result #else #LILO_TARGET="$HardDisk" #fi ##this only did the mbr of the disk where the target resides ##not good if I want to install to hdb2 and have lilo on hda #dev=$(cat /proc/mounts |grep ^/dev |grep $TARGET |cut -c 1-8) if [ -e $TARGET/root/.bitmap ];then mv $TARGET/root/.bitmap $TARGET/boot/bitmap BIT="bitmap=/boot/bitmap/boot.bmp" fi echo " boot = $LILO_TARGET prompt timeout = 20 $BIT change-rules reset vga = 791 image = /boot/boot/vmlinuz initrd= /boot/boot/initrd root = $root label = linux append=\"4 splash=silent\" read-only " >$TARGET/etc/lilo.conf infobox "setting up lilo" mount -o bind /dev $TARGET/dev mount -t proc proc $TARGET/proc #mount --move /proc $TARGET/proc sync chroot $TARGET lilo #exit umount $TARGET/dev umount $TARGET/proc #mount -t proc proc /proc fi SETUP_DIR="$TARGET/var/log/setup" INIT_DIR="$SETUP_DIR/init" mkdir -p $INIT_DIR chmod 700 $INIT_DIR echo " #!/bin/sh vdir=/sbin . $vdir/vasm-functions yesnobox "would you like to \nreconfigure the system?" if [ $? != 1 ]; then exec /sbin/config-stage1 vector-virgin-heavy $TARGET $KEYMAP else exit 0 fi " > $INIT_DIR/config-stage2 chmod a+x $INIT_DIR/config-stage2 msgbox "all done you can reboot now and try it out" Success return 0 } ############################ # MAIN MENU wizard menu_install