From 53db2c1bdbac950923d6615f720481436c865368 Mon Sep 17 00:00:00 2001 From: Carlo Landmeter Date: Sat, 28 Dec 2019 15:09:07 +0100 Subject: [PATCH 1/2] dabuild: mount gitconfig in container abuild-keygen will look for gitconfig to fetch user and email address and set proper PACKAGER variable in abuild.conf --- dabuild.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dabuild.in b/dabuild.in index c761c7e..2f8b6f7 100755 --- a/dabuild.in +++ b/dabuild.in @@ -81,6 +81,11 @@ if [ -w "/var/cache/distfiles" ]; then ABUILD_VOLUMES="$ABUILD_VOLUMES -v /var/cache/distfiles:/var/cache/distfiles" fi +# pass over gitconfig for abuild-keygen +if [ -f "$HOME/.gitconfig" ]; then + ABUILD_VOLUMES="$ABUILD_VOLUMES -v $HOME/.gitconfig:/home/builder/.gitconfig" +fi + if [ "$DABUILD_CACHE" = "true" ]; then for v in %%ABUILD_VOLUMES%% ; do vol=abuild-$ABUILD_VERSION-$DABUILD_ARCH-${v//\//_} From 4b844ae42bbc8c77d36d03d7efbbccbcaee41fd8 Mon Sep 17 00:00:00 2001 From: Carlo Landmeter Date: Sat, 28 Dec 2019 15:19:40 +0100 Subject: [PATCH 2/2] dabuild: create mount directories with correct permissions docker creates mount points as root when source does not exists instead create them first with UID 1000 which should be the UID of the builder user inside the container. --- dabuild.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dabuild.in b/dabuild.in index 2f8b6f7..c81d9ca 100755 --- a/dabuild.in +++ b/dabuild.in @@ -58,10 +58,13 @@ else esac fi -## check $DABUILD_PACKAGES is a writable directory ABUILD_PACKAGES=${DABUILD_PACKAGES:-${PWD%/aports/*}/packages/${ABUILD_VERSION}} -mkdir -p $ABUILD_PACKAGES +# docker will create mount points as root if not available so create them first +# use uid 1000 as this is the uid of the builder user in the container +install -d -o 1000 -g 1000 "$ABUILD_PACKAGES" "$HOME"/.abuild + +## check $DABUILD_PACKAGES is a writable directory if [ ! \( -d "$ABUILD_PACKAGES" -a -w "$ABUILD_PACKAGES" \) ]; then die "Error: invalid or unwritable packages directory specified!" \ "ABUILD_PACKAGES = '$ABUILD_PACKAGES'" \