From 642adde3f1df3db2d1d2b0ef9321c5b0954d4368 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 5 Sep 2016 18:50:43 +0200 Subject: Add --trust and --repo options to build.sh --- build.sh | 36 +++++++++++++++++++++++++++++++++--- 1 file 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 ] [--sudo ] " +usage="Usage: $0 [-h|--help] [] " # 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 Alternative installation directory." + diag " --sudo Optional sudo program to use." + diag " --repo Alternative package repository location." + diag " --trust 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 -- cgit v1.1