From 871bf564ec6db5369ccba9703cb78d8681175c68 Mon Sep 17 00:00:00 2001 From: John Ingve Olsen Date: Thu, 11 Jul 2024 08:42:59 +0200 Subject: [PATCH] Add a script to generate and build packages --- scripts/generate_and_build_all_pkgbuilds.sh | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 scripts/generate_and_build_all_pkgbuilds.sh diff --git a/scripts/generate_and_build_all_pkgbuilds.sh b/scripts/generate_and_build_all_pkgbuilds.sh new file mode 100755 index 0000000..6097a07 --- /dev/null +++ b/scripts/generate_and_build_all_pkgbuilds.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR=$(realpath "$SCRIPT_DIR/..") +BUILD_DIR="$ROOT_DIR/build" + +mkdir --parents "$BUILD_DIR" || exit $? + +source /etc/os-release || exit $? + +if [ "$ID" != "arch" ]; then + # If not on Arch, build Docker image and re-run this script inside container + docker build -t arch-deployment -f "${ROOT_DIR}"/deployment/Dockerfile . || exit $? + docker run --rm \ + --volume $BUILD_DIR:/build \ + --user "$(id -u):$(id -g)" \ + -it arch-deployment \ + "$0" "$@" +else + BUILD_DIR="/build" + scripts/generate_all_pkgbuilds.sh "$BUILD_DIR" || exit $? + + for packageDir in "$BUILD_DIR"/*; do + pushd $packageDir || exit $? + makepkg --nodeps || exit $? + popd || exit $? + done +fi