aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/update-package-md5sum
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
commit5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch)
tree1229a11f725bfa58aa7c57a76898553bb5f6654a /scripts/update-package-md5sum
downloadopenwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz
openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts/update-package-md5sum')
-rwxr-xr-xscripts/update-package-md5sum38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/update-package-md5sum b/scripts/update-package-md5sum
new file mode 100755
index 000000000..1cf17163e
--- /dev/null
+++ b/scripts/update-package-md5sum
@@ -0,0 +1,38 @@
+#!/usr/bin/env sh
+#
+# update-package-md5sum - Updates md5sum of OpenWrt packages
+#
+# update-package-md5sum will update the md5sum for all recusivly found OpenWrt packages
+# in a given directory.
+#
+# Usage: scripts/update-package-md5sum <package directory>
+#
+# Example: `scripts/update-package-md5sum feeds/packages/python`
+
+DL_FOLDER=`grep -Eo '^CONFIG_DOWNLOAD_FOLDER=".*"$' .config | \
+ sed 's,^CONFIG_DOWNLOAD_FOLDER="\(.*\)"$,\1,'`
+if test -z ${DL_FOLDER}; then
+ DL_FOLDER=./dl
+fi
+
+if test -z "$1"; then
+ echo "Usage: $0 <package directory>"
+ exit
+fi
+
+for file in `find $1 -name Makefile`; do
+ if grep BuildPackage ${file} > /dev/null; then
+ source=`DUMP=1 TOPDIR=\`pwd\` make -f ${file} | grep -m 1 Source | cut -f 2 -d ' '`
+ if test -n "${source}"; then
+ if test ! -f "${DL_FOLDER}/${source}"; then
+ make package/`basename \`dirname ${file}\``/download
+ fi
+ sum=`md5sum ${DL_FOLDER}/${source} 2> /dev/null` || continue
+ echo Updating ${file}...
+ sum=`echo ${sum} | cut -d ' ' -f 1`
+ sed -i "s,^PKG_MD5SUM:=.*,PKG_MD5SUM:=${sum}," ${file}
+ else
+ echo No source for ${file}
+ fi
+ fi
+done