diff --git a/Makefile b/Makefile index 01d010a24d647..e9140542c01c6 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,13 @@ BUILDFLAGS = $(ADDFLAGS) -ldflags '-w -s' -buildmode=exe CGOFLAG = CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ endif +# RPM_FLAGS is a hack for Teleport 8. It allows passing in flags to +# build-package.sh to create CentOS 7 RPMs. +# +# In Teleport 9 we will switch the buildbox to CentOS 7 and no longer need to +# do this. This should never make it into master or branch/v9. +RPM_FLAGS ?= + ifeq ("$(OS)","linux") # ARM builds need to specify the correct C compiler ifeq ("$(ARCH)","arm") @@ -840,8 +847,8 @@ rpm: chmod +x $(BUILDDIR)/build-package.sh cp -a ./build.assets/rpm $(BUILDDIR)/ cp -a ./build.assets/rpm-sign $(BUILDDIR)/ - cd $(BUILDDIR) && ./build-package.sh -t oss -v $(VERSION) -p rpm -a $(ARCH) $(RUNTIME_SECTION) $(TARBALL_PATH_SECTION) - if [ -f e/Makefile ]; then $(MAKE) -C e rpm; fi + cd $(BUILDDIR) && ./build-package.sh -t oss -v $(VERSION) $(RPM_FLAGS) -p rpm -a $(ARCH) $(RUNTIME_SECTION) $(TARBALL_PATH_SECTION) + if [ -f e/Makefile ]; then $(MAKE) -C e rpm RPM_FLAGS="$(RPM_FLAGS)"; fi # build unsigned .rpm (for testing) .PHONY: rpm-unsigned diff --git a/build.assets/build-package.sh b/build.assets/build-package.sh index 17e1bfbc52eb6..eb1a05e70b335 100755 --- a/build.assets/build-package.sh +++ b/build.assets/build-package.sh @@ -1,8 +1,8 @@ #!/bin/bash set -e -usage() { echo "Usage: $(basename $0) [-t ] [-v ] [-p ] <-a [amd64/x86_64]|[386/i386]|arm|arm64> <-r fips> <-s tarball source dir> <-m tsh>" 1>&2; exit 1; } -while getopts ":t:v:p:a:r:s:m:" o; do +usage() { echo "Usage: $(basename $0) [-t ] [-v ] [-p ] <-c centos7> <-a [amd64/x86_64]|[386/i386]|arm|arm64> <-r fips> <-s tarball source dir> <-m tsh>" 1>&2; exit 1; } +while getopts ":t:v:p:a:r:s:m:c:" o; do case "${o}" in t) t=${OPTARG} @@ -30,6 +30,9 @@ while getopts ":t:v:p:a:r:s:m:" o; do m=${OPTARG} if [[ ${m} != "tsh" ]]; then usage; fi ;; + c) + c=${OPTARG} + ;; *) usage ;; @@ -47,6 +50,7 @@ PACKAGE_TYPE=${p} ARCH=${a} RUNTIME=${r} BUILD_MODE=${m} +CENTOS_VERSION=${c} TARBALL_DIRECTORY=/tmp/teleport-tarballs DOWNLOAD_IF_NEEDED=true GNUPG_DIR=${GNUPG_DIR:-/tmp/gnupg} @@ -192,11 +196,15 @@ elif [[ "${ARCH}" == "arm64" ]]; then TEXT_ARCH="ARMv8/ARM64" fi -# set optional runtime section for filename +# Set optional runtime section for tarball filename. +if [[ "${CENTOS_VERSION}" == "centos7" ]]; then + OPTIONAL_RUNTIME_SECTION="-centos7" +fi if [[ "${RUNTIME}" == "fips" ]]; then - OPTIONAL_RUNTIME_SECTION="-fips" + OPTIONAL_RUNTIME_SECTION+="-fips" fi + # set variables appropriately depending on type of package being built if [[ "${TELEPORT_TYPE}" == "ent" ]]; then TARBALL_FILENAME="teleport-ent-v${TELEPORT_VERSION}-${PLATFORM}-${FILENAME_ARCH}${OPTIONAL_RUNTIME_SECTION}-bin.tar.gz"