Skip to content

Commit 98f408d

Browse files
committed
Enable use of USE_* variables with 0 or 1
1 parent 32b1145 commit 98f408d

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

bin/gbuild

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def build_one_configuration(suite, arch, build_desc)
4343

4444
bits = @bitness[arch] or raise "unknown architecture ${arch}"
4545

46-
if ENV["USE_LXC"]
46+
if ENV["USE_LXC"] == "1"
4747
ENV["LXC_ARCH"] = arch
4848
ENV["LXC_SUITE"] = suite
4949
end
@@ -228,7 +228,7 @@ OptionParser.new do |opts|
228228
end
229229
end.parse!
230230

231-
if !ENV["USE_LXC"] and !ENV["USE_DOCKER"] and !ENV["USE_VBOX"] and !File.exist?("/dev/kvm")
231+
if ENV["USE_LXC"] != "1" and ENV["USE_DOCKER"] != "1" and ENV["USE_VBOX"] != "1" and !File.exist?("/dev/kvm")
232232
$stderr.puts "\n************* WARNING: kvm not loaded, this will probably not work out\n\n"
233233
end
234234

@@ -273,7 +273,7 @@ docker_image_digests = build_desc["docker_image_digests"] || []
273273
# if docker_image_digests are supplied, it must be the same length as suites
274274
if docker_image_digests.size > 0 and suites.size != docker_image_digests.size
275275
raise "`suites` and `docker_image_digests` must both be the same size if both are supplied"
276-
elsif ENV["USE_DOCKER"] and docker_image_digests.size > 0 and suites.size == docker_image_digests.size
276+
elsif ENV["USE_DOCKER"] == "1" and docker_image_digests.size > 0 and suites.size == docker_image_digests.size
277277
suites = docker_image_digests
278278
end
279279

libexec/copy-from-target

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ if [ $# = 0 ] ; then
4646
exit 1
4747
fi
4848

49-
if [ -n "$USE_DOCKER" ]; then
49+
if [ "$USE_DOCKER" -eq 1 ]; then
5050
# Use tar, so that files are created with the correct owner on the host
5151
docker exec -u $TUSER gitian-target tar -C `dirname "$1"` -cf - `basename "$1"` | tar -C "$2" -xf -
52-
elif [ -z "$USE_LXC" ]; then
53-
src="${1%/}" # remove trailing / which triggers special rsync behaviour
54-
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "$TUSER@localhost:${src}" "$2"
55-
else
52+
elif [ "$USE_LXC" -eq 1 ]; then
5653
config-lxc
5754
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C `dirname "$1"` -cf - `basename "$1"` | tar -C "$2" -xf -
55+
else
56+
src="${1%/}" # remove trailing / which triggers special rsync behaviour
57+
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "$TUSER@localhost:${src}" "$2"
5858
fi

libexec/copy-to-target

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ if [ $# = 0 ] ; then
4646
exit 1
4747
fi
4848

49-
if [ -n "$USE_DOCKER" ]; then
49+
if [ "$USE_DOCKER" -eq 1 ]; then
5050
docker exec -u $TUSER gitian-target mkdir -p "/home/$TUSER/$2"
5151
docker cp "$1" gitian-target:"/home/$TUSER/$2"
5252
docker exec -u root gitian-target chown -R $TUSER:$TUSER "/home/$TUSER/$2"
53-
elif [ -z "$USE_LXC" ]; then
54-
src="${1%/}" # remove trailing / which triggers special rsync behaviour
55-
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "${src}" "$TUSER@localhost:$2"
56-
else
53+
elif [ "$USE_LXC" -eq 1 ]; then
5754
config-lxc
5855
tar -C `dirname "$1"` -cf - `basename "$1"` | sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -i -u $TUSER tar -C "$2" -xf -
56+
else
57+
src="${1%/}" # remove trailing / which triggers special rsync behaviour
58+
rsync --checksum -a $QUIET_FLAG -e "ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT" "${src}" "$TUSER@localhost:$2"
5959
fi

libexec/gconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
VM_SSH_PORT=2223
2-
if [ -n "$USE_LXC" ]; then
2+
if [ "$USE_LXC" -eq 1 ]; then
33
if [ -z "$LXC_EXECUTE" ]; then
44
ver=`lxc-start --version`
55
if dpkg --compare-versions $ver ge 1.0.0 ; then

libexec/make-clean-vm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ SUITE=xenial
55
ARCH=amd64
66

77
VMSW=KVM
8-
if [ -n "$USE_LXC" ]; then
8+
if [ "$USE_LXC" -eq 1 ]; then
99
VMSW=LXC
10-
elif [ -n "$USE_VBOX" ]; then
10+
elif [ "$USE_VBOX" -eq 1 ]; then
1111
VMSW=VBOX
12-
elif [ -n "$USE_DOCKER" ]; then
12+
elif [ "$USE_DOCKER" -eq 1 ]; then
1313
VMSW=DOCKER
1414
fi
1515

libexec/on-target

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ fi
4646
# exit 1
4747
#fi
4848

49-
if [ -n "$USE_DOCKER" ]; then
49+
if [ "$USE_DOCKER" -eq 1 ]; then
5050
docker exec -u $TUSER -i gitian-target $*
51-
elif [ -z "$USE_LXC" ]; then
52-
ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT $TUSER@localhost $*
53-
else
51+
elif [ "$USE_LXC" -eq 1 ]; then
5452
config-lxc
5553
sudo $LXC_EXECUTE -n gitian -f var/lxc.config -- sudo -u $TUSER $ENV -i -- $*
54+
else
55+
ssh -oConnectTimeout=30 -oNoHostAuthenticationForLocalhost=yes -i ${GITIAN_BASE:-.}/var/id_rsa -p $VM_SSH_PORT $TUSER@localhost $*
5656
fi

libexec/start-target

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ ARCH=qemu$1
66
SUFFIX=$2
77

88
VMSW=KVM
9-
if [ -n "$USE_LXC" ]; then
9+
if [ "$USE_LXC" -eq 1 ]; then
1010
VMSW=LXC
11-
elif [ -n "$USE_VBOX" ]; then
11+
elif [ "$USE_VBOX" -eq 1 ]; then
1212
VMSW=VBOX
13-
elif [ -n "$USE_DOCKER" ]; then
13+
elif [ "$USE_DOCKER" -eq 1 ]; then
1414
VMSW=DOCKER
1515
fi
1616

libexec/stop-target

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh
22

33
VMSW=KVM
4-
if [ -n "$USE_LXC" ]; then
4+
if [ "$USE_LXC" -eq 1 ]; then
55
VMSW=LXC
6-
elif [ -n "$USE_VBOX" ]; then
6+
elif [ "$USE_VBOX" -eq 1 ]; then
77
VMSW=VBOX
8-
elif [ -n "$USE_DOCKER" ]; then
8+
elif [ "$USE_DOCKER" -eq 1 ]; then
99
VMSW=DOCKER
1010
fi
1111

0 commit comments

Comments
 (0)