Make sure test-this-branch.sh exits if distro-info is not installed

Although the script is running with -e, having two distinct invocations
of a subshell in the same instruction masks failures in the first
subshell invocation. It is similar in essence to what the pipefail
option controls.

As a consequence, the following instruction does not fail if distro-info
is not installed:

  isoname=$(distro-info -d)-live-server-$(dpkg --print-architecture).iso

And therefore, we end up with something like:

  isoname=-live-server-amd64.iso

Fixed by first assigning the value of $(distro-info -d) to a variable.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2022-01-04 15:06:03 +01:00
parent 73bc16b8fb
commit 6d88618b9e
1 changed files with 2 additions and 1 deletions

View File

@ -8,7 +8,8 @@ sudo apt install -y zsync xorriso isolinux
snapcraft snap --output subiquity_test.snap snapcraft snap --output subiquity_test.snap
urlbase=http://cdimage.ubuntu.com/ubuntu-server/daily-live/current urlbase=http://cdimage.ubuntu.com/ubuntu-server/daily-live/current
isoname=$(distro-info -d)-live-server-$(dpkg --print-architecture).iso distroname=$(distro-info -d)
isoname="${distroname}"-live-server-$(dpkg --print-architecture).iso
zsync ${urlbase}/${isoname}.zsync zsync ${urlbase}/${isoname}.zsync
sudo ./scripts/inject-subiquity-snap.sh ${isoname} subiquity_test.snap custom.iso sudo ./scripts/inject-subiquity-snap.sh ${isoname} subiquity_test.snap custom.iso