Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

extract-osx-sdk.sh 1016B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. set -e
  3. INPUTFILE="Xcode_7.3.1.dmg"
  4. HFSFILENAME="5.hfs"
  5. SDKDIR="Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"
  6. 7z x "${INPUTFILE}" "${HFSFILENAME}"
  7. SDKNAME="$(basename "${SDKDIR}")"
  8. SDKDIRINODE=$(ifind -n "${SDKDIR}" "${HFSFILENAME}")
  9. fls "${HFSFILENAME}" -rpF ${SDKDIRINODE} |
  10. while read type inode filename; do
  11. inode="${inode::-1}"
  12. if [ "${filename:0:14}" = "usr/share/man/" ]; then
  13. continue
  14. fi
  15. filename="${SDKNAME}/$filename"
  16. echo "Extracting $filename ..."
  17. mkdir -p "$(dirname "$filename")"
  18. if [ "$type" = "l/l" ]; then
  19. ln -s "$(icat "${HFSFILENAME}" $inode)" "$filename"
  20. else
  21. icat "${HFSFILENAME}" $inode >"$filename"
  22. fi
  23. done
  24. echo "Building ${SDKNAME}.tar.gz ..."
  25. MTIME="$(istat "${HFSFILENAME}" "${SDKDIRINODE}" | perl -nle 'm/Content Modified:\s+(.*?)\s\(/ && print $1')"
  26. find "${SDKNAME}" | sort | tar --no-recursion --mtime="${MTIME}" --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > "${SDKNAME}.tar.gz"
  27. echo 'All done!'