summarylogtreecommitdiffstats
path: root/chroot-build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'chroot-build.sh')
-rwxr-xr-xchroot-build.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/chroot-build.sh b/chroot-build.sh
new file mode 100755
index 000000000000..db0e4e0c42b4
--- /dev/null
+++ b/chroot-build.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+## builds done in a clean chroot
+## source files taken from pkgdir/src-cache if present
+## output packages placed in pkgdir/release-pkg if present
+
+# NOTE: you can send environment variables to chroot/makepkg by stuffing them on the end of the makechrootpkg command after --
+
+#CHROOT="$HOME/work/arch-kernels/build-chroot"
+HOME="$HOME"
+
+fatal() { echo "$@" >&2; exit 1; }
+# look for a PKGBUILD
+if ! [[ -s PKGBUILD ]]; then
+ fatal "no PKGBUILD in this directory!"
+fi
+# look for valid chroot
+if ! [[ -d "${CHROOT}/root" ]]; then
+ fatal "${CHROOT}/root doesn't exist, womp womp"
+fi
+
+# if SRCDEST is empty then look for pkg src-cache/ directory and use it
+if [[ -z ${SRCDEST+x} ]] && [[ -d "$(pwd)/src-cache" ]]; then
+ export SRCDEST="$(pwd)/src-cache"
+fi
+
+# use supplied output directory or fall back to ./release-pkg/ if present
+if [[ -d "$DEST" ]]; then
+ export PKGDEST="$DEST"
+ export LOGDEST="$DEST"
+elif [[ -d "$(pwd)/release-pkg" ]]; then
+ export PKGDEST="$(pwd)/release-pkg"
+ export LOGDEST="$(pwd)/release-pkg"
+fi
+
+
+#
+# To send environment variable to a PKGBUILD call this script like this:
+# `rbuild.sh -- {any makepkg flags} VAR=VALUE VAR2=VALUE etc..`
+#
+
+makechrootpkg -c -r "${CHROOT}" "$@"