-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
ARG ARCH | ||
ARG OS | ||
|
||
FROM $ARCH/debian:$OS | ||
|
||
ARG ARCH | ||
ARG OS | ||
ARG ASL_REPO | ||
ARG USER_ID | ||
ARG GROUP_ID | ||
|
||
RUN addgroup --gid $GROUP_ID user; exit 0 | ||
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user; exit 0 | ||
|
||
# Install build dependencies | ||
RUN apt-get update && apt-get -y install \ | ||
build-essential \ | ||
devscripts \ | ||
fakeroot \ | ||
debhelper \ | ||
automake \ | ||
autotools-dev \ | ||
pkg-config \ | ||
git \ | ||
ca-certificates \ | ||
wget \ | ||
--no-install-recommends | ||
|
||
# add the allstarlink repo for build deps | ||
RUN echo "deb https://apt.allstarlink.org/repos/$ASL_REPO $OS main" > /etc/apt/sources.list.d/allstarlink.list | ||
RUN wget -O - https://apt.allstarlink.org/repos/repo_signing.gpg | apt-key add - | ||
|
||
# Install application dependencies | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \ | ||
debhelper quilt zlib1g-dev libgsm1-dev libssl-dev libtonezone-dev libasound2-dev libpq-dev unixodbc-dev libpri-dev libvpb-dev asl-dahdi-source autotools-dev libnewt-dev libspeex-dev libspeexdsp-dev graphviz libcurl4-openssl-dev doxygen gsfonts libpopt-dev libiksemel-dev freetds-dev libvorbis-dev libsnmp-dev libcap-dev libi2c-dev libjansson-dev libusb-dev\ | ||
--no-install-recommends | ||
|
||
# Install libreadline dependency - transition to libeditreadline-dev for bullseye | ||
RUN apt-get -y install libreadline-gplv2-dev || apt-get -y install libeditreadline-dev | ||
|
||
# Import entrypoint script | ||
COPY ./entrypoint.sh /entrypoint.sh | ||
|
||
# Make Executable | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This directory is only for items that are used by | ||
the GitHub Actions / Docker-builder process and not | ||
for generalized "Docker" use. See `contrib/docker` for | ||
running Allmon3 as a container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
-c|--check-changelog) | ||
CHECK_CHANGELOG=YES | ||
shift | ||
;; | ||
-a|--architectures) | ||
ARCHS="$2" | ||
shift | ||
shift | ||
;; | ||
-t|--targets) | ||
TARGETS="$2" | ||
shift | ||
shift | ||
;; | ||
-r|--commit-versioning) | ||
COMMIT_VERSIONING=YES | ||
shift | ||
;; | ||
-o|--operating-systems) | ||
OPERATING_SYSTEMS="$2" | ||
shift | ||
shift | ||
;; | ||
-*|--*|*) | ||
echo "Unknown option $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$ARCHS" ] | ||
then | ||
ARCHS="amd64 armhf arm64" | ||
fi | ||
|
||
if [ -z "$TARGETS" ] | ||
then | ||
TARGETS="asterisk allstar" | ||
fi | ||
|
||
if [ -z "$OPERATING_SYSTEMS" ] | ||
then | ||
OPERATING_SYSTEMS="buster" | ||
fi | ||
|
||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
if [ $BRANCH == "develop" ]; then | ||
REPO_ENV="-devel" | ||
elif [ $BRANCH = "testing"]; then | ||
REPO_ENV="-testing" | ||
else | ||
REPO_ENV="" | ||
fi | ||
|
||
echo "Architectures: $ARCHS" | ||
echo "Targets: $TARGETS" | ||
echo "Operating Systems: $OPERATING_SYSTEMS" | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
PDIR=$(dirname $DIR) | ||
|
||
#get the build targets | ||
cd $PDIR | ||
BUILD_TARGETS="" | ||
ANYCOUNT=0 | ||
for t in $TARGETS; do | ||
if [ -z "$CHECK_CHANGELOG" ] || git diff --name-only HEAD HEAD~1 | grep -q $t/debian/changelog; then | ||
BUILD_TARGETS+="$t " | ||
c=$(grep "^Architecture:" $t/debian/control | egrep -v "^Architecture: ?all" | wc -l) | ||
ANYCOUNT=$((c+ANYCOUNT)) | ||
fi | ||
done | ||
BUILD_TARGETS=$(echo "$BUILD_TARGETS" | xargs) | ||
|
||
|
||
#if 'any' = 0, only run for one arch (there are no arch specific packages) | ||
if [ "$ANYCOUNT" -eq "0" ] ; then | ||
set -- $ARCHS | ||
ARCHS=$1 | ||
fi | ||
|
||
#run --build=any for following arch's after the first to prevent re-creating 'all' packages | ||
DPKG_BUILDOPTS="-b -uc -us" | ||
for A in $ARCHS; do | ||
if [ "$A" == "armhf" ]; then | ||
DA="arm32v7" | ||
elif [ "$A" == "arm64" ]; then | ||
DA="arm64v8" | ||
else | ||
DA="$A" | ||
fi | ||
for O in $OPERATING_SYSTEMS; do | ||
docker build -f $DIR/Dockerfile -t asl-asterisk_builder.$O.$A$REPO_ENV --build-arg ARCH="$DA" --build-arg OS="$O" --build-arg ASL_REPO="asl_builds${REPO_ENV}" --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) $DIR | ||
docker run -v $PDIR:/src -e DPKG_BUILDOPTS="$DPKG_BUILDOPTS" -e BUILD_TARGETS="$BUILD_TARGETS" -e COMMIT_VERSIONING="$COMMIT_VERSIONING" asl-asterisk_builder.$O.$A$REPO_ENV | ||
docker image rm --force asl-asterisk_builder.$O.$A$REPO_ENV | ||
DPKG_BUILDOPTS="--build=any -uc -us" | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
#get DPKG_BUILDOPTS from env var or use default | ||
OPTS=${DPKG_BUILDOPTS:-"-b -uc -us"} | ||
|
||
if [ -f /etc/os-release ] ; then | ||
OS_CODENAME=$(cat /etc/os-release | grep "^VERSION_CODENAME=" | sed 's/VERSION_CODENAME=\(.*\)/\1/g') | ||
elif [ command -v lsb_release ] ; then | ||
OS_CODENAME=$(lsb_release -a 2>/dev/null | grep "^Codename:" | sed 's/^Codename:\s*\(.*\)/\1/g') | ||
elif [ command -v hostnamectl ] ; then | ||
OS_CODENAME=$(hostnamectl | grep "Operating System: " | sed 's/.*Operating System: [^(]*(\([^)]*\))/\1/g') | ||
else | ||
OS_CODENAME=unknown | ||
fi | ||
|
||
for t in $BUILD_TARGETS; do | ||
echo "$t" | ||
cd /src/$t | ||
pwd | ||
COMMIT_VERSION="" | ||
if [ "${COMMIT_VERSIONING^^}" == "YES" ] ; then | ||
COMMIT_VERSION=$(git show --date=format:'%Y%m%dT%H%M%S' --pretty=format:"+git%cd.%h" --no-patch) | ||
fi | ||
if [ "$t" == "asterisk" ]; then | ||
make clean | ||
./bootstrap.sh && ./configure | ||
fi | ||
#temporarily add OS_CODENAME to the package version | ||
mv debian/changelog debian/changelog.bkp | ||
cat debian/changelog.bkp | sed "s/^\([^ ]* (\)\([^)]*\)\().*\)$/\1\2~${OS_CODENAME}${COMMIT_VERSION}\3/g" > debian/changelog | ||
debuild $OPTS | ||
mv debian/changelog.bkp debian/changelog | ||
BASENAME=$(head -1 debian/changelog | sed 's/^\([^ ]*\) (\([0-9]*:\)\?\([^)]*\)).*/\1_\3/g') | ||
cd .. | ||
mkdir -p build/$BASENAME | ||
mv *.deb build/$BASENAME | ||
mv *.build build/$BASENAME | ||
mv *.buildinfo build/$BASENAME | ||
mv *.changes build/$BASENAME | ||
done | ||
if [ "$(id -u)" -ne 0 ]; then chown -R user /src/*; fi |