#! /bin/sh #Copyright (C) 2007 Kiran Chand K ,Raghesh #This program is free software; you can redistribute it and/or modify it under the terms of the #GNU General Public License as published by the Free Software Foundation; either version #2 of the License, or (at your option) any later version. This program is distributed in the hope #that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #General Public License for more details. #Contributors: #Philip Charles ,C K Raju,Badharudheen P ,Aneeb K,Maqbul V<,nimisha c,shahana raheem, Harish k Nair k nair #Jan Waseem , Ranjith Nambiar , Rajesh E.R , libin vp , K.Kiran Chand #Abu Arshad, Mohammed Rizhan A, Rezla rahim , Fathima farhaan #Main program clear echo echo "*************************************************************************" echo " INSTALLATION OF HURD L1X STARTED..." echo "*************************************************************************" echo echo " Remounting ramfs as read-write" echo mount -o remount,rw /dev/ram0 / #Detecting CD_ROM device file CDDEV=`dmesg|grep CD/DVD-ROM |awk '{print $1}' |grep hd[a-d] |tr -d :` ln -s /dev/$CDDEV /dev/cdrom echo echo " CD-Drive detected...device file is :"$CDDEV echo echo echo if [ $CDDEV = hda ]; then hcname=hd0 elif [ $CDDEV = hdb ]; then hcname=hd1 elif [ $CDDEV = hdc ]; then hcname=hd2 elif [ $CDDEV = hdd ]; then hcname=hd3 fi #Mounting CD_ROM CDMNTPNT="/mnt/cdr" mount -t iso9660 -o ro /dev/$CDDEV $CDMNTPNT cp -a $CDMNTPNT/images/sysbin/grub /sbin/ cp -a $CDMNTPNT/images/sysbin/grub-install /sbin/ cp -a $CDMNTPNT/images/sysbin/mke2fs /sbin/ rm -rf /sbin/fdisk cp -a $CDMNTPNT/images/sysbin/fdisk /sbin/ rm -rf /bin/grep cp -a $CDMNTPNT/images/sysbin/grep /bin/ cp -a $CDMNTPNT/images/sysbin/eject /bin/ tar xvzf $CDMNTPNT/images/boot/i386.tar.gz -C /usr/share/grub/ tar xvzf $CDMNTPNT/images/lib.tar.gz -C /lib echo echo echo echo echo -n " Please press ENTER to continue...>" read hi clear echo echo "*************************************************************************" echo " 1.PARTITIONING" echo "*************************************************************************" echo #Making harddisk partion fdisk -l 2>warn.log echo -n " while selecting the partition make sure it has minimum of 2gb " echo echo -n " Enter the partition name (eg:- hd[a-d]) >" read pname echo echo -n " Enter the partition no (eg:- 1-10) >" read pno echo clear cat <warn.log #Creating file system (ext3/ext2) on harddisk partition mke2fs -o hurd /dev/$pname$pno if [ $pname = hda ]; then hpname=hd0 elif [ $pname = hdb ]; then hpname=hd1 elif [ $pname = hdc ]; then hpname=hd2 elif [ $pname = hdd ]; then hpname=hd3 fi echo echo echo -n " Please press ENTER to continue...>" read hi clear echo echo "*************************************************************************" echo " 2.MAKING SWAP PARTITION" echo "*************************************************************************" echo #Mounting harddisk MNTPNT="/mnt/hd" mount /dev/$pname$pno $MNTPNT 2> warn.log #Creating swap partition echo echo -n " Enter swap size (in KB...eg:-128000,256000...) >" read size echo "please wait.................................." echo dd if=/dev/zero of=$MNTPNT/swap bs=1k count=$size mkswap $MNTPNT/swap $size clear echo echo "*************************************************************************" echo " 3.BASE SYSTEM INSTALLATION" echo "*************************************************************************" echo tar xvzpf $CDMNTPNT/install/baseGNU.tgz -C $MNTPNT/ #Creating directories... echo "$hcname">>$MNTPNT/cdrom.conf mkdir $MNTPNT/mnt mkdir $MNTPNT/cdrom mkdir $MNTPNT/mnt/floppy mkdir $MNTPNT/mnt/c mkdir $MNTPNT/mnt/d mkdir $MNTPNT/mnt/e mkdir $MNTPNT/mnt/f clear #mkdir $MNTPNT/etc //by us echo echo "*************************************************************************" echo " 4.MAKING MTAB PARTITION" echo "*************************************************************************" echo #creating /etc/mtab echo "please wait................................." echo "/dev/$pname$pno / ext3 rw 0 0"> $MNTPNT/etc/mtab echo "none /proc proc rw 0 0">> $MNTPNT/etc/mtab echo "usbdevfs /proc/bus/usb usbdevfs rw 0 0">>$MNTPNT/etc/mtab echo "none /dev/pts devpts rw,gid=5,mode=620 0 0 ">>$MNTPNT/etc/mtab echo "none /dev/shm tmpfs rw 0 0 ">>$MNTPNT/etc/mtab echo "/dev/fd0 /mnt/floppy vfat rw,nosuid,nodev 0 0">>$MNTPNT/etc/mtab echo echo echo -n " Please press ENTER to continue...>" read hi clear echo echo "*************************************************************************" echo " 5.FINAL STAGE" echo "*************************************************************************" echo echo #mkdir $MNTPNT/src #mkdir $MNTPNT/lib #cp -rf $CDMNTPNT/Minux/RPMS/* $MNTPNT/src/ #tar xvzf $CDMNTPNT/images/util.tar.gz -C $MNTPNT/ cp -a $CDMNTPNT/images/sysbin/rpm $MNTPNT/ cp -a /bin/busybox $MNTPNT/ cp -a /bin/ln $MNTPNT/ cp -a /bin/passwd $MNTPNT/ cp -a /bin/adduser $MNTPNT/ cp -a /bin/addgroup $MNTPNT/ echo echo echo echo echo echo echo echo echo " Installation completed" echo echo echo echo -n " Please press ENTER to continue...>" read hi clear echo " 2.MAKING fstab PARTITION" echo creating /etc/fstab #echo "/dev/$pname$pno / ext3 defaults 1 1">$MNTPNT/etc/fstab #echo "none /dev/pts devpts gid=5,mode=620 0 0">>$MNTPNT/etc/fstab #echo "none /proc proc defaults 0 0">>$MNTPNT/etc/fstab #echo "none /dev/shm tmpfs defaults 0 0">>$MNTPNT/etc/fstab echo "/swap none swap sw 0 0">>$MNTPNT/etc/fstab #echo "/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0">>$MNTPNT/etc/fstab echo "/dev/$hcname /cdrom iso9660fs ro,noauto 1 1">>$MNTPNT/etc/fstab clear echo "*************************************************************************" echo " 6.CREATING GRUB" echo "*************************************************************************" echo echo " If you have any Windows /Dos partition enter 'y'...." let pno1=pno-1 echo "timeout=20">$MNTPNT/boot/grub/grub2.conf echo "splashimage=($hpname,$pno1)/boot/grub/splash.xpm.gz">>$MNTPNT/boot/grub/grub2.conf #creatng grub option for windows clear echo echo echo echo echo -n " Do you have any DOS/Windows installation in your system...(y/n)>" read win if test "$win" = y then echo echo -n " Enter the DOS/Windows partition no...(eg:-1,2..10)..>" read winno let winno1=winno-1 echo "title DOS">>$MNTPNT/boot/grub/grub2.conf echo " rootnoverify (hd0,$winno1)">>$MNTPNT/boot/grub/grub2.conf echo " chainloader +1">>$MNTPNT/boot/grub/grub2.conf fi echo echo "title HURD mesce">>$MNTPNT/boot/grub/grub2.conf echo " root ($hpname,$pno1)">>$MNTPNT/boot/grub/grub2.conf echo " kernel /boot/gnumach.gz root=device:$hpname""s$pno">>$MNTPNT/boot/grub/grub2.conf cp -a $CDMNTPNT/images/grub1.conf $MNTPNT/boot/grub/ cat $MNTPNT/boot/grub/grub2.conf $MNTPNT/boot/grub/grub1.conf >>$MNTPNT/boot/grub/grub4.conf rm $MNTPNT/boot/grub/grub2.conf rm $MNTPNT/boot/grub/grub1.conf #linux partition checking echo -n " If you have any linux partition then enter the drive in which you have it." echo -n " For example if Debian installation in hda4,then enter the partition name as" echo -n " hda and partition no as 4.<" read lin if test "$lin" = y then echo echo -n " Enter the active linux partition name...(eg:-hda,hdb,hdc....)..>" read linme echo -n " Enter the active linux partition no...(eg:-1,2..10)..>" read linno #Mounting harddisk LMNTPNT="/mnt/hd1" mount /dev/$linme$linno $LMNTPNT 2> warn.log # cp -a $CDMNTPNT/images/boot/splash.xpm.gz $LMNTPNT/boot/grub/ #echo "timeout=20">$LMNTPNT/boot/grub/gr.conf #echo "splashimage=($lpname,$linno)/boot/grub/splash.xpm.gz">>$LMNTPNT/boot/grub/gr.conf cat $MNTPNT/boot/grub/grub4.conf $LMNTPNT/boot/grub/menu.lst>>$MNTPNT/boot/grub/grub.conf #cat $LMNTPNT/boot/grub/gr.conf $LMNTPNT/boot/grub/menu1.lst>>$LMNTPNT/boot/grub/menu2.lst umount $LMNTPNT else mv $MNTPNT/boot/grub/grub4.conf $MNTPNT/boot/grub/grub.conf rm $MNTPNT/boot/grub/grub4.conf fi chmod 644 $MNTPNT/boot/grub/grub.conf chroot $MNTPNT /ln /boot/grub/grub.conf /etc/grub.conf 2>warn.log chroot $MNTPNT /ln -s /boot/grub/grub.conf /boot/grub/menu.list 2>warn.log chroot $MNTPNT /ln -s /dev/$CDDEV /dev/cdrom 2>warn.log #Configuring GRUB boot loader cp -a $CDMNTPNT/images/boot/splash.xpm.gz $MNTPNT/boot/grub/ cp -rf /usr/share/grub/* $MNTPNT/usr/share/grub/ grub-install --root-directory=$MNTPNT /dev/$pname 2> warn.log #Giving permissions to configuration files chmod 644 $MNTPNT/etc/group chmod 644 $MNTPNT/etc/passwd #chmod 640 $MNTPNT/etc/shadow chmod 644 $MNTPNT/etc/fstab chmod 640 $MNTPNT/etc/hosts #removing root passwd echo chroot $MNTPNT /passwd -d root 2>warn.log clear chroot $MNTPNT /ln -s /dev/$CDDEV /dev/cdrom 2>warn.log rm -rf $MNTPNT/busybox rm -rf $MNTPNT/rpm rm -rf $MNTPNT/ln rm -rf $MNTPNT/passwd rm -rf $MNTPNT/adduser rm -rf $MNTPNT/addgroup #Unmounting harddisk partition umount $MNTPNT clear #Unmounting CD-ROM umount $CDMNTPNT eject -r echo echo echo echo -n "Please remove the CD-ROM from the CD-drive and then press ENTER...>" read hi eject -t rm -rf warn.log #rebooting sytem clear echo echo echo echo echo -n "System is going down for reboot now...press ENTER key...>" read hi reboot