mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.0 KiB

  1. #!/bin/sh
  2. if [ "$1" = -reroot ] ; then
  3. echo "Old PATH: $PATH"
  4. PATH="../../sbin:../../bin:../../../sbin:../usr/bin:$PATH"
  5. echo "New PATH: $PATH"
  6. echo "Old LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
  7. export LD_LIBRARY_PATH="../../lib:../../usr/lib:$LD_LIBRARY_PATH"
  8. LD_LIBRARY_PATH=${LD_LIBRARY_PATH%:}
  9. echo "New LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
  10. shift
  11. fi
  12. if [ "$1" = -combo ] ; then
  13. combo=1
  14. elif [ "$#" != 0 ] ; then
  15. echo "usage: $0 [-reroot] [-combo]"
  16. exit 1
  17. fi
  18. tmpfile=`mktemp -p $PWD`
  19. tmpdir=$tmpfile.dir
  20. mkdir $tmpdir || exit 1
  21. rc=0
  22. tmpdev=""
  23. for x in /dev/loop/* ; do
  24. if losetup $x $tmpfile 2> /dev/null ; then
  25. tmpdev=$x ; break
  26. fi
  27. done
  28. if [ -z "$tmpdev" ] ; then
  29. echo "No free loopback device found!"
  30. rm -f $tmpfile ; rmdir $tmpdir
  31. exit 1
  32. fi
  33. echo "Using $tmpdev."
  34. for image in initrd boot_144 boot_288
  35. do
  36. case ${image} in
  37. initrd)
  38. echo "Creating ${image}.gz ..."
  39. size=4096 ;;
  40. boot_144)
  41. echo "Creating ${image}.img ..."
  42. size=1440 ;;
  43. boot_288)
  44. echo "Creating ${image}.img ..."
  45. size=2880 ;;
  46. esac
  47. dd if=/dev/zero of=$tmpfile bs=1024 count=$size &> /dev/null
  48. losetup -d $tmpdev ; losetup $tmpdev $tmpfile || rc=1
  49. mke2fs -q $tmpdev &> /dev/null ; mount $tmpdev $tmpdir || rc=1
  50. case ${image} in
  51. initrd)
  52. cp -a initrd/* $tmpdir || rc=1
  53. ;;
  54. boot_144|boot_288)
  55. cp -a boot/{vmlinuz,lilo-help.txt} $tmpdir || rc=1
  56. if [ -f /boot/boot-text.b ]; then
  57. cp /boot/boot-text.b $tmpdir/boot.b || rc=1
  58. fi
  59. liloconf=lilo-conf-${image#boot_}
  60. if [ $image = boot_288 -o "$combo" = 1 ] ; then
  61. cp initrd.gz $tmpdir || rc=1
  62. [ $image = boot_144 ] && liloconf=lilo-conf-1x2
  63. fi
  64. sed -e "s,/mnt/,$tmpdir/,g" \
  65. -e "s,/dev/floppy/0,$tmpdev,;" \
  66. < boot/$liloconf > $tmpdir/lilo.conf || rc=1
  67. lilo -C $tmpdir/lilo.conf > /dev/null || rc=1
  68. ;;
  69. esac
  70. umount $tmpdir
  71. case ${image} in
  72. initrd) gzip -9 < $tmpfile > $image.gz || rc=1 ;;
  73. *) cp $tmpfile $image.img || rc=1 ;;
  74. esac
  75. done
  76. losetup -d $tmpdev
  77. rm -f $tmpfile
  78. rmdir $tmpdir
  79. exit $rc