Skip to content

Commit

Permalink
Added support for buildings CentOS 7 RPMs.
Browse files Browse the repository at this point in the history
  • Loading branch information
russjones committed Dec 18, 2021
1 parent 2f08e0b commit fda9e59
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions build.assets/build-package.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -e

usage() { echo "Usage: $(basename $0) [-t <oss/ent>] [-v <version>] [-p <package type>] <-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 <oss/ent>] [-v <version>] [-p <package type>] <-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}
Expand Down Expand Up @@ -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
;;
Expand All @@ -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}
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fda9e59

Please sign in to comment.