-
Notifications
You must be signed in to change notification settings - Fork 28
/
build-pkgs
executable file
·50 lines (40 loc) · 1.05 KB
/
build-pkgs
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
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -eu
rundir="$(dirname $(readlink -f $0))"
. ${rundir}/helpers/useful.sh
habs_dir=${PWD}
image_pfx="arch/habs"
shell=no
owner_uid=$(id -u)
owner_gid=$(id -g)
usage() {
cat << EOF
Usage: makeahpkg [options] -- [packages]
Run this script in your HABS dir to build the named packages.
Options:
-h This help
-u User to own the built files
-g Group to own the built files
-b <dir> Location of your HABS folder (default: .)
-s Enter a shell instead of building
EOF
exit 0
}
while getopts hu:g:a:s opt; do
case "${opt}" in
h) usage; exit 0;;
u) owner_uid=${OPTARG};;
g) owner_gid=${OPTARG};;
s) shell=yes;;
esac
done
shift $((OPTIND - 1))
image_name=${image_pfx}-build
if [[ "x${shell}" == "xno" ]]; then
docker_cmd="/usr/bin/bash /habs/helpers/buildpkgs -u ${owner_uid} -g ${owner_gid} -b /habs -- $*"
else
docker_cmd="/usr/bin/bash -l"
fi
docker run -i -t -v=${habs_dir}:/habs -u habs --env-file /etc/environment \
${image_name}:latest \
${docker_cmd}