Skip to content

Commit

Permalink
Add building APT packages on a Fedora image
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Khouzam <[email protected]>
  • Loading branch information
marckhouzam authored and vuil committed Jun 29, 2023
1 parent 1cb4cc7 commit 8945351
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
5 changes: 5 additions & 0 deletions hack/apt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ repository will be generated as a directory called `_output/apt` which will
contain the two built packages. Please see the section on publishing the
repository for more details.

## Using fedora

The package build scripts support building on a fedora machine.
This can be done using `make apt-package APT_BUILDER_IMAGE=fedora`.

## Testing the installation of the Tanzu CLI locally

We can install the Tanzu CLI using the newly built Debian repository locally on
Expand Down
19 changes: 14 additions & 5 deletions hack/apt/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
# SPDX-License-Identifier: Apache-2.0

set -e
set -x

if [ $(uname) != "Linux" ] || [ -z "$(command -v apt)" ]; then
echo "This script must be run on a Linux system that uses the APT package manager"
if [ $(uname) != "Linux" ]; then
echo "This script must be run on a Linux system"
exit 1
fi

# Use apt-get, but also support dnf/yum
PKG_MGR=$(command -v apt-get || command -v dnf || command -v yum || true)

if [ -z "$PKG_MGR" ]; then
echo "This script requires one of the following package managers: apt-get, dnf or yum"
exit 1
fi

Expand All @@ -24,9 +33,9 @@ OUTPUT_DIR=${BASE_DIR}/_output
ARTIFACTS_DIR=${BASE_DIR}/../../artifacts

# Install build dependencies
if ! command -v curl &> /dev/null; then
apt-get update
apt-get install -y curl
if ! command -v dpkg-deb &> /dev/null; then
${PKG_MGR} update -y
${PKG_MGR} install -y dpkg
fi

# Clean any old packages
Expand Down
17 changes: 13 additions & 4 deletions hack/apt/build_package_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
# SPDX-License-Identifier: Apache-2.0

set -e
set -x

if [ $(uname) != "Linux" ] || [ -z "$(command -v apt)" ]; then
echo "This script must be run on a Linux system that uses the APT package manager"
if [ $(uname) != "Linux" ]; then
echo "This script must be run on a Linux system"
exit 1
fi

# Use apt-get, but also support dnf/yum
PKG_MGR=$(command -v apt-get || command -v dnf || command -v yum || true)

if [ -z "$PKG_MGR" ]; then
echo "This script requires one of the following package managers: apt-get, dnf or yum"
exit 1
fi

Expand All @@ -24,8 +33,8 @@ OUTPUT_DIR=${BASE_DIR}/_output

# Install build dependencies
if ! command -v reprepro &> /dev/null; then
apt-get update
apt-get install -y reprepro
${PKG_MGR} update -y
${PKG_MGR} install -y reprepro
fi

# Assumes ${OUTPUT_DIR} is populated from build_package.sh
Expand Down

0 comments on commit 8945351

Please sign in to comment.