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