#!/bin/bash
#
# Copyright 2017 Bloomberg Finance LP
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see .
#
# Authors:
# Charles Bailey
# Sam Thursfield
# This is a helper script for using BuildStream via Docker. See
# docs/source/install.rst for documentation.
usage() {
cat </dev/null
done
BST_HERE_PS1="\[\033[01;34m\]\w\[\033[00m\]> "
if [ "$#" -eq 0 ]; then
command="/bin/bash -i"
else
command="/usr/local/bin/bst $@"
fi
if "$update" == true
then
docker pull "$bst_here_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
# what those are yet.
#
# Old settings:
# --cap-add SYS_ADMIN
# --security-opt seccomp=unconfined
#
exec docker run --rm -i${is_tty:+ -t} \
--privileged \
--env PS1="$BST_HERE_PS1" \
--device /dev/fuse \
--volume buildstream-cache:/root/.cache/buildstream \
--volume buildstream-config:/root/.config \
--volume "$PWD":/src \
$extra_volumes_opt \
--workdir /src \
"$bst_here_image" \
$command