Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Rootless build container #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions build_all_targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ FEED="$1"
OUTPUT_DIR="$2"
BUILD_PARALLEL="$3"

# check for dependencies
DEPS="docker-hub docker"

for package in $DEPS; do
which $package > /dev/null
if [ $? != 0 ]; then
echo "Dependencies: $DEPS"
echo "Package $package is not installed."
echo "Exiting..."
exit 1
fi
done
which podman >/dev/null || (echo "Please install Podman" && exit 1)

# download freifunk_release file from repo and determine sdk-version for feed
BRANCH=$(echo "$FEED" | cut -d'^' -f 2)
Expand Down
37 changes: 16 additions & 21 deletions build_feed
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
set -ex

if [ "$1" == "incontainer" ]; then
cd /home/build/openwrt

INSTR_SET="$(ls build_dir | awk -F'-|(_musl)' '{print $2}')"
if [ -d "bin/packages/$INSTR_SET" ]
then
echo "$INSTR_SET was built before. Skip";
exit 0;
fi

echo "$FEED_LINE" >> feeds.conf.default
FEED_NAME=$(echo $FEED_LINE | awk '{print $2}')

logfile="bin/packages/$INSTR_SET/$FEED_NAME/build.log"
mkdir -p "$(dirname "$logfile")"
Expand All @@ -33,27 +37,18 @@ else
FEED_LINE="$2"
OUTPUT_DIR="$3"

FEED_NAME=$(echo $FEED_LINE | awk '{print $2}')
IMAGE="openwrtorg/sdk:$SDK_TAG"
# Parallel build on buildbot needs to be performed without -i. Otherwise it won't work.
[ ! -n "$4" ] && ARGS="-it"

IMAGE="docker.io/openwrtorg/sdk:$SDK_TAG"

docker pull "$IMAGE"
podman pull "$IMAGE"
mkdir -p "$OUTPUT_DIR"
if [ -n "$4" ]; then # Parallel build on buildbot needs to be performed without -i. Otherwise it won't work.
pktpls marked this conversation as resolved.
Show resolved Hide resolved
docker run --rm \
-v "$(pwd)/build_feed:/home/build/openwrt/build_feed" \
-v "$OUTPUT_DIR/:/home/build/openwrt/bin" \
-e "FEED_LINE=$FEED_LINE" \
-e "FEED_NAME=$FEED_NAME" \
"$IMAGE" \
./build_feed incontainer
else
docker run -it --rm \
-v "$(pwd)/build_feed:/home/build/openwrt/build_feed" \
-v "$OUTPUT_DIR/:/home/build/openwrt/bin" \
-e "FEED_LINE=$FEED_LINE" \
-e "FEED_NAME=$FEED_NAME" \
"$IMAGE" \
./build_feed incontainer
fi
podman run $ARGS --rm \
--userns=keep-id \
-v "$(pwd):/home/build/repobuilder:ro,Z" \
-v "$OUTPUT_DIR/:/home/build/openwrt/bin" \
-e "FEED_LINE=$FEED_LINE" \
"$IMAGE" \
/home/build/repobuilder/build_feed incontainer
Akira25 marked this conversation as resolved.
Show resolved Hide resolved
fi