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.

extractiso.sh 990 B

7 years ago
7 years ago
7 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # build the iso
  3. . config || exit 0
  4. if [ "$1" != "ok" ]; then
  5. if [ -e ${ISO} ] || [ -e ${FS} ]; then
  6. echo "remove \"${ISO}\" and \"${FS}\" dirs first,"
  7. echo "or pass \"ok\" as an argument to remove them"
  8. exit 0
  9. fi
  10. fi
  11. set -x
  12. set -e
  13. # download it if it doesn't exist
  14. if ! [ -e ${ORIG} ] ; then
  15. mkdir -p $(dirname ${ORIG})
  16. if [ -e $(dirname ${ORIG})/../$(basename ${ORIG}) ] ; then
  17. # grab from parent directory
  18. cp $(dirname ${ORIG})/../$(basename ${ORIG}) ${ORIG}
  19. else
  20. # grab from web
  21. wget -O "${ORIG}" "${ORIGURL}"
  22. fi
  23. fi
  24. # mount it
  25. sudo umount ${MNT} || true
  26. sudo rm -rf ${MNT} ${ISO} ${FS}
  27. sudo mkdir ${MNT}
  28. sudo mount -o loop,ro "$ORIG" ${MNT}
  29. # copy data
  30. sudo mkdir ${ISO}
  31. sudo rsync --exclude=/casper/filesystem.squashfs -a ${MNT}/ ${ISO}
  32. sudo chown -R ${NONPRIV_UID} ${ISO}
  33. chmod -R u+w ${ISO}
  34. # copy squashfs
  35. sudo unsquashfs -d ${FS} ${MNT}/casper/filesystem.squashfs
  36. sudo umount ${MNT}