Skip to content

Commit

Permalink
added
Browse files Browse the repository at this point in the history
  • Loading branch information
jxmx committed Mar 30, 2024
1 parent 76a8656 commit ccf6879
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
91 changes: 91 additions & 0 deletions builder/dockerbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

set -e
set -x

while [[ $# -gt 0 ]]; do
case $1 in
-a|--architecture)
ARCH_ASK="$2"
shift
shift
;;
-o|--operating-systems)
OPERATING_SYSTEMS="$2"
shift
shift
;;
--gh-rel)
GH_REL="$2"
shift
shift
;;
-*|--*|*)
echo "Unknown option $1"
shift
shift
;;
esac
done

if [ -z "$ARCH_ASK" ]
then
ARCH="all"
fi

case $ARCH_ASK in
arm64)
ARCH=arm64v8
;;
armhf)
ARCH=arm32v7
;;
*)
ARCH=$ARCH_ASK
;;
esac

if [ -z "$OPERATING_SYSTEMS" ]
then
OPERATING_SYSTEMS="bookworm"
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

## Need to clean this up to be more elegant
echo "Architectures: $ARCH"
echo "Targets: $TARGETS"
echo "Operating Systems: $OPERATING_SYSTEMS"
echo "PWD: $(pwd)"
echo "BS: ${BASH_SOURCE[0]}"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "DIR: ${DIR}"
PDIR=$(dirname $DIR)
echo "PDIR: ${PDIR}"
ALL_PKG_ROOT=$(dirname ${PDIR})
echo "ALL_PKG_ROOT: ${ALL_PKG_ROOT}"
echo "GH_REL: ${GH_REL}"

D_TAG="asl3-update-nodelist_builder.${OPERATING_SYSTEMS}.${ARCH}${REPO_ENV}"

docker build -f $DIR/Dockerfile -t $D_TAG \
--build-arg ARCH="$ARCH" \
--build-arg OS="$OPERATING_SYSTEMS" \
--build-arg USER_ID=$(id -u) \
--build-arg GROUP_ID=$(id -g) \
$DIR

docker run -v $ALL_PKG_ROOT:/build $D_TAG

DEBIAN_FRONTEND=noninteractive apt-get -y install gh
gh release upload -R AllStarLink/asl3-update-nodelist $GH_REL $ALL_PKG_ROOT/_debs/*.deb

docker image rm --force $D_TAG
24 changes: 24 additions & 0 deletions builder/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e
set -x

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

echo "OS_CODENAME: ${OS_CODENAME}"

cd /build

export EMAIL="AllStarLink <autobuild@allstarlink.org>"
pushd asl3-update-nodelist
make deb
popd
mkdir _debs
mv *.deb _debs/

0 comments on commit ccf6879

Please sign in to comment.