-
Notifications
You must be signed in to change notification settings - Fork 1
/
chroot-build.sh
41 lines (32 loc) · 1.18 KB
/
chroot-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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"
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}" "$@"