home *** CD-ROM | disk | FTP | other *** search
/ host-198-236-40-254.wlwv.k12.or.us / host-198-236-40-254.wlwv.k12.or.us.tar / host-198-236-40-254.wlwv.k12.or.us / tsv / BareMetalInstall.iso / make_disk.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2013-12-03  |  1KB  |  49 lines

  1. #!/bin/bash
  2. # Batch file to create bootable SLAX disk
  3. # usage: make_disk.sh /dev/sda1 # (must be the partition)
  4. # WARNING! boot sector of the device will be OVERWRITTEN!
  5. # author: Tomas M. <http://www.linux-live.org>
  6.  
  7. if [ "$1" = "" ]; then
  8.   echo "usage: $0 partition_device"
  9.   echo "example: $0 /dev/sda1"
  10.   exit 1
  11. fi
  12.  
  13. PART="$1"
  14. BOOT="`echo \"$PART\" | sed -r \"s/[0-9]+\\\$//\"`"
  15.  
  16. TMPDIR=/mnt/makedisk_mount$$
  17. echo "Mounting $PART to $TMPDIR..."
  18. mkdir -p $TMPDIR
  19. mount "$PART" $TMPDIR
  20. if [ $? -ne 0 ]; then exit 1; fi
  21.  
  22. echo "Copying files..."
  23. cp -a ./* "$TMPDIR"
  24. if [ $? -ne 0 ]; then exit 1; fi
  25. sync
  26.  
  27. echo "Setting up boot sector in $BOOT..."
  28. echo "boot=$BOOT
  29. compact
  30. lba32
  31. vga=769
  32. prompt
  33. timeout=20
  34. install=text
  35.  
  36. image=$TMPDIR/boot/vmlinuz
  37. initrd=$TMPDIR/boot/initrd.gz
  38. label=slax
  39. root=/dev/ram0
  40. append=\"max_loop=255 init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=4444\"
  41. read-write
  42. " >$TMPDIR/lilo.conf
  43. lilo -C $TMPDIR/lilo.conf -m $TMPDIR/lilo.map -s $TMPDIR/origmbr 2>&1 | grep -vi warning
  44. if [ $? -ne 0 ]; then exit 1; fi
  45.  
  46. umount $TMPDIR
  47. rmdir $TMPDIR
  48. echo "Successfully installed in $1"
  49.