tatlow
Unregistered
|
|
Posted: Nov. 23 2005,16:26 |
|
Couldn't get X to work w/ hacking around so I did an install again and realized how much a pain it is.
So I followed the steps manually 1st the lilo install upuntil the lilo part and then the grub piece.
I patched the two together into a script but I'm not sure how to upload / share it w/ you guys.
I'll cut and paste it and maybe it will help. I ran through it to get the syntax straight but didn't do an install w/ it so be cautious but thought it might help.
Anyway the good news is I seem to be up and running now, the way I want to be... mostly atleast. Now it's custimazation time.
Code Sample | #!/bin/bash # Based on the work of Terry Gray University of Washington # Then a version by Robert Shingledecker # This version by Tatlow
. /etc/init.d/dsl-functions
if [ $UID != 0 ]; then echo "Got root?" echo -n "Press Enter key. "; read gagme exit 1 fi if [ -f /etc/sysconfig/toram ]; then echo "${RED}You are running 'toram' mode, not a liveCD!${NORMAL}" echo "${RED}You should not continue (i think)${NORMAL}" echo -n "Press any key to continue Contrl-C to quit. "; read gagme fi
echo "${RED}DSL ${WHITE}Compressed Image ${BLUE}Install/Upgrade.${NORMAL}" echo "${YELLOW}No responsibility for data loss or hardware damage!${NORMAL}" echo " " echo "A linux partition large enough to hold the image file" echo "must be created prior to installation." echo "This script is currently only for install from a LiveCD" echo "it follows the 'lilo' process but uses 'grub' for the boot loader" echo "also sometimes you may want to reboot after an fdisk and a partition format..."
echo -n "${CYAN}Enter the target partition to hold boot image ${WHITE}(EXAMPLE: ${YELLOW}hda1): ${NORMAL}" read BOOT_TARGET if [ -z "$BOOT_TARGET" ]; then echo "No partition chosen. The script will be terminated." echo -n "Press any key. "; read gagme exit 1 else DISK="$(echo $BOOT_TARGET | tr -d [0-9])" if [ "$DISK" != "hda" ]; then echo "${RED}The script is only known to work hda.${NORMAL}" echo "${RED}You continue @ your own risk${NORMAL}" echo "${RED}THERE WILL BE NO MORE WARNINGS${NORMAL}" echo -n "Press any key to continue Contrl-C to quit. "; read gagme fi FDISK="$(sfdisk -l /dev/$DISK|grep $BOOT_TARGET|awk '{print $(NF-1)}'|head -n1)" if [ "$FDISK" != "83" ]; then echo "${RED}Sorry system has not detected a linux partition.${NORMAL}" echo "You may need to just reboot, so the system can re-read" echo "the partition table, or create your partition(s) with ${YELLOW}cfisk" echo "${NORMAL}and then reboot." echo "Script is terminating..." echo -n "Press any key. "; read gagme exit 1 fi fi
echo "${CYAN}Enter the target partition to hold /home ${WHITE}(EXAMPLE: ${YELLOW}hda3): ${NORMAL}" echo -n "${CYAN}Hit enter w/ this blank if you don't want a separate home dir: ${NORMAL}" read HOME_TARGET
echo "${CYAN}Enter the target partition to hold /opt ${WHITE}(EXAMPLE: ${YELLOW}hda3): ${NORMAL}" echo -n "${CYAN}Hit enter w/ this blank if you don't want a separate home dir: ${NORMAL}" read OPT_TARGET
if [ ! -e /mnt/$BOOT_TARGET ]; then mkdir /mnt/$BOOT_TARGET fi if [ ! -e /mnt/$HOME_TARGET ]; then mkdir /mnt/$HOME_TARGET fi if [ ! -e /mnt/$OPT_TARGET ]; then mkdir /mnt/$OPT_TARGET fi
SOURCE="/cdrom" IMAGE="/cdrom" BOOT="/cdrom/boot/isolinux"
echo echo "${CYAN}Are there any other boot options do you want?" echo "${CYAN}Be aware if you try to use Lilo w/ long boot parms (which is" echo "${CYAN}almost any options, they will be truncated... that's why this uses grub" echo "${CYAN}If you entered data for /home or /opt above they will be included"
echo -n "${WHITE}Example: ${YELLOW}toram ssh lpd monkey ftp${NORMAL}: " read BOOT_OPS
echo echo "${CYAN}Choose language/keyboard if other than english, " echo -n "${WHITE}Example: ${YELLOW}cs da de es fr nl it pl ru sk${NORMAL}: " read LANG if [ ! -z "$LANG" ]; then LANG="lang=$LANG" fi
RESTORE=""; XVESA=""; MYDSL="" echo echo -n "${CYAN}Do you wish to specify a restore partition${NORMAL} (y/..)? " read answer if [ "$answer" == "y" ]; then echo -n "${CYAN}Enter the partition to be used for backup/restore.${WHITE}(EXAMPLE: ${YELLOW}hda3): ${NORMAL}" read DATA if [ -z "$DATA" ]; then echo "No partition chosen. The automatic USB/Floppy will be used." RESTORE="restore" else RESTORE="restore=$DATA" fi fi
echo echo echo "${CYAN}FYI I didn't use this next Q in my install as the logic path was burried" echo "${CYAN}However your mileage may vary so it's here" echo -n "${CYAN}Use default Xvesa settings, ${YELLOW}Xvesa${NORMAL} (y/..)? " read answer if [ "$answer" == "y" ]; then XVESA="xvesa" fi
#Tatlow: changed the wording here since it seemed to imply that you could say 'n' and the restore partition would be # used, which was untrue it would have been the boot partition echo echo "${CYAN}By default the boot partition is used for myDSL" echo -n "${CYAN}Do you wish to specify a different partition for myDSL${NORMAL} (y/..)? " read answer if [ "$answer" == "y" ]; then echo -n "${CYAN}Enter the partition to be used for myDSL applications.${WHITE}(EXAMPLE: ${YELLOW}hda3): ${NORMAL}" read DATA if [ -z "$DATA" ]; then echo "No partition chosen. The automatic /cdrom will be used." else MYDSL="mydsl=$DATA" fi fi
echo "${YELLOW}NOW THE TOUGH QUESTIONS:" echo "${YELLOW} Do you want to format the partitions?" echo "${YELLOW} The original script said to INSTALL answer y to format, for UPGRADE answer n.${NORMAL} " echo "${YELLOW} This script should let you keep going w/ or w/o a format.${NORMAL} " echo "${YELLOW} I'm going to format as ext3, but grub will load as ext2 (home and opt will be ext3${NORMAL} " echo "${YELLOW} PAY ATTENTION: I may repeat myself!!!!!!!!${NORMAL} " echo
if [ ! -z "$BOOT_TARGET" ]; then echo -n "${RED}Format the target partition ${MAGENTA}/dev/$BOOT_TARGET${NORMAL} (y/..)? " read answer if [ "$answer" == "y" ]; then echo echo "${RED}Last change to exit before destroying all data!!!!${NORMAL}" echo -n "${CYAN}Continue (y/..)?${NORMAL} " read answer if [ "$answer" != "y" ]; then echo "skipping...." else echo "${BLUE}Formatting .... ${NORMAL}" mke2fs -j /dev/$BOOT_TARGET fi fi fi
if [ ! -z "$HOME_TARGET" ]; then echo -n "${RED}Format the target partition ${MAGENTA}/dev/$HOME_TARGET${NORMAL} (y/..)? " read answer if [ "$answer" == "y" ]; then echo echo "${RED}Last change to exit before destroying all data!!!!${NORMAL}" echo -n "${CYAN}Continue (y/..)?${NORMAL} " read answer if [ "$answer" != "y" ]; then echo "skipping...." else echo "${BLUE}Formatting .... ${NORMAL}" mke2fs -j /dev/$HOME_TARGET fi fi fi
if [ ! -z "$OPT_TARGET" ]; then echo -n "${RED}Format the target partition ${MAGENTA}/dev/$OPT_TARGET${NORMAL} (y/..)? " read answer if [ "$answer" == "y" ]; then echo echo "${RED}Last change to exit before destroying all data!!!!${NORMAL}" echo -n "${CYAN}Continue (y/..)?${NORMAL} " read answer if [ "$answer" != "y" ]; then echo "skipping...." else echo "${BLUE}Formatting .... ${NORMAL}" mke2fs -j /dev/$OPT_TARGET fi fi fi mount /mnt/$BOOT_TARGET # Mount the new target drive
echo "${CYAN}Next I will begin copying the system boot files" echo -n "${CYAN}Do you want me to continue?${NORMAL} (y/..)? " read answer if [ "$answer" != "y" ]; then exit; fi
echo "${BLUE}Setting up system image on ${MAGENTA}/mnt/$BOOT_TARGET${NORMAL}"
if [ ! -d /mnt/$BOOT_TARGET/KNOPPIX ]; then mkdir /mnt/$BOOT_TARGET/KNOPPIX fi cp -f $IMAGE/KNOPPIX/KNOPPIX /mnt/$BOOT_TARGET/KNOPPIX/KNOPPIX
mkdir /mnt/$BOOT_TARGET/boot cp -f $BOOT/linux24 /mnt/$BOOT_TARGET/boot/. cp -f $BOOT/minirt24.gz /mnt/$BOOT_TARGET/boot/.
sync;sync
#Tatlow: This completes the 'setup' of the system minus the bootloader #maybe we want to copy some of the ramdisk to /opt and ~dsl but I didn't #and when I restarted files were there so mileage may vary
echo "${BLUE}Setting up grub${NORMAL}" mkdir /mnt/$BOOT_TARGET/boot/grub cp /boot/grub/device.map /mnt/$BOOT_TARGET/boot/grub/. sed 's/hda2/'$BOOT_TARGET'/' /boot/grub/menu.lst > /mnt/$BOOT_TARGET/boot/grub/menu.lst grub-install /dev/$DISK --root-directory=/mnt/$BOOT_TARGET
echo -n "${CYAN}If you have Windows installed you probably shouldn't have used this script${NORMAL}" echo -n "${CYAN}However, edit /mnt/$BOOT_TARGET/boot/grub/menu.lst and enable the last lines.${NORMAL}"
FULL_PARMS="" if [ ! -z "$OPT_TARGET" ]; then FULL_PARMS="opt=$OPT_TARGET" fi if [ ! -z "$HOME_TARGET" ]; then FULL_PARMS=" home=$HOME_TARGET" fi if [ ! -z "$RESTORE" ]; then FULL_PARMS=" $RESTORE" fi if [ ! -z "$MYDSL" ]; then FULL_PARMS=" $MYDSL" fi if [ ! -z "$XVESA" ]; then FULL_PARMS=" $XVESA" fi if [ ! -z "$LANG" ]; then FULL_PARMS=" $LANG" fi if [ ! -z "$BOOT_OPS" ]; then FULL_PARMS=" $BOOT_OPS" fi
echo "${GREEN}Grub Installation almost completed.${NORMAL}" echo "${GREEN}From here on out it's manual.${NORMAL}" echo "${GREEN}All you need to do is go edit /mnt/$BOOT_TARGET/boot/grub/menu.lst${NORMAL}" echo "${GREEN}and add the following kernel parms after the kernel line" echo echo "${GREEN} $FULL_PARMS"
sync
umount /mnt/$BOOT_TARGET umount /mnt/$OPT_TARGET umount /mnt/$HOME_TARGET
echo "${GREEN}Grub Installation Complete, after script exits you should reboot.${NORMAL}" echo -n "Press Enter key. "; read gagme exit 0
#CMDLINE="$(cat /proc/cmdline)" #POSITION=$(awk '{print index($0, "vga")}' /proc/cmdline) #if [ "$POSITION" == 0 ]; then # VGA=791 #else # RESULT=$(awk '{print substr($0,index($0, "vga")+3)}' /proc/cmdline) # VGA=$(getparam 'vga' "$RESULT") # if [ -z "$VGA" ]; then # VGA="$(getbootparam 'vga' 2>/dev/null)" # if [ -z "$VGA" ]; then # VGA=791 # fi # fi #fi
#echo "${BLUE}Setting up lilo${NORMAL}" #cat <<EOF >/mnt/$TARGET/boot/lilo.conf #lba32 #enable large disk support #timeout=30 #wait 3 seconds before auto-booting #vga=$VGA #boot=/dev/$DISK #put boot loader in MBR of target disk #root=/dev/$TARGET #set root to be partition of target disk #image=/boot/linux24 #label=DSL #initrd=/boot/minirt24.gz #read-only #APPEND="ramdisk_size=100000 init=/etc/init lang=us apm=power-off hda=scsi hdb=scsi hdc=scsi hdd=scsi hde=scsi hdf=scsi hdg=scsi hdh=scsi nomce nodma quiet frugal BOOT_IMAGE=/KNOPPIX/KNOPPIX $RESTORE $DAEMONS $LANG $XVESA $MYDSL" #EOF # #chmod 644 /mnt/$TARGET/boot/lilo.conf # #ln -sf /mnt/$TARGET/boot / # #lilo -C /mnt/$TARGET/boot/lilo.conf # #echo "${GREEN}Standby for reboot...${NORMAL}" #reboot |
Edited by SaidinUnleashed (Code tags are your friends. Use them~)
|