1
0
Fork 0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-05-28 02:16:14 +02:00
openwrt/scripts/sign_images.sh
Josh Soref 08622de7d6 scripts: fix various typos
This only affects typos in comments or user-facing output.

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
[only picks changes to scripts, drop "commandline" replacement,
 fix case for "arbitrary", improve commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-31 21:24:47 +01:00

28 lines
937 B
Bash
Executable File

#!/bin/sh
# directory where search for images
TOP_DIR="${TOP_DIR:-./bin/targets}"
# key to sign images
BUILD_KEY="${BUILD_KEY:-key-build}" # TODO unify naming?
# remove other signatures (added e.g. by buildbot)
REMOVE_OTER_SIGNATURES="${REMOVE_OTER_SIGNATURES:-1}"
# find all sysupgrade images in TOP_DIR
# factory images don't need signatures as non OpenWrt system doesn't check them anyway
for image in $(find $TOP_DIR -type f -name "*-sysupgrade.bin"); do
# check if image actually support metadata
if fwtool -i /dev/null "$image"; then
# remove all previous signatures
if [ -n "$REMOVE_OTER_SIGNATURES" ]; then
while [ "$?" = 0 ]; do
fwtool -t -s /dev/null "$image"
done
fi
# run same operation as build root does for signing
cp "$BUILD_KEY.ucert" "$image.ucert"
usign -S -m "$image" -s "$BUILD_KEY" -x "$image.sig"
ucert -A -c "$image.ucert" -x "$image.sig"
fwtool -S "$image.ucert" "$image"
fi
done