Commit cc4974dc authored by Olav Morken's avatar Olav Morken
Browse files

Build packages in a temporary directory

When we build the packages locally, we end up filling our project
directory with all the temporary files that are generated as part of
the build.

Avoid this by switching to a temporary working directory before
building the packages.
parent f411a1ae
......@@ -9,5 +9,5 @@ Edit **** and set the desired version number for Radsecproxy.
To build the packages locally, run:
docker run --rm -ti -v "$(pwd -P):/work" debian:bullseye /bin/sh -c 'cd /work && ./'
docker run --rm -ti -v "$(pwd -P):/work" debian:bullseye /work/
#! /bin/sh
# set -x
set -e
# The directory where this script is located.
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Run all tasks in a temporary directory. This avoids filling up the project
# directory with temporary files when this script is run locally (outside of
# GitLab CI). It also allows multiple build commands to be run in parallel
# locally without conflicting with each other.
work_dir="$(mktemp -d)"
cd "${work_dir}"
# Install required build dependencies
apt-get update
apt-get -y upgrade
......@@ -28,8 +38,6 @@ revision="2${lsb_release_name}~uninett"
export TZ="Europe/Oslo"
now=$(date +"%a, %d %b %Y %T %z")
export DEBIAN_FRONTEND=noninteractive
cat >> /etc/apt/sources.list << EOF
......@@ -69,9 +77,8 @@ cat changelog > "${package}-${version}/debian/changelog"
cd "${package}-${version}/"
cd "${here}"
# Copy the generated Debian packages to the output directory.
mkdir -p "${output_dir}"
cp -pv ./*.deb "${output_dir}/"
cp -pv "${work_dir}/"*.deb "${output_dir}/"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment