3 # directory where search for images
4 TOP_DIR
="${TOP_DIR:-./bin/targets}"
6 BUILD_KEY
="${BUILD_KEY:-key-build}" # TODO unifiy naming?
7 # remove other signatures (added e.g. by buildbot)
8 REMOVE_OTER_SIGNATURES
="${REMOVE_OTER_SIGNATURES:-1}"
10 # find all sysupgrade images in TOP_DIR
11 # factory images don't need signatures as non OpenWrt system doen't check them anyway
12 for image
in $
(find $TOP_DIR -type f
-name "*-sysupgrade.bin"); do
13 # check if image actually support metadata
14 if fwtool
-i /dev
/null
"$image"; then
15 # remove all previous signatures
16 if [ -n "$REMOVE_OTER_SIGNATURES" ]; then
17 while [ "$?" = 0 ]; do
18 fwtool
-t -s /dev
/null
"$image"
21 # run same operation as build root does for signing
22 cp "$BUILD_KEY.ucert" "$image.ucert"
23 usign
-S -m "$image" -s "$BUILD_KEY" -x "$image.sig"
24 ucert
-A -c "$image.ucert" -x "$image.sig"
25 fwtool
-S "$image.ucert" "$image"