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.

87 lines
2.2 KiB

  1. #!/bin/bash
  2. type_plain="plain"
  3. usage_plain(){
  4. cat >&2 <<EOF
  5. Usage: ${0} -type plain
  6. This will save the files in plain view on the medium.
  7. This way you can view the content on any OS without the
  8. need to boot the LVP. Of course, you can still do so :)
  9. EOF
  10. }
  11. lvp_copy(){
  12. src="${1}" ; trg="${2}"
  13. echo -n "Trying to hardlink ${src} ... "
  14. if ln "${src}" "${trg}" 2>/dev/null ; then
  15. echo "ok"
  16. else
  17. echo "failed"
  18. echo -n "Copying ${src} to ${trg} ... "
  19. if cp "${src}" "${trg}" ; then
  20. echo "ok"
  21. else
  22. echo "failed"
  23. fi
  24. fi
  25. }
  26. process_plain(){
  27. target="livesystem"
  28. echo -n "Checking necessary filesystem size ... "
  29. filesize=0
  30. while read file ; do
  31. [ ! -f "${file}" ] && continue
  32. thisfilesize=`ls -l "${file}" | sed 's,[ \t][ \t]*, ,g' | cut -f5 -d' '`
  33. filesize=$(( ${filesize} + ${thisfilesize} ))
  34. done < ${moviefiles}
  35. echo "${filesize} Byte (`human_readable ${size}`)"
  36. echo -n "Checking Livesystem size ... "
  37. livesize=`du -sb ${target} | cut -f1`
  38. livesize=$(( ${livesize} + `du -sb isolinux | cut -f1` ))
  39. echo "`human_readable ${livesize}`"
  40. filesize=$(( ${filesize} + ${livesize} ))
  41. echo
  42. echo "Total space needed: $(( ${filesize} / 1024 / 1024 )) MB"
  43. if [ $(( ${filesize} / 1024 / 1024 )) -gt ${size} ] ; then
  44. echo
  45. echo "This may be more than fits onto your medium."
  46. echo "You specified ${size} MB to fit onto your medium."
  47. echo "If you are sure that this is okay, please continue."
  48. echo "If not, please truncate your filelist."
  49. confirm "Continue"
  50. [ ${?} -eq 1 ] && exit 1
  51. fi
  52. while read file ; do
  53. [ ! -f "${file}" ] && continue
  54. if [ -f "${target}/${file##*/}" ] ; then
  55. origfilesize=`ls -l "${file}" | sed 's,[ \t][ \t]*, ,g' | cut -f5 -d' '`
  56. targfilesize=`ls -l "${target}/${file##*/}" | sed 's,[ \t][ \t]*, ,g' | cut -f5 -d' '`
  57. if [ ${origfilesize} -eq ${targfilesize} ] ; then
  58. echo "${target}/${file##*/} already exists."
  59. else
  60. rm -f "${target}/${file##*/}"
  61. lvp_copy "${file}" "${target}/${file##*/}"
  62. fi
  63. else
  64. rm -f "${target}/${file##*/}"
  65. lvp_copy "${file}" "${target}/${file##*/}"
  66. fi
  67. environment="`echo ${file} | tr '[. \-!]' '_'`"
  68. eval "export file_${environment##*/}=\"/${file##*/}\""
  69. done < ${moviefiles}
  70. lvpxml=${target}/lvp.xml
  71. process_create_lvpxml
  72. }