github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/scripts/packaging/installrequirements.sh (about) 1 #!/bin/bash 2 3 set -euo pipefail 4 5 GOVERSION="${GOVERSION:-1.22.1}" 6 7 cd "$(dirname $0)/../.." 8 if [ -f debian/changelog ]; then 9 echo "ERROR: debian/changelog already exists" 10 exit 1 11 fi 12 13 echo "====================" 14 echo "Install Requirements" 15 echo "====================" 16 apt-get update 17 DEBIAN_FRONTEND=noninteractive apt-get install --yes devscripts lsb-release binutils fakeroot quilt devscripts dpkg-dev libdistro-info-perl equivs aptitude wget build-essential git --no-install-recommends --no-install-suggests 18 dpkg-checkbuilddeps || (yes y | mk-build-deps debian/control -ir) || true 19 20 if [ -z "${SKIP_GO:-}" ]; then 21 echo "==========" 22 echo "Install GO" 23 echo "==========" 24 export GOROOT="${GOROOT:-/tmp/goroot}" 25 [ ! -d "${GOROOT}" ] && mkdir -p "${GOROOT}" 26 export GOPATH="${GOPATH:-/tmp/go}" 27 [ ! -d "${GOPATH}" ] && mkdir -p "${GOPATH}" 28 if [ ! -x "${GOROOT}/bin/go" ]; then 29 echo ". download go archive" 30 [ -f "go.tar.gz" ] || wget --quiet https://dl.google.com/go/go${GOVERSION}.linux-amd64.tar.gz -O /tmp/go.tar.gz 31 echo ". extract go archive" 32 [ ! -d "${GOROOT}" ] && mkdir -p "${GOROOT}" 33 tar xf /tmp/go.tar.gz -C "${GOROOT}" --strip-components=1 34 rm -rf /tmp/go.tar.gz 35 fi 36 export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}" 37 fi