In the event there are no sources, there won't be sums either. awk won't find any to remove and replace inline, so it tries to print "" at the end of the file, and merely adds superfluous newlines. Abort early instead, since updpkgsums cannot be expected to process such a file. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- src/updpkgsums.sh.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/updpkgsums.sh.in b/src/updpkgsums.sh.in index 41965f5..e5dbd2b 100644 --- a/src/updpkgsums.sh.in +++ b/src/updpkgsums.sh.in @@ -99,6 +99,11 @@ newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX") trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT sumtypes=$(IFS='|'; echo "${known_hash_algos[*]}") newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums' + +if [[ -z $newsums ]]; then + die "$buildfile does not contain sources to update" +fi + awk -v sumtypes="$sumtypes" -v newsums="$newsums" ' $0 ~"^[[:blank:]]*(" sumtypes ")sums(_[^=]+)?=", $0 ~ "\\)[[:blank:]]*(#.*)?$" { if (!w) { -- 2.31.1