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.

108 lines
3.1 KiB

  1. #!/bin/bash
  2. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  3. #
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. # Please add additional copyright information _after_ the line containing
  6. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  7. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  8. #
  9. # ROCK Linux: rock-src/target/lvp/x86/release_skeleton/scripts/plain
  10. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License, or
  15. # (at your option) any later version. A copy of the GNU General Public
  16. # License can be found at Documentation/COPYING.
  17. #
  18. # Many people helped and are helping developing ROCK Linux. Please
  19. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  20. # file for details.
  21. #
  22. # --- ROCK-COPYRIGHT-NOTE-END ---
  23. type_plain="plain"
  24. usage_plain(){
  25. cat >&2 <<EOF
  26. Usage: ${0} -type plain
  27. This will save the files in plain view on the medium.
  28. This way you can view the content on any OS without the
  29. need to boot the LVP. Of course, you can still do so :)
  30. EOF
  31. }
  32. lvp_copy(){
  33. src="${1}" ; trg="${2}"
  34. echo -n "Trying to hardlink ${src} ... "
  35. if ln "${src}" "${trg}" 2>/dev/null ; then
  36. echo "ok"
  37. else
  38. echo "failed"
  39. echo -n "Copying ${src} to ${trg} ... "
  40. if cp "${src}" "${trg}" ; then
  41. echo "ok"
  42. else
  43. echo "failed"
  44. fi
  45. fi
  46. }
  47. process_plain(){
  48. target="livesystem"
  49. echo -n "Checking necessary filesystem size ... "
  50. filesize=0
  51. while read file ; do
  52. [ -f "${file}" ] || continue
  53. thisfilesize=`stat -c %s "${file}"`
  54. filesize=$(( ${filesize} + ${thisfilesize} ))
  55. done < ${moviefiles}
  56. echo "${filesize} Byte (`human_readable ${size}`)"
  57. echo -n "Checking Livesystem size ... "
  58. livesize=`du -sb ${target} | cut -f1`
  59. livesize=$(( ${livesize} + `du -sb isolinux | cut -f1` ))
  60. echo "`human_readable ${livesize}`"
  61. filesize=$(( ${filesize} + ${livesize} ))
  62. echo
  63. echo "Total space needed: $(( ${filesize} / 1024 / 1024 )) MB"
  64. if [ $(( ${filesize} / 1024 / 1024 )) -gt ${size} ] ; then
  65. echo
  66. echo "This may be more than fits onto your medium."
  67. echo "You specified ${size} MB to fit onto your medium."
  68. echo "If you are sure that this is okay, please continue."
  69. echo "If not, please truncate your filelist."
  70. confirm "Continue"
  71. [ ${?} -eq 1 ] && exit 1
  72. fi
  73. while read file ; do
  74. [ -f "${file}" ] || continue
  75. if [ -f "${target}/${file##*/}" ] ; then
  76. origfilesize=`stat -c %s "${file}"`
  77. targfilesize=`stat -c %s "${target}/${file##*/}"`
  78. if [ ${origfilesize} -eq ${targfilesize} ] ; then
  79. echo "${target}/${file##*/} already exists."
  80. else
  81. rm -f "${target}/${file##*/}"
  82. lvp_copy "${file}" "${target}/${file##*/}"
  83. fi
  84. else
  85. rm -f "${target}/${file##*/}"
  86. lvp_copy "${file}" "${target}/${file##*/}"
  87. fi
  88. environment="`echo ${file} | tr '[. \-!]' '_'`"
  89. eval "export file_${environment##*/}=\"/${file##*/}\""
  90. done < ${moviefiles}
  91. lvpxml=${target}/lvp.xml
  92. process_create_lvpxml
  93. }