Fix permission issues
Use local and container path variables
This commit is contained in:
parent
b2f83fcc9c
commit
92b5ae82c8
@ -13,6 +13,11 @@ COPY input-sources/ /home/debian/input-sources/
|
||||
COPY bin/build-bitcoin.sh /home/debian/
|
||||
COPY bin/sign.sh /home/debian/
|
||||
|
||||
COPY gitian-gbuild.patch /home/debian/
|
||||
|
||||
## patch to not attempt removal of build directory (will be a volume)
|
||||
RUN cd gitian-builder && patch -p1 < ../gitian-gbuild.patch && rm ../gitian-gbuild.patch
|
||||
|
||||
WORKDIR /home/debian
|
||||
|
||||
RUN chown -R debian.debian input-sources build-bitcoin.sh sign.sh
|
||||
|
13
docker/gitian-bitcoin-host/gitian-gbuild.patch
Normal file
13
docker/gitian-bitcoin-host/gitian-gbuild.patch
Normal file
@ -0,0 +1,13 @@
|
||||
--- a/bin/gbuild 2015-01-14 10:25:27.275143892 +0100
|
||||
+++ b/bin/gbuild 2015-01-14 10:25:56.171144093 +0100
|
||||
@@ -182,8 +182,8 @@
|
||||
cache_dir = 'cache'
|
||||
enable_cache = build_desc["enable_cache"]
|
||||
|
||||
-FileUtils.rm_rf(build_dir)
|
||||
-FileUtils.mkdir(build_dir)
|
||||
+## build dir is cleaned up outside container running gitian-builder
|
||||
+FileUtils.mkdir_p(build_dir)
|
||||
FileUtils.mkdir_p(result_dir)
|
||||
|
||||
package_name = build_desc["name"] or raise "must supply name"
|
@ -40,21 +40,27 @@ fi
|
||||
set -o pipefail && \
|
||||
MOSTRECENT="$(curl -s https://api.github.com/repos/bitcoin/bitcoin/tags | jq -r '.[0].name' | awk '{ print substr($0, 2) }')" || exit $?
|
||||
|
||||
## volumes inside container
|
||||
SRCV="/home/debian/gitian-builder/cache/common"
|
||||
DSTV="/home/debian/gitian-build/build/out"
|
||||
## volumes inside container that are provided externally (bind mount)
|
||||
LSOURCE="$SCRIPTS/gitian-cache"
|
||||
LDEST="$SCRIPTS/gitian-built"
|
||||
CSOURCE="/home/debian/gitian-builder/cache"
|
||||
CDEST="/home/debian/gitian-builder/build"
|
||||
|
||||
## run all necessary containers, detached
|
||||
## setup proper volumes for input/output collection
|
||||
function run_all() {
|
||||
local OS
|
||||
|
||||
mkdir -p "$SCRIPTS/cache" "$SCRIPTS/built" && \
|
||||
chown 1000.1000 "$SCRIPTS/cache" "$SCRIPTS/built" || return $?
|
||||
for OS in "$@"; do
|
||||
mkdir -p "$LSOURCE/${OS}" && \
|
||||
rm -rf "$LDEST" && \
|
||||
mkdir -p "$LDEST" || return $?
|
||||
done
|
||||
mkdir -p "$LSOURCE" "$LDEST" && \
|
||||
chown -R 1000.1000 "$LDEST" "$LSOURCE" || return $?
|
||||
|
||||
for OS in "$@"; do
|
||||
mkdir -p "$SCRIPTS/cache/${OS}-inputs" "$SCRIPTS/built/${OS}" && \
|
||||
echo "docker run -d --privileged -v $SCRIPTS/cache/${OS}-inputs:${SRCV} -v $SCRIPTS/built/${OS}:${DSTV} gdm85/gitian-bitcoin-host" || return $?
|
||||
echo "docker run -d --privileged -v $LSOURCE/${OS}:${CSOURCE} -v $LDEST/${OS}:$CDEST gdm85/gitian-bitcoin-host" || return $?
|
||||
done | $PARALLEL
|
||||
}
|
||||
|
||||
@ -72,7 +78,7 @@ function build_all() {
|
||||
OS=${OSES[$I]}
|
||||
|
||||
## first, fix rights of mounted volumes
|
||||
# echo -n "docker exec $CID chown -R debian.debian '$SRCV' '$DSTV' && " && \
|
||||
echo -n "docker exec $CID chown -R debian.debian '$CSOURCE' '$CDEST' && " && \
|
||||
echo "docker exec $CID su -c 'cd /home/debian && source .bash_profile && ./build-bitcoin.sh $MOSTRECENT ${OS}' debian"
|
||||
let I+=1
|
||||
done | $PARALLEL
|
||||
@ -84,6 +90,8 @@ build_all $CREATED $@ && \
|
||||
echo "Build results are available in '$SCRIPTS/built/'"
|
||||
RV=$?
|
||||
|
||||
exit $RV
|
||||
|
||||
## cleanup
|
||||
echo "Cleaning up created containers..."
|
||||
for CID in $CREATED; do
|
||||
|
Loading…
Reference in New Issue
Block a user