From 685c74c4fa212b132c55be1c91e5b366a3593b83 Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Wed, 26 Oct 2022 00:05:46 +0800 Subject: refactor: Move script out from ng folder Signed-off-by: KunoiSayami --- utils/pkgbuild_bootstrap | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 utils/pkgbuild_bootstrap (limited to 'utils/pkgbuild_bootstrap') diff --git a/utils/pkgbuild_bootstrap b/utils/pkgbuild_bootstrap new file mode 100755 index 0000000..7f251f8 --- /dev/null +++ b/utils/pkgbuild_bootstrap @@ -0,0 +1,53 @@ +#!/bin/bash + +if [ -z "$DOCKER_SETUP_SCRIPT" ]; then + echo $GPG_PRIV_KEY | base64 -d | gpg --import + cd "$(dirname "$0")" + cd ../../ + echo "Current pwd: $(pwd)" +fi + +set -Eeo pipefail +trap cleanup SIGINT SIGTERM ERR EXIT + +cleanup() { + trap - SIGINT SIGTERM ERR EXIT + unset SRCDEST + unset CONFDEST + unset TMPCONF + unset FLAGS + unset ARCH +} + +ARCH=$(uname -m) +CONFDEST="${PWD}/makepkg.d/makepkg.$ARCH.conf" + +TMPCONF="makepkg_current.conf" +cat "${PWD}/makepkg.d/makepkg.base.conf" > "$TMPCONF" +cat "$CONFDEST" >> "$TMPCONF" + +FLAGS="" + +if [ "$EUID" -eq 0 ] ; then + echo "\033[0;32mPlease run this script as non-root\033[0m" + exit 3 +fi + +if [ -z "$REMOTE_DATABASE" ]; then + echo "\033[0;32mYou should specify remote address\033[0m" + exit 4 +fi + +if [ -n "$FORCE_BUILD_ALL" ]; then + FLAGS+="--build_all " +fi + +if [ -n "$BUILD_FAIL_FAST" ]; then + FLAGS+="--fail_fast " +fi + +curl -fL -o remote.db "$REMOTE_DATABASE" + +sudo pacman -Sy + +./utils/pkgbuild.py remote.db $FLAGS -- cgit v1.3.1