aboutsummaryrefslogtreecommitdiffstats
path: root/dabuild.in
diff options
context:
space:
mode:
Diffstat (limited to 'dabuild.in')
-rwxr-xr-xdabuild.in58
1 files changed, 29 insertions, 29 deletions
diff --git a/dabuild.in b/dabuild.in
index de5e849..3e389c5 100755
--- a/dabuild.in
+++ b/dabuild.in
@@ -26,48 +26,46 @@ fi
DABUILD_ENV=
die () {
- printf >&2 "%s\n" "$@"
+ printf >&2 "%s\\n" "$@"
exit 1
}
## debug
if [ "$DABUILD_DEBUG" = "true" ]; then
- set -x
- PS4='$LINENO: '
- DABUILD_ENV="$DABUILD_ENV -e DABUILD_DEBUG=true"
+ set -x
+ PS4='$LINENO: '
+ DABUILD_ENV="$DABUILD_ENV -e DABUILD_DEBUG=true"
fi
## check running from within an `aports` tree
if [ "${PWD%*/aports/*}" = "$PWD" ]; then
- die "Error: expecting to be run from within an aports tree!" \
- "Could not find '/aports/' in the current path: $PWD"
- exit 1
+ die "Error: expecting to be run from within an aports tree!" \
+ "Could not find '/aports/' in the current path: $PWD"
fi
case "$DABUILD_ARCH" in
- x86|x86_64|aarch64|armhf|armv7);;
- armv8l|arm) DABUILD_ARCH=armv7;;
- * ) die "Unsupported arch \"$DABUILD_ARCH\" detected." \
- "Expected one of: x86|x86_64|aarch64|armhf|armv7" \
- "You may force it setting DABUILD_ARCH=\"xxx\" in invocation";;
+ x86|x86_64|aarch64|armhf|armv7);;
+ armv8l|arm) DABUILD_ARCH=armv7;;
+ *) die "Unsupported arch \"$DABUILD_ARCH\" detected." \
+ "Expected one of: x86|x86_64|aarch64|armhf|armv7" \
+ "You may force it setting DABUILD_ARCH=\"xxx\" in invocation";;
esac
## allow setting of `docker` command by env variable
case "$DABUILD_DOCKER" in
- podman|docker ) ;;
- * ) die "Unsupported docker CLI replacement \"$DABUILD_DOCKER\" detected." \
- "Expected one of: docker|podman"
- ;;
+ podman|docker) ;;
+ *) die "Unsupported docker CLI replacement \"$DABUILD_DOCKER\" detected." \
+ "Expected one of: docker|podman";;
esac
_DOCKER=$DABUILD_DOCKER
## use branch to figure out most appropriate alpine version
if [ ! "$DABUILD_VERSION" ]; then
- APORTS_BRANCH=$(git symbolic-ref --short -q HEAD)
- case $APORTS_BRANCH in
- *-stable) DABUILD_VERSION=${APORTS_BRANCH%-stable};;
- *) DABUILD_VERSION=edge;;
- esac
+ APORTS_BRANCH=$(git symbolic-ref --short -q HEAD)
+ case $APORTS_BRANCH in
+ *-stable) DABUILD_VERSION=${APORTS_BRANCH%-stable};;
+ *) DABUILD_VERSION=edge;;
+ esac
fi
# set packages dir based on alpine release
@@ -75,11 +73,12 @@ DABUILD_PACKAGES="$DABUILD_PACKAGES/$DABUILD_VERSION"
## setup volumes; use named volumes as cache if desired
ABUILD_VOLUMES="-v ${PWD%/aports/*}/aports:/home/builder/aports \
- -v ${DABUILD_PACKAGES}:/home/builder/packages"
+ -v ${DABUILD_PACKAGES}:/home/builder/packages"
# pass over gitconfig for abuild-keygen
if [ -f "$HOME/.gitconfig" ]; then
- ABUILD_VOLUMES="$ABUILD_VOLUMES -v $HOME/.gitconfig:/home/builder/.gitconfig"
+ ABUILD_VOLUMES="$ABUILD_VOLUMES \
+ -v $HOME/.gitconfig:/home/builder/.gitconfig"
fi
setup_named_volume() {
@@ -100,7 +99,8 @@ fi
# use a bind or named volume for distfiles.
case $DABUILD_DISTFILES in
- */*) ABUILD_VOLUMES="$ABUILD_VOLUMES -v $DABUILD_DISTFILES:/var/cache/distfiles";;
+ */*) ABUILD_VOLUMES="$ABUILD_VOLUMES \
+ -v $DABUILD_DISTFILES:/var/cache/distfiles";;
true) setup_named_volume distfiles "/var/cache/distfiles" true;;
*) ;;
esac
@@ -113,8 +113,8 @@ fi
## go!
$_DOCKER run --tty --interactive \
- $ABUILD_VOLUMES \
- $DABUILD_ENV \
- $DABUILD_ARGS \
- --workdir /home/builder/aports/${PWD#*/aports/} \
- %%ABUILD_IMAGE%%:$DABUILD_VERSION-$DABUILD_ARCH "$@"
+ $ABUILD_VOLUMES \
+ $DABUILD_ENV \
+ $DABUILD_ARGS \
+ --workdir /home/builder/aports/"${PWD#*/aports/}" \
+ %%ABUILD_IMAGE%%:$DABUILD_VERSION-$DABUILD_ARCH "$@"