update-package-md5sum 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env sh
  2. #
  3. # update-package-md5sum - Updates md5sum of libreCMC packages
  4. #
  5. # update-package-md5sum will update the md5sum for all recusivly found libreCMC packages
  6. # in a given directory.
  7. #
  8. # Usage: scripts/update-package-md5sum <package directory>
  9. #
  10. # Example: `scripts/update-package-md5sum feeds/packages/python`
  11. DL_FOLDER=`grep -Eo '^CONFIG_DOWNLOAD_FOLDER=".*"$' .config | \
  12. sed 's,^CONFIG_DOWNLOAD_FOLDER="\(.*\)"$,\1,'`
  13. if test -z ${DL_FOLDER}; then
  14. DL_FOLDER=./dl
  15. fi
  16. if test -z "$1"; then
  17. echo "Usage: $0 <package directory>"
  18. exit
  19. fi
  20. for file in `find $1 -name Makefile`; do
  21. if grep BuildPackage ${file} > /dev/null; then
  22. source=`DUMP=1 TOPDIR=\`pwd\` make -f ${file} | grep -m 1 Source | cut -f 2 -d ' '`
  23. if test -n "${source}"; then
  24. if test ! -f "${DL_FOLDER}/${source}"; then
  25. make package/`basename \`dirname ${file}\``/download
  26. fi
  27. sum=`md5sum ${DL_FOLDER}/${source} 2> /dev/null` || continue
  28. echo Updating ${file}...
  29. sum=`echo ${sum} | cut -d ' ' -f 1`
  30. sed -i "s,^PKG_MD5SUM:=.*,PKG_MD5SUM:=${sum}," ${file}
  31. else
  32. echo No source for ${file}
  33. fi
  34. fi
  35. done