build: add file size field to manifest lines

We would like to check the file size instead of downloading indefinitely.
The file size is added in another copy of the manifest lines, which is
ignored by older autoupdater implementations.
This commit is contained in:
Matthias Schiffer 2017-12-28 22:50:31 +01:00
parent 245e0f9ecc
commit 21b3dd3259
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
2 changed files with 32 additions and 2 deletions

16
scripts/filesize.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
check_command() {
which "$1" >/dev/null 2>&1
}
if check_command gnustat; then
gnustat -c%s "$@"
elif check_command gstat; then
gstat -c%s "$@"
elif check_command stat; then
stat -c%s "$@"
else
echo "$0: no suitable stat implementation was found" >&2
exit 1
fi

View File

@ -21,8 +21,22 @@ generate_line() {
local model="$1" local model="$1"
local file="$2" local file="$2"
[ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo "$model" "$GLUON_RELEASE" "$(scripts/sha256sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" "$file" [ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \
[ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo "$model" "$GLUON_RELEASE" "$(scripts/sha512sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" "$file" "$model" \
"$GLUON_RELEASE" \
"$(scripts/sha256sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
"$(scripts/filesize.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
"$file"
[ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \
"$model" \
"$GLUON_RELEASE" \
"$(scripts/sha256sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
"$file"
[ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \
"$model" \
"$GLUON_RELEASE" \
"$(scripts/sha512sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \
"$file"
} }
generate() { generate() {