Browse Source

Merge "Fixes DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE matching when empty"

tags/2.26.0
Zuul 1 month ago
parent
commit
4131942356

+ 3
- 3
diskimage_builder/elements/ubuntu/pre-install.d/01-set-ubuntu-mirror View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-if [ ${DIB_DEBUG_TRACE:-0} -gt 1 ]; then
3
+if [[ ${DIB_DEBUG_TRACE:-0} -gt 1 ]]; then
4 4
     set -x
5 5
 fi
6 6
 set -eu
@@ -8,11 +8,11 @@ set -o pipefail
8 8
 
9 9
 DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
10 10
 
11
-[ -n "$DIB_DISTRIBUTION_MIRROR" ] || exit 0
11
+[[ -n "$DIB_DISTRIBUTION_MIRROR" ]] || exit 0
12 12
 
13 13
 while IFS= read line
14 14
 do
15
-    if [[ "$line" =~ ${DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE:-} ]]; then
15
+    if [[ -n "${DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE:-}" && "$line" =~ ${DIB_DISTRIBUTION_MIRROR_UBUNTU_IGNORE:-} ]]; then
16 16
         # append line unmodified
17 17
         echo "$line" | tee --append /etc/apt/sources.list.new
18 18
     else

Loading…
Cancel
Save