diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-03-08 14:52:36 +0100 |
---|---|---|
committer | Tristan Maat <tristan.maat@codethink.co.uk> | 2018-03-27 15:09:49 +0100 |
commit | 7ab50d85da175d3b6eafd262b47bf71b496a7eb7 (patch) | |
tree | 203943e6dd48664a0dbf35076d03fdb349f37c90 | |
parent | be5a8638264dfe6b96eabfc0e0b6582ec7091d6c (diff) | |
download | buildstream-bst-here-update.tar.gz |
bst-here: Add '-p' flag to upgrade buildstream (Issue #291)bst-here-update
-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..59fde303b 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] [-u] [-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 |