scripts/generate_manifest.sh: fix filesize for symlinks

scripts/filesize.sh doesn't follow symlinks.

Fixes #1316
This commit is contained in:
Matthias Schiffer 2018-01-24 09:49:21 +01:00
parent 4d4626f1c5
commit 8b44d09963
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -17,42 +17,50 @@ sysupgrade_ext=
SITE_CODE="$(scripts/site.sh site_code)" SITE_CODE="$(scripts/site.sh site_code)"
get_filename() {
local name="$1"
echo -n "gluon-${SITE_CODE}-${GLUON_RELEASE}-${name}-sysupgrade${sysupgrade_ext}"
}
get_filepath() {
local filename="$1"
echo -n "${GLUON_IMAGEDIR}/sysupgrade/${filename}"
}
generate_line() { generate_line() {
local model="$1" local model="$1"
local file="$2" local filename="$2"
local filesize="$3"
[ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \ local filepath="$(get_filepath "$filename")"
"$model" \ [ -e "$filepath" ] || return 0
"$GLUON_RELEASE" \
"$(scripts/sha256sum.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \ local file256sum="$(scripts/sha256sum.sh "$filepath")"
"$(scripts/filesize.sh "${GLUON_IMAGEDIR}/sysupgrade/$file")" \ local file512sum="$(scripts/sha512sum.sh "$filepath")"
"$file"
[ ! -e "${GLUON_IMAGEDIR}/sysupgrade/$file" ] || echo \ echo "$model $GLUON_RELEASE $file256sum $filesize $filename"
"$model" \ echo "$model $GLUON_RELEASE $file256sum $filename"
"$GLUON_RELEASE" \ echo "$model $GLUON_RELEASE $file512sum $filename"
"$(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() {
[ "${output}" ] || return 0 [ "${output}" ] || return 0
[ "$sysupgrade_ext" ] || return 0
if [ "$sysupgrade_ext" ]; then local filename="$(get_filename "$output")"
generate_line "$output" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${output}-sysupgrade${sysupgrade_ext}" local filepath="$(get_filepath "$filename")"
[ -e "$filepath" ] || return 0
local filesize="$(scripts/filesize.sh "$filepath")"
for alias in $aliases; do generate_line "$output" "$filename" "$filesize"
generate_line "$alias" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${alias}-sysupgrade${sysupgrade_ext}"
done
for alias in $manifest_aliases; do for alias in $aliases; do
generate_line "$alias" "gluon-${SITE_CODE}-${GLUON_RELEASE}-${output}-sysupgrade${sysupgrade_ext}" generate_line "$alias" "$(get_filename "$alias")" "$filesize"
done done
fi
for alias in $manifest_aliases; do
generate_line "$alias" "$filename" "$filesize"
done
} }