gitlab-ci: fix testing whether a variable with a given name is set or not
authorEric Engestrom <eric@engestrom.ch>
Wed, 19 Aug 2020 14:02:44 +0000 (16:02 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 19 Aug 2020 21:53:31 +0000 (21:53 +0000)
The previous code considered unset variables the same as set-but-empty;
sometimes setting a variable as something empty is meaningful, so let's
pass them through properly.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6389>

.gitlab-ci/bare-metal/rootfs-setup.sh

index 90e9bbf9ebeaedc383fb3ef927d6e5a599827cb0..220968aa05778db2da1055134132ca7d74037bad 100644 (file)
@@ -50,7 +50,7 @@ for var in \
     VK_DRIVER \
     ; do
   val=`echo ${!var} | sed 's|"||g'`
-  if [ -n "$val" ]; then
+  if [ -n "${!var+x}" ]; then
     echo "export $var=\"${val}\"" >> $rootfs_dst/set-job-env-vars.sh
   fi
 done