blob: 20839eb6eea966fe0d8fc516ee50a05cebb39897 (
plain)
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
|
#!/bin/sh
set -e
## debug
if [ "$DOCKER_ABUILD_DEBUG" = "true" ]; then
set -x
PS4='$LINENO: '
fi
if [ "${PWD%*/aports*}" = "$PWD" ]; then
echo "Error: expecting to be run from within an aports tree!"
echo "Could not find '/aports' in the current path ($PWD)"
exit 1
fi
# use branch to figure out most appropriate alpine version
if [ -z "$DOCKER_ABUILD_VERSION" ]; then
_ABUILD_BRANCH=$(git status | head -1)
_ABUILD_BRANCH="${_ABUILD_BRANCH##*[ /]}"
_ABUILD_BRANCH="${_ABUILD_BRANCH%-stable}"
case $_ABUILD_BRANCH in
[[:digit:]].[[:digit:]] )
_ALPINE_VERSION=$_ABUILD_BRANCH
;;
* )
_ALPINE_VERSION=edge
;;
esac
else
_ALPINE_VERSION=$DOCKER_ABUILD_VERSION
fi
_ABUILD_DIR=${HOME}/.abuild/${_ALPINE_VERSION}
_ABUILD_VOLUMES="
-v ${HOME}/.abuild:/home/builder/.abuild
-v ${_ABUILD_DIR}/.cache:/var/cache/apk
-v ${_ABUILD_DIR}/.distfiles:/var/cache/distfiles
-v ${PWD%/aports*}/aports:/home/builder/aports
-v ${PWD%/aports*}/packages/${_ALPINE_VERSION}:/home/builder/packages
"
DOCKER="docker run -ti $_ABUILD_VOLUMES -e DOCKER_ABUILD_DEBUG $_ABUILD_ARGS"
$DOCKER --workdir /home/builder/aports/${PWD#*/aports} mor1/abuild:$_ALPINE_VERSION "$@"
|