Fix extraction of default locale when running integration tests
When running integration tests, the LANG variable in .subiquity/etc/default/locale is unquoted. The pattern that we use expects quotes so it does not match. Fixed by making the test work with or without quotes. In case quotes are not present, the final part of the pipeline will fail to find a delimiter so it will print the line unchanged excerpt from cut(1) -f, --fields=LIST select only these fields; also print any line that contains no delimiter character, unless the -s option is specified Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
27ac4b43b1
commit
1a079ecddd
|
@ -89,7 +89,8 @@ validate () {
|
|||
echo "user not assigned with the expected group sudo"
|
||||
exit 1
|
||||
fi
|
||||
lang="$(grep -Eo 'LANG="([^.@ _]+)' .subiquity/etc/default/locale | cut -d \" -f 2)"
|
||||
# Extract value of the LANG variable from etc/default/locale (with or without quotes)
|
||||
lang="$(grep -Eo 'LANG=([^.@ _]+)' .subiquity/etc/default/locale | cut -d= -f 2- | cut -d\" -f 2-)"
|
||||
if ! ls .subiquity/var/cache/apt/archives/ | grep --fixed-strings --quiet -- "$lang"; then
|
||||
echo "expected $lang language packs in directory var/cache/apt/archives/"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in New Issue