2018-10-15 03:52:53 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-04-15 01:28:37 -04:00
|
|
|
# v0.14.2
|
|
|
|
: "${ROOTLESSKIT_COMMIT:=4cd567642273d369adaadcbadca00880552c1778}"
|
2018-10-15 03:52:53 -04:00
|
|
|
|
|
|
|
install_rootlesskit() {
|
|
|
|
case "$1" in
|
2020-03-02 22:27:49 -05:00
|
|
|
"dynamic")
|
|
|
|
install_rootlesskit_dynamic
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
_install_rootlesskit
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo 'Usage: $0 [dynamic]'
|
|
|
|
;;
|
2018-10-15 03:52:53 -04:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
install_rootlesskit_dynamic() {
|
|
|
|
export ROOTLESSKIT_LDFLAGS="-linkmode=external" install_rootlesskit
|
2020-05-20 21:23:00 -04:00
|
|
|
export BUILD_MODE=${GO_BUILDMODE}
|
2018-10-15 03:52:53 -04:00
|
|
|
_install_rootlesskit
|
|
|
|
}
|
|
|
|
|
2021-02-11 08:45:34 -05:00
|
|
|
_install_rootlesskit() (
|
2018-10-15 03:52:53 -04:00
|
|
|
echo "Install rootlesskit version $ROOTLESSKIT_COMMIT"
|
|
|
|
git clone https://github.com/rootless-containers/rootlesskit.git "$GOPATH/src/github.com/rootless-containers/rootlesskit"
|
2021-02-11 08:45:34 -05:00
|
|
|
cd "$GOPATH/src/github.com/rootless-containers/rootlesskit" || exit 1
|
2018-10-15 03:52:53 -04:00
|
|
|
git checkout -q "$ROOTLESSKIT_COMMIT"
|
2021-02-11 08:45:34 -05:00
|
|
|
export GO111MODULE=on
|
2021-03-23 16:52:47 -04:00
|
|
|
# TODO remove GOPROXY override once we updated to Go 1.14+
|
|
|
|
# Using goproxy instead of "direct" to work around an issue in go mod
|
|
|
|
# on Go 1.13 not working with older git versions (default version on
|
|
|
|
# CentOS 7 is git 1.8), see https://github.com/golang/go/issues/38373
|
|
|
|
export GOPROXY="https://proxy.golang.org"
|
2019-03-20 13:11:31 -04:00
|
|
|
for f in rootlesskit rootlesskit-docker-proxy; do
|
|
|
|
go build $BUILD_MODE -ldflags="$ROOTLESSKIT_LDFLAGS" -o "${PREFIX}/$f" github.com/rootless-containers/rootlesskit/cmd/$f
|
|
|
|
done
|
2021-02-11 08:45:34 -05:00
|
|
|
)
|