diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-03-08 14:52:36 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-23 22:10:18 +0900 |
commit | 75ebcf56dc03e4cb53ce7739dd3d621fd1d0f2c9 (patch) | |
tree | 7881bf3ec5fe6a770778ced901c3a0b1a03d0cb0 | |
parent | 157899513d32afd702f367a122b6993bc98725e2 (diff) | |
download | buildstream-75ebcf56dc03e4cb53ce7739dd3d621fd1d0f2c9.tar.gz |
bst-here: Add '-p' flag to upgrade buildstream (Issue #291)
-rwxr-xr-x | contrib/bst-here | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/contrib/bst-here b/contrib/bst-here index b8c2dd772..c3fc3ee5d 100755 --- a/contrib/bst-here +++ b/contrib/bst-here @@ -25,7 +25,7 @@ usage() { cat <<EOF -USAGE: $(basename "$0") [-t] [-T] [-h] [COMMAND] [ARG..] +USAGE: $(basename "$0") [-t] [-T] [-p] [-h] [COMMAND] [ARG..] Run a bst command in a new BuildStream contaner. @@ -35,20 +35,24 @@ using "/bin/bash -i". OPTIONS: -t Force pseudo-terminal allocation. -T Disable pseudo-terminal allocation. + -p Pull the latest buildstream image before running. -h Print this help text and exit. EOF exit "$1" } +BST_IMAGE='buildstream/buildstream-fedora:latest' + is_tty= +update=false if test -t 0 then is_tty=y fi -while getopts tTh arg +while getopts tTph arg do case $arg in T) @@ -57,6 +61,9 @@ do t) is_tty=y ;; + p) + update=true + ;; h) usage 0 ;; @@ -88,6 +95,11 @@ else command="/usr/local/bin/bst $@" fi +if "$update" == true +then + docker pull "$BST_IMAGE" +fi + # FIXME: We run with --privileged to allow bwrap to mount system # directories, but this is overkill. We should add the correct # --cap-add calls, or seccomp settings, but we are not sure @@ -105,5 +117,5 @@ exec docker run --rm -i${is_tty:+ -t} \ --volume buildstream-config:/root/.config \ --volume "$PWD":/src \ --workdir /src \ - buildstream/buildstream-fedora:latest \ + "$BST_IMAGE" \ $command |