#!/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
r</option>
<option value='lede-17.01'>lede-17.01</option>
<option value='less-old-master'>less-old-master</option>
<option value='master'>master</option>
<option value='old-master'>old-master</option>
<option value='openwrt-18.06'>openwrt-18.06</option>
<option value='openwrt-19.07'>openwrt-19.07</option>
<option value='upstream'>upstream</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>upstream openwrt</td><td class='sub right'>James</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/openwrt/upstream/about/?h=v22.03.1'>about</a><a href='/cgit.cgi/openwrt/upstream/?h=v22.03.1'>summary</a><a href='/cgit.cgi/openwrt/upstream/refs/?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>refs</a><a href='/cgit.cgi/openwrt/upstream/log/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1'>log</a><a class='active' href='/cgit.cgi/openwrt/upstream/tree/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>tree</a><a href='/cgit.cgi/openwrt/upstream/commit/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>commit</a><a href='/cgit.cgi/openwrt/upstream/diff/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>diff</a><a href='/cgit.cgi/openwrt/upstream/stats/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/openwrt/upstream/log/target/linux/omap35xx/base-files/etc/inittab'>
<input type='hidden' name='h' value='v22.03.1'/><input type='hidden' name='id' value='8431a6aa5e8971e93a57923f9804fa9785742643'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/openwrt/upstream/tree/?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>root</a>/<a href='/cgit.cgi/openwrt/upstream/tree/target?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>target</a>/<a href='/cgit.cgi/openwrt/upstream/tree/target/linux?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>linux</a>/<a href='/cgit.cgi/openwrt/upstream/tree/target/linux/omap35xx?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>omap35xx</a>/<a href='/cgit.cgi/openwrt/upstream/tree/target/linux/omap35xx/base-files?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>base-files</a>/<a href='/cgit.cgi/openwrt/upstream/tree/target/linux/omap35xx/base-files/etc?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>etc</a>/<a href='/cgit.cgi/openwrt/upstream/tree/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>inittab</a></div><div class='content'>blob: 89626ecdad8e15b4716f398d361e126b341116d3 (<a href='/cgit.cgi/openwrt/upstream/plain/target/linux/omap35xx/base-files/etc/inittab?h=v22.03.1&amp;id=8431a6aa5e8971e93a57923f9804fa9785742643'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
</pre></td>
<td class='lines'><pre><code></code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2025-02-19 12:53:40 +0000</div>
</div> <!-- id=cgit -->
</body>
</html>