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.

86 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. echo "`human_readable ${livesize}`"
  39. filesize=$(( $filesize + $livesize ))
  40. echo
  41. echo "Total space needed: $(( ${filesize} / 1024 / 1024 )) MB"
  42. if [ $(( ${filesize} / 1024 / 1024 )) -gt $size ] ; then
  43. echo
  44. echo "This may be more than fits onto your medium."
  45. echo "You specified ${size} MB to fit onto your medium."
  46. echo "If you are sure that this is okay, please continue."
  47. echo "If not, please truncate your filelist."
  48. confirm "Continue"
  49. [ ${?} -eq 1 ] && exit 1
  50. fi
  51. while read file ; do
  52. [ ! -f "${file}" ] && continue
  53. if [ -f "${target}/${file##*/}" ] ; then
  54. origfilesize=`ls -l "${file}" | sed 's,[ \t][ \t]*, ,g' | cut -f5 -d' '`
  55. targfilesize=`ls -l "${target}/${file##*/}" | sed 's,[ \t][ \t]*, ,g' | cut -f5 -d' '`
  56. if [ ${origfilesize} -eq ${targfilesize} ] ; then
  57. echo "${target}/${file##*/} already exists."
  58. else
  59. rm -f "${target}/${file##*/}"
  60. lvp_copy "${file}" "${target}/${file##*/}"
  61. fi
  62. else
  63. rm -f "${target}/${file##*/}"
  64. lvp_copy "${file}" "${target}/${file##*/}"
  65. fi
  66. environment="`echo ${file} | tr '[. \-!]' '_'`"
  67. eval "export file_${environment##*/}=\"/${file##*/}\""
  68. done < ${moviefiles}
  69. lvpxml=livesystem/lvp.xml
  70. process_create_lvpxml
  71. }