Commit 716a4496 authored by Carlo Landmeter's avatar Carlo Landmeter
Browse files

rename alpine based variables

parent 5ff1d53b
...@@ -30,12 +30,18 @@ if [ "${PWD%*/aports/*}" = "$PWD" ]; then ...@@ -30,12 +30,18 @@ if [ "${PWD%*/aports/*}" = "$PWD" ]; then
fi fi
## allow setting of arch by env variable ## allow setting of arch by env variable
[ ! "$DABUILD_ARCH" ] && DABUILD_ARCH=$(uname -m) if [ "$DABUILD_ARCH" ]; then
case "$DABUILD_ARCH" in ALPINE_ARCH=$DABUILD_ARCH
x86|x86_64|aarch64|armhf|armv7 ) ;; else
ALPINE_ARCH=$(uname -m)
fi
case "$ALPINE_ARCH" in
x86|x86_64|aarch64|armhf|armv7);;
armv8l|arm) ALPINE_ARCH=armv7;;
* ) die "Unsupported arch \"$DABUILD_ARCH\" detected." \ * ) die "Unsupported arch \"$DABUILD_ARCH\" detected." \
"Expected one of: x86|x86_64|aarch64|armhf|armv7" \ "Expected one of: x86|x86_64|aarch64|armhf|armv7" \
"You may force it setting DABUILD_ARCH=\"xxx\" in invocation";; "You may force it setting DABUILD_ARCH=\"xxx\" in invocation";;
esac esac
## allow setting of `docker` command by env variable ## allow setting of `docker` command by env variable
...@@ -50,23 +56,19 @@ _DOCKER=$DABUILD_DOCKER ...@@ -50,23 +56,19 @@ _DOCKER=$DABUILD_DOCKER
## use branch to figure out most appropriate alpine version ## use branch to figure out most appropriate alpine version
if [ "$DABUILD_VERSION" ]; then if [ "$DABUILD_VERSION" ]; then
ABUILD_VERSION=$DABUILD_VERSION ALPINE_RELEASE=$DABUILD_VERSION
else else
APORTS_BRANCH=$(git status | head -1) APORTS_BRANCH=$(git status | head -1)
APORTS_BRANCH="${APORTS_BRANCH##*[ /]}" APORTS_BRANCH="${APORTS_BRANCH##*[ /]}"
case $APORTS_BRANCH in case $APORTS_BRANCH in
[[:digit:]].[[:digit:]]-stable ) [[:digit:]].[[:digit:]]-stable)
ABUILD_VERSION=${APORTS_BRANCH%-stable} ALPINE_RELEASE=${APORTS_BRANCH%-stable};;
;; *) ALPINE_RELEASE=edge;;
* )
ABUILD_VERSION=edge
;;
esac esac
fi fi
## check $DABUILD_PACKAGES is a writable directory ## check $DABUILD_PACKAGES is a writable directory
ABUILD_PACKAGES=${DABUILD_PACKAGES:-${PWD%/aports/*}/packages/${ABUILD_VERSION}} ABUILD_PACKAGES=${DABUILD_PACKAGES:-${PWD%/aports/*}/packages/${ALPINE_RELEASE}}
mkdir -p $ABUILD_PACKAGES mkdir -p $ABUILD_PACKAGES
if [ ! \( -d "$ABUILD_PACKAGES" -a -w "$ABUILD_PACKAGES" \) ]; then if [ ! \( -d "$ABUILD_PACKAGES" -a -w "$ABUILD_PACKAGES" \) ]; then
...@@ -94,7 +96,7 @@ fi ...@@ -94,7 +96,7 @@ fi
setup_named_volume() { setup_named_volume() {
local name=$1 dest=$2 single=$3 local name=$1 dest=$2 single=$3
local volume="dabuild-$name-$ALPINE_RELEASE-$DABUILD_ARCH" local volume="dabuild-$name-$ALPINE_RELEASE-$ALPINE_ARCH"
[ "$single" = "true" ] && volume="dabuild-$name" [ "$single" = "true" ] && volume="dabuild-$name"
ABUILD_VOLUMES="$ABUILD_VOLUMES -v $volume:$dest" ABUILD_VOLUMES="$ABUILD_VOLUMES -v $volume:$dest"
} }
...@@ -122,4 +124,4 @@ $_DOCKER run --tty --interactive \ ...@@ -122,4 +124,4 @@ $_DOCKER run --tty --interactive \
$DABUILD_ENV \ $DABUILD_ENV \
$DABUILD_ARGS \ $DABUILD_ARGS \
--workdir /home/builder/aports/${PWD#*/aports/} \ --workdir /home/builder/aports/${PWD#*/aports/} \
%%ABUILD_IMAGE%%:$ABUILD_VERSION-$DABUILD_ARCH "$@" %%ABUILD_IMAGE%%:$ALPINE_RELEASE-$ALPINE_ARCH "$@"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment