diff options
| author | KunoiSayami <[email protected]> | 2022-10-26 00:05:46 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2022-10-26 00:05:46 +0800 |
| commit | 685c74c4fa212b132c55be1c91e5b366a3593b83 (patch) | |
| tree | 25a9aa9024f517ce51107c89e60267fea56f105e /utils/pkgbuild_bootstrap | |
| parent | 596fc2317eae72d006e4c528ac3f14c4d9d712e8 (diff) | |
refactor: Move script out from ng folder
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'utils/pkgbuild_bootstrap')
| -rwxr-xr-x | utils/pkgbuild_bootstrap | 53 |
1 files changed, 53 insertions, 0 deletions
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 |
