OpenSDE Packages Database (without history before r20070)
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.

106 lines
2.6 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../lilo/boot/makeimages.sh
  6. # Copyright (C) 2008 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. #
  9. # More information can be found in the files COPYING and README.
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. if [ "$1" = -reroot ] ; then
  17. echo "Old PATH: $PATH"
  18. PATH="../../sbin:../../bin:../../../sbin:../usr/bin:$PATH"
  19. echo "New PATH: $PATH"
  20. echo "Old LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
  21. export LD_LIBRARY_PATH="../../lib:../../usr/lib:$LD_LIBRARY_PATH"
  22. LD_LIBRARY_PATH=${LD_LIBRARY_PATH%:}
  23. echo "New LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
  24. shift
  25. fi
  26. if [ "$1" = -combo ] ; then
  27. combo=1
  28. elif [ "$#" != 0 ] ; then
  29. echo "usage: $0 [-reroot] [-combo]"
  30. exit 1
  31. fi
  32. tmpfile=`mktemp -p $PWD`
  33. tmpdir=$tmpfile.dir
  34. mkdir $tmpdir || exit 1
  35. rc=0
  36. tmpdev=
  37. for x in /dev/loop/* ; do
  38. if losetup $x $tmpfile 2> /dev/null ; then
  39. tmpdev=$x ; break
  40. fi
  41. done
  42. if [ -z "$tmpdev" ] ; then
  43. echo "No free loopback device found!"
  44. rm -f $tmpfile ; rmdir $tmpdir
  45. exit 1
  46. fi
  47. echo "Using $tmpdev."
  48. for image in initrd boot_144 boot_288
  49. do
  50. case ${image} in
  51. initrd)
  52. echo "Creating ${image}.gz ..."
  53. size=4096 ;;
  54. boot_144)
  55. echo "Creating ${image}.img ..."
  56. size=1440 ;;
  57. boot_288)
  58. echo "Creating ${image}.img ..."
  59. size=2880 ;;
  60. esac
  61. dd if=/dev/zero of=$tmpfile bs=1024 count=$size &> /dev/null
  62. losetup -d $tmpdev ; losetup $tmpdev $tmpfile || rc=1
  63. mke2fs -q $tmpdev &> /dev/null ; mount $tmpdev $tmpdir || rc=1
  64. case ${image} in
  65. initrd)
  66. cp -a initrd/* $tmpdir || rc=1
  67. ;;
  68. boot_144|boot_288)
  69. cp -a boot/{vmlinuz,lilo-help.txt} $tmpdir || rc=1
  70. if [ -f /boot/boot-text.b ]; then
  71. cp /boot/boot-text.b $tmpdir/boot.b || rc=1
  72. fi
  73. liloconf=lilo-conf-${image#boot_}
  74. if [ $image = boot_288 -o "$combo" = 1 ] ; then
  75. cp initrd.gz $tmpdir || rc=1
  76. [ $image = boot_144 ] && liloconf=lilo-conf-1x2
  77. fi
  78. sed -e "s,/mnt/,$tmpdir/,g" \
  79. -e "s,/dev/floppy/0,$tmpdev,;" \
  80. < boot/$liloconf > $tmpdir/lilo.conf || rc=1
  81. lilo -C $tmpdir/lilo.conf > /dev/null || rc=1
  82. ;;
  83. esac
  84. umount $tmpdir
  85. case ${image} in
  86. initrd) gzip -9 < $tmpfile > $image.gz || rc=1 ;;
  87. *) cp $tmpfile $image.img || rc=1 ;;
  88. esac
  89. done
  90. losetup -d $tmpdev
  91. rm -f $tmpfile
  92. rmdir $tmpdir
  93. exit $rc