deb to snap: improve check for version mismatch
Currently the kernel snap build succeeds if the kernel version requested
on the snapcraft.yaml file doesn't have the same ABI version as the
latest kernel on the repository. The script blows at the following
point, but the build continues with the wrong package version.
set -e; \
echo ; \
KIMGVER="$(dpkg --root=chroot -l | awk '// {print $3}')"; \
echo $KIMGVER; \
[ ! $KIMGVER ] && echo "Unable to extract KIMGVER, exit" && exit 1; \
if [ $KIMGVER != 4.4.0-129.155 ]; then \
echo "Version mismatch:\nInstalled: $KIMGVER Requested: 4.4.0-129.155"; \
exit 1; \
fi; \
}
/bin/sh: 6: [: (Status,Err:: unexpected operator
/bin/sh: 7: [: (Status,Err:: unexpected operator
That's caused by the fact that we install the kernel package using the
meta package name provided, which always pulls the latest version from
the repo, and we use the ABI number provided to query the binary package
name installed, which will return an empty string if the ABI doesn't
match. The check works if only the build number is different though.
Fix it by checking the contents of the KIMGDEB variable before using it
to check if the whole package version matches.
Signed-off-by: Kleber Sacilotto de Souza <email address hidden>
Acked-by: Paolo Pisati <email address hidden>
Signed-off-by: Kleber Sacilotto de Souza <email address hidden>