manifest.sh 638 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. if [ "$1" = "" ]; then
  3. echo "usage: $0 [build dir]"
  4. exit 0
  5. fi
  6. function getManifestEntry
  7. {
  8. size=`du -b $1 | cut -f1`
  9. sha256sum=`sha256sum -b $1 | cut -f1 -d\ `
  10. echo $sha256sum $size `echo $1 | sed 's,\.\/,,'`
  11. }
  12. # can't execute the above function via xargs unless it is exported
  13. export -f getManifestEntry
  14. echo "Generating manifest..."
  15. cd $1
  16. rm -f manifest.txt
  17. find -mindepth 1 -type f \
  18. -not -name config.txt \
  19. -not -name manifest.txt \
  20. -not -name pad.config \
  21. -not -name '*.debug' \
  22. -print0 \
  23. | xargs -0 -n1 -I{} -P24 bash -c 'getManifestEntry {}' \
  24. | sort --key=3 \
  25. >> manifest.txt