|
From: Heiko Z. <smi...@us...> - 2004-05-27 00:27:57
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30154 Modified Files: install-on-usb Log Message: more cleanup of the script (Tim Tait) Index: install-on-usb =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/install-on-usb,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- install-on-usb 18 May 2004 01:06:43 -0000 1.13 +++ install-on-usb 27 May 2004 00:27:44 -0000 1.14 @@ -12,9 +12,17 @@ TMPDIR="./tmp-install2usb" +# You should set $EDITOR or make an editor soft link if you don't like these choices +[ -z "$EDITOR" ] && EDITOR=`which editor` +[ -z "$EDITOR" ] && EDITOR=`which nano` +[ -z "$EDITOR" ] && EDITOR=`which vim` +[ -z "$EDITOR" ] && EDITOR=`which vi` +[ -z "$EDITOR" ] && { echo "Unable to find any text editor, you won't be able to customize your menus."; + echo "To fix this, set EDITOR to you favorite."; } + #### Pick your favorite disk part tool: -FDISK="fdisk" -#FDISK="cfdisk" +#FDISK="fdisk" +FDISK="cfdisk" copy_iso_file () { @@ -23,7 +31,7 @@ isosize_bin="$TMPDIR/iso-mnt/usr/bin/isosize" if [ -b "$1" ]; then - #which isosize || { echo "Utility isosize not found - can not copy from a CD."; return 1; } + [ -f $isosize_bin ] || { echo "Utility \"$isosize_bin\" not found - can not copy from a CD."; return 1; } echo "copying image of CD in $1 to device mounted on $2" iso_info=`$isosize_bin -x $1` nsectors=`echo $iso_info | cut -d' ' -f3 | cut -d',' -f1` @@ -43,7 +51,7 @@ ask_yes_no () { ANS="" - read -p " (y/n) " -n 1 -rs ANS + read -p " (y/n) " -t 60 -n 1 -rs ANS echo $ANS [ ${ANS:-n} = "y" -o ${ANS:-n} = "Y" ] && return 0 return 1 @@ -65,7 +73,7 @@ install_lilo () { echo "Configuring LILO boot sector and menu" - cat > $TMPDIR/disk-mnt/boot/lilo.conf <<-EOF + cat > $TMPDIR/lilo.conf <<-EOF read-only compact lba32 @@ -77,6 +85,14 @@ message = /boot/message disk = /dev/sda bios = 0x80 + # Devil-Linux Boot Line options: + # DL_config=/dev/discs/disc0/part1 - loads the etc.tar.bz2 form that device + # DL_config_no_scan - prevents scanning for etc.tar.bz2 + # DL_device=/dev/discs/disc0/part1 - Loads CD/ISO from that device + # DL_device_no_scan - Prevents scannign for CD/ISO + # + # Note: "/dev/hda1" type devices are not supported! Use /dev/discs/... or /dev/ide/... + # type device names. image = /boot/vmlinuz label = Devil-Linux @@ -85,6 +101,11 @@ initrd = /boot/initrd.gz EOF + + echo -n "Do you want to edit the lilo menu file " + ask_yes_no && `screen $EDITOR $TMPDIR/lilo.conf` + cp -p $TMPDIR/lilo.conf $TMPDIR/disk-mnt/boot/ > /dev/null || return 1 + cp /boot/boot.b tmp/disk-mnt/boot/ || return 1 cp /boot/mbr.b tmp/disk-mnt/boot/ || return 1 lilo -r $TMPDIR/disk-mnt -C /boot/lilo.conf -M $1 || return 1 @@ -107,37 +128,51 @@ rm -f $device_map - cat > $TMPDIR/disk-mnt/boot/grub/grub.conf <<-EOF - timeout=10 - splashimage=(hd0,$2)/boot/grub/devil-linux.xpm.gz - title Devil-Linux - Standard VGA - root (hd0,$2) - kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK - initrd /boot/initrd.gz - title Devil-Linux - VESA Frame Buffer 640x480 - root (hd0,$2) - kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=769 - initrd /boot/initrd.gz - title Devil-Linux - VESA Frame Buffer 800x600 - root (hd0,$2) - kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=771 - initrd /boot/initrd.gz - title Devil-Linux - VESA Frame Buffer 1024x768 - root (hd0,$2) - kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=773 - initrd /boot/initrd.gz - title Devil-Linux - Other - root (hd0,$2) - kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=ask - initrd /boot/initrd.gz + cat > $TMPDIR/grub.conf <<-EOF + timeout=10 + splashimage=(hd0,$2)/boot/grub/devil-linux.xpm.gz + # Devil-Linux Boot Line options: + # DL_config=/dev/discs/disc0/part1 - loads the etc.tar.bz2 form that device + # DL_config_no_scan - prevents scanning for etc.tar.bz2 + # DL_device=/dev/discs/disc0/part1 - Loads CD/ISO from that device + # DL_device_no_scan - Prevents scannign for CD/ISO + # + # Note: "/dev/hda1" type devices are not supported! Use /dev/discs/... or /dev/ide/... + # type device names. + title Devil-Linux - Standard VGA + root (hd0,$2) + kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK + initrd /boot/initrd.gz + title Devil-Linux - VESA Frame Buffer 640x480 + root (hd0,$2) + kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=769 + initrd /boot/initrd.gz + title Devil-Linux - VESA Frame Buffer 800x600 + root (hd0,$2) + kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=771 + initrd /boot/initrd.gz + title Devil-Linux - VESA Frame Buffer 1024x768 + root (hd0,$2) + kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=773 + initrd /boot/initrd.gz + title Devil-Linux - Other + root (hd0,$2) + kernel /boot/vmlinuz ro root=/dev/ram0 init=/linuxrc $RAMDISK vga=ask + initrd /boot/initrd.gz EOF + if [ -f "$TMPDIR/disk-mnt/boot/memtest" ]; then - cat >> $TMPDIR/disk-mnt/boot/grub/grub.conf <<-EOF - title Memtest86 - root (hd0,$2) - kernel /boot/memtest + cat >> $TMPDIR/grub.conf <<-EOF + title Memtest86 + root (hd0,$2) + kernel /boot/memtest EOF fi + + echo -n "Do you want to edit the grub menu file " + ask_yes_no && `screen $EDITOR $TMPDIR/grub.conf` + cp -p $TMPDIR/grub.conf $TMPDIR/disk-mnt/boot/grub/ > /dev/null || return 1 + pushd $TMPDIR/disk-mnt/boot/grub > /dev/null rm -f menu.lst ln -s grub.conf menu.lst @@ -178,11 +213,7 @@ # done echo - read -p "Enter DL ISO source (disk file (default: bootcd.iso) or CD device) -> " DLISO - - if [ -z "$DLISO" ]; then - DLISO="bootcd.iso" - fi + read -p "Enter DL ISO source (disk file or CD device) -> " DLISO if [ -L "$DLISO" ]; then DLISO=$(readlink -fns $DLISO) @@ -210,7 +241,15 @@ echo read -p "Enter DEVICE name of disk device (i.e. /dev/sda) -> " DEVICE - $FDISK -l $DEVICE + [ "$FDISK" = "cfdisk" ] && $FDISK -Ps $DEVICE + [ "$FDISK" = "fdisk" ] && $FDISK -l $DEVICE + + echo + if [ "$BOOTLOADER" = "syslinux" ]; then + echo "Please make sure the partition type is 'FAT16' (06) " + else + echo "Please make sure the partition type is 'Linux' (83) " + fi echo echo "If you wish to store the ISO and configuration on the same media, two partitions are recommended." @@ -267,14 +306,6 @@ echo echo "This will install DL on \"$DEVICE\" using the \"$BOOTLOADER\" bootloader. " - if [ "$BOOTLOADER" = "syslinux" ]; then - echo "Please make sure the partition type is 'FAT16' (06) " - echo - else - echo "Please make sure the partition type is 'Linux' (83) " - echo - fi - echo;echo -n "All data on device $PARTITION will be lost, continue ? " ask_yes_no || return 1 @@ -283,7 +314,7 @@ if [ "$BOOTLOADER" = "syslinux" ]; then - mkfs.msdos $PARTITION > /dev/null || return 1 + mkdosfs $PARTITION > /dev/null || return 1 echo "Installing syslinux MBR" SIZE=$(du -b $TMPDIR/iso-mnt/boot/syslinux/mbr.bin | cut -f 1 ) @@ -294,8 +325,9 @@ mount -t vfat $PARTITION $TMPDIR/disk-mnt || return 1 echo "copying files" - cp -p $TMPDIR/iso-mnt/boot/* $TMPDIR/disk-mnt/ > /dev/null - cp -p $TMPDIR/iso-mnt/{DEVIL-LINUX,LICENSE} $TMPDIR/disk-mnt/ > /dev/null + # Warnings about not copying subdirs cause spurious eixt here so ignore status... + cp -p $TMPDIR/iso-mnt/boot/* $TMPDIR/disk-mnt/ &> /dev/null # || return 1 + cp -p $TMPDIR/iso-mnt/{DEVIL-LINUX,LICENSE} $TMPDIR/disk-mnt/ &> /dev/null || return 1 cat $TMPDIR/iso-mnt/isolinux.cfg | sed -e s%"/boot/"%""% > $TMPDIR/disk-mnt/syslinux.cfg || return 1 cat $TMPDIR/iso-mnt/boot/message | sed -e s%"/boot/"%""% > $TMPDIR/disk-mnt/message || return 1 copy_iso_file $DLISO $TMPDIR/disk-mnt/bootcd.iso || return 1 @@ -308,14 +340,19 @@ mount -t auto $PARTITION $TMPDIR/disk-mnt || return 1 echo "copying files" - cp -a $TMPDIR/iso-mnt/boot/ $TMPDIR/disk-mnt/ > /dev/null - cp -p $TMPDIR/iso-mnt/{DEVIL-LINUX,LICENSE} $TMPDIR/disk-mnt/ > /dev/null + cp -a $TMPDIR/iso-mnt/boot/ $TMPDIR/disk-mnt/ > /dev/null || return 1 + cp -p $TMPDIR/iso-mnt/{DEVIL-LINUX,LICENSE} $TMPDIR/disk-mnt/ > /dev/null || return 1 copy_iso_file $DLISO $TMPDIR/disk-mnt/bootcd.iso || return 1 - GRUBPART=$(expr $(basename ${PARTITION} | sed -e 's/^part//' -e 's/^[hs]d[a-z]//') - 1) - - [ "$BOOTLOADER" = "grub" ] && install_grub $DEVICE $GRUBPART - [ "$BOOTLOADER" = "lilo" ] && install_lilo $DEVICE + if [ "$BOOTLOADER" = "grub" ]; then + GRUBPART=$(expr $(basename ${PARTITION} | sed -e 's/^part//' -e 's/^[hs]d[a-z]//') - 1) + install_grub $DEVICE $GRUBPART || return 1 + elif [ "$BOOTLOADER" = "lilo" ]; then + install_lilo $DEVICE || return 1 + else + echo "Unknown Bootloader: $BOOTLOADER" + return 1 + fi else echo "Unknown Bootloader: $BOOTLOADER" return 1 @@ -343,47 +380,37 @@ ### Get some user info for the install echo echo "Select which bootloader you want to use:" -echo " 1) SysLinux (default)" +echo " 1) SysLinux" echo " 2) Grub" echo " 3) Lilo" ANS="" -read -p "Choice: " -n 1 -rs ANS +read -p "Choice: " -t 60 -n 1 -rs ANS ANS=${ANS:-1} echo $ANS -### set the default -BOOTLOADER="syslinux" -#BOOTLOADER="grub" -#BOOTLOADER="lilo" - -[ ${ANS:-n} = "1" ] && BOOTLOADER="syslinux" -[ ${ANS:-n} = "2" ] && BOOTLOADER="grub" -[ ${ANS:-n} = "3" ] && BOOTLOADER="lilo" +[ $ANS = "1" ] && BOOTLOADER="syslinux" +[ $ANS = "2" ] && BOOTLOADER="grub" +[ $ANS = "3" ] && BOOTLOADER="lilo" #### Choose the format used during build for initrd.gz: echo echo "Select correct initrd.gz format used (DL default is CramFS):" -echo " 1) CramFS (default)" +echo " 1) CramFS" echo " 2) Ext2" ANS="" -read -p "Choice: " -n 1 -rs ANS +read -p "Choice: " -t 60 -n 1 -rs ANS ANS=${ANS:-1} echo $ANS -# For initrd.gz as CRAMFS -RAMDISK="ramdisk_blocksize=4096" -# For initrd.gz as EXT2 -#RAMDISK="ramdisk_blocksize=1024" - -[ ${ANS:-n} = "1" ] && RAMDISK="ramdisk_blocksize=4096"; -[ ${ANS:-n} = "2" ] && RAMDISK="ramdisk_blocksize=1024"; +[ $ANS = "1" ] && RAMDISK="ramdisk_blocksize=4096"; +[ $ANS = "2" ] && RAMDISK="ramdisk_blocksize=1024"; # Do install install_dl || echo "Install failed!" echo "syncing and unmounting (this could take a while)" sync -umount $TMPDIR/iso-mnt &> /dev/null +umount $TMPDIR/iso-mnt &> /dev/null umount $TMPDIR/disk-mnt &> /dev/null umount $TMPDIR/etc-mnt &> /dev/null |