2022-04-04 18:15:05 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Helper script to build ACRN with docker
|
|
|
|
# This also includes building packages required for ACRN build or runtime
|
|
|
|
|
|
|
|
VENDOR=${VENDOR:-debian}
|
|
|
|
DISTRO=${DISTRO:-stable}
|
|
|
|
|
|
|
|
TOPDIR=$(git rev-parse --show-toplevel)
|
|
|
|
DOCKER=$(which docker)
|
|
|
|
|
|
|
|
if [ -z "${TOPDIR}" ]; then
|
|
|
|
echo "Run $0 from inside git repository!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${DOCKER}" ]; then
|
|
|
|
echo "Cannot find docker binary, please install!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pushd ${TOPDIR} >/dev/null
|
|
|
|
|
|
|
|
if [ ! -f debian/docker/Dockerfile ]; then
|
|
|
|
echo "No Dockerfile available!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -e
|
|
|
|
# create docker image for Debian package build
|
2022-05-03 23:35:39 +08:00
|
|
|
cp debian/control debian/docker/debian-control-${VENDOR}-${DISTRO}
|
2022-04-04 18:15:05 +08:00
|
|
|
${DOCKER} build \
|
|
|
|
-f debian/docker/Dockerfile \
|
|
|
|
--build-arg DISTRO=${DISTRO} \
|
|
|
|
--build-arg VENDOR=${VENDOR} \
|
|
|
|
-t acrn-pkg-builder:${DISTRO} debian/docker
|
2022-05-03 23:35:39 +08:00
|
|
|
rm debian/docker/debian-control-${VENDOR}-${DISTRO}
|
2022-04-04 18:15:05 +08:00
|
|
|
|
|
|
|
# build ACRN packages
|
|
|
|
${DOCKER} run \
|
|
|
|
--rm \
|
|
|
|
-e UID=$(id -u) \
|
|
|
|
-e GID=$(id -g) \
|
2022-04-27 16:07:27 +08:00
|
|
|
-v $(pwd):/source --entrypoint /usr/local/bin/debian-pkg-build.sh acrn-pkg-builder:${DISTRO} -F --no-sign --git-export-dir=build/${DISTRO} "$@"
|
|
|
|
|
|
|
|
# create local apt repository
|
|
|
|
${DOCKER} run \
|
|
|
|
--rm \
|
|
|
|
-e UID=$(id -u) \
|
|
|
|
-e GID=$(id -g) \
|
|
|
|
-v $(pwd):/source --entrypoint create-apt-repo.sh acrn-pkg-builder:${DISTRO} build/${DISTRO}
|
2022-04-04 18:15:05 +08:00
|
|
|
|
|
|
|
popd >/dev/null
|