farry

makegrubcd

Sep 25th, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. #! /bin/bash
  2. ## Make grub-1 rescue CD  -- run as user
  3.  
  4. read -p "Press enter -- to copy files from grub directory"
  5. cd $TMP
  6. rm -rf grub-iso/*
  7. mkdir -p grub-iso/boot/grub
  8. cd grub-iso/boot/grub
  9. cp  /boot/grub/* .
  10.  
  11. read -p "Press enter -- to remove timeout line"
  12. mv menu.lst menu.lst.bak
  13. sed "/^[ \t]*timeout/d" menu.lst.bak >menu.lst
  14.  
  15. read -p 'Press enter -- to search for "stage2_eltorito"'
  16. s2e=$(locate */stage2_eltorito | head -n1)
  17. if [[ -n "$s2e" ]]; then
  18.   cp "$s2e" .
  19. else
  20.   echo can not find stage2_eltorito
  21.   exit
  22. fi
  23.  
  24. # Make ISO9660 image file
  25. # -R rock ridge,
  26. # -no-emul-boot - sys should NOT try to emulate floppy boot
  27. # -boot-info-table - put in file list - *warning* mods source boot image
  28. read -p 'Press enter -- to create the CD image file'
  29. cd $TMP
  30. mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-info-table \
  31.         -boot-load-size 4  -o grub-iso/cd.iso grub-iso
  32.  
  33. read -p "Press enter -- to burn CD"
  34. # v-verbose, speed=4  takes about 1 min
  35. # blank=fast - erase before write  -- can fail if blank -- fix?
  36. sudo umount /dev/sr0
  37. cdrecord -v dev=/dev/sr0 speed=4 blank=fast -data grub-iso/cd.iso
Advertisement
Add Comment
Please, Sign In to add comment