21700: Install Bundler system-wide in Rails postinst
[arvados.git] / tools / arvbox / lib / arvbox / docker / go-setup.sh
1 #!/bin/bash
2 # Copyright (C) The Arvados Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: AGPL-3.0
5
6 export GOPATH=/var/lib/gopath
7 mkdir -p $GOPATH
8
9 cd /usr/src/arvados
10 RUNSU=""
11 if [[ $UID = 0 ]] ; then
12   RUNSU="/usr/local/lib/arvbox/runsu.sh"
13 fi
14
15 if [[ ! -f /usr/local/bin/arvados-server ]]; then
16   $RUNSU flock /var/lib/gopath/gopath.lock go mod download
17   $RUNSU flock /var/lib/gopath/gopath.lock go mod vendor
18   $RUNSU flock /var/lib/gopath/gopath.lock go install git.arvados.org/arvados.git/cmd/arvados-server
19   $RUNSU flock /var/lib/gopath/gopath.lock install $GOPATH/bin/arvados-server /usr/local/bin
20 fi