aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-05 18:50:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-05 18:50:43 +0200
commit642adde3f1df3db2d1d2b0ef9321c5b0954d4368 (patch)
tree6804fd92baeea356fd5f64f5d62907b7b635ae99
parent04a0a3a23858327bdd711f73a7143a2a50e75000 (diff)
Add --trust and --repo options to build.sh
-rwxr-xr-xbuild.sh36
1 files changed, 33 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index 5081c2c..820d89f 100755
--- a/build.sh
+++ b/build.sh
@@ -9,7 +9,7 @@
# @@ Perhaps a fingerprint to pass to fetch? Once repo is signed?
# @@ Option for alternative bpkg config dir?
-usage="Usage: $0 [-h] [--install-dir <dir>] [--sudo <prog>] <cxx>"
+usage="Usage: $0 [-h|--help] [<options>] <cxx>"
# Package repository URL (or path).
#
@@ -41,14 +41,20 @@ cxx=
idir=
sudo=
sudo_set=
+trust=
while test $# -ne 0; do
case $1 in
-h|--help)
diag
diag "$usage"
+ diag "Options:"
+ diag " --install-dir <dir> Alternative installation directory."
+ diag " --sudo <prog> Optional sudo program to use."
+ diag " --repo <loc> Alternative package repository location."
+ diag " --trust <fp> Certificate fingerprint to trust."
diag
- diag "By default the script will install into /usr/local using sudo (1)."
+ diag "By default the script will install into /usr/local using sudo(1)."
diag "To use sudo for a custom installation directory you need to specify"
diag "the sudo program explicitly, for example:"
diag
@@ -79,6 +85,26 @@ while test $# -ne 0; do
sudo_set="y"
shift
;;
+ --repo)
+ shift
+ if test $# -eq 0; then
+ diag "error: repository location expected after --repo"
+ diag "$usage"
+ exit 1
+ fi
+ BUILD2_REPO="$1"
+ shift
+ ;;
+ --trust)
+ shift
+ if test $# -eq 0; then
+ diag "error: certificate fingerprint expected after --trust"
+ diag "$usage"
+ exit 1
+ fi
+ trust="$1"
+ shift
+ ;;
*)
cxx="$1"
break
@@ -183,7 +209,11 @@ config.install.root="$idir" \
config.install.sudo="$conf_sudo"
run bpkg-stage add "$BUILD2_REPO"
-run bpkg-stage fetch
+if test -n "$trust"; then
+ run bpkg-stage --trust "$trust" fetch
+else
+ run bpkg-stage fetch
+fi
run bpkg-stage build --yes build2 bpkg
run bpkg-stage install build2 bpkg