diff --git a/Dockerfile b/Dockerfile index 3f6c2fe..d6f04bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,8 @@ RUN echo "APT::Install-Recommends \"0\";\nAPT::Install-Suggests \"0\";" \ RUN apt-get install -y build-essential fakeroot devscripts # - cross-build tools RUN apt-get install -y xdeb sbuild pdebuild-cross +# - aufs tools for sbuild +RUN apt-get install -y aufs-tools # - git RUN apt-get install -y git ca-certificates openssh-client # - reprepro @@ -32,11 +34,6 @@ RUN wget -O - -q http://archive.raspbian.org/raspbian.public.key | \ apt-key --keyring /usr/share/keyrings/debian-archive-keyring.gpg \ add - -############################ -# Sbuild configuration: -# - aufs on tmpfs config -ADD schroot-04tmpfs /etc/schroot/setup.d/04tmpfs - ############################ # Monkey patches # diff --git a/local-config-example.sh b/local-config-example.sh index a7f77ff..b6c4a92 100644 --- a/local-config-example.sh +++ b/local-config-example.sh @@ -23,6 +23,9 @@ # Add repo to distro #DISTRO_REPOS[jessie]+=" dovetail-automata" +# Use aufs on tmpfs in sbuild +#SBUILD_USE_AUFS="true" + # Use http/https proxy for package downloads. Especially useful for # caching packages between removing and rebuilding schroots. # diff --git a/scripts/base-config.sh b/scripts/base-config.sh index 6cfad3f..5146392 100644 --- a/scripts/base-config.sh +++ b/scripts/base-config.sh @@ -2,6 +2,9 @@ # Default arch list ARCHES="amd64 i386 armhf" +# Use aufs on tmpfs in sbuild +SBUILD_USE_AUFS="false" + #################################### # Docker configuration diff --git a/scripts/docker.sh b/scripts/docker.sh index 0dc1fd8..a6871b1 100644 --- a/scripts/docker.sh +++ b/scripts/docker.sh @@ -21,11 +21,7 @@ docker_set_user() { docker_build() { msg "Building Docker container image '$DOCKER_IMAGE' from 'Dockerfile'" - mkdir -p docker - cp $SCRIPTS_DIR/schroot-04tmpfs docker - cp Dockerfile docker - run docker build -t $DOCKER_IMAGE docker - rm -rf docker + run bash -c "docker build -t $DOCKER_IMAGE - < Dockerfile" } docker_run() { diff --git a/scripts/sbuild.sh b/scripts/sbuild.sh index d654a9d..8703a1a 100644 --- a/scripts/sbuild.sh +++ b/scripts/sbuild.sh @@ -95,10 +95,20 @@ sbuild_install_config() { local BUILD_ARCH=$(arch_build $DISTRO $HOST_ARCH) debug " Installing schroot config: $DISTRO-$BUILD_ARCH" + if $SBUILD_USE_AUFS; then + debug " Installing aufs on tmpfs config" + run install -m 755 $SCRIPTS_DIR/schroot-04tmpfs \ + /etc/schroot/setup.d/04tmpfs + SCHROOT_UNION_TYPE="aufs" + else + SCHROOT_UNION_TYPE="none" + fi + run bash -c "sed $SCRIPTS_DIR/schroot.conf \\ -e 's/@DISTRO@/$DISTRO/g' \\ -e 's/@BUILD_ARCH@/$BUILD_ARCH/g' \\ -e 's/@SCHROOT_PERSONALITY@/$SCHROOT_PERSONALITY/g' \\ + -e 's/@SCHROOT_UNION_TYPE@/$SCHROOT_UNION_TYPE/g' \\ > /etc/schroot/chroot.d/$SBUILD_CHROOT" debug " Contents of /etc/schroot/chroot.d/$SBUILD_CHROOT:" diff --git a/scripts/schroot-04tmpfs b/scripts/schroot-04tmpfs index 0abb856..c3f17c0 100755 --- a/scripts/schroot-04tmpfs +++ b/scripts/schroot-04tmpfs @@ -5,16 +5,10 @@ # # Copied into /etc/schroot/setup.d/04tmpfs -. "$SETUP_DATA_DIR/common-data" -. "$SETUP_DATA_DIR/common-functions" -. "$SETUP_DATA_DIR/common-config" - +. "$SETUP_DATA_DIR/common-data" # $STAGE +OVERLAY=/var/lib/schroot/union/overlay case $STAGE in - setup-start|setup-recover) - mount -t tmpfs overlay /var/lib/schroot/union/overlay - ;; - setup-stop) - mount -t tmpfs overlay /var/lib/schroot/union/overlay - ;; + setup-start|setup-recover) mount -t tmpfs overlay $OVERLAY ;; + setup-stop) umount -f $OVERLAY ;; esac diff --git a/scripts/schroot.conf b/scripts/schroot.conf index 8a99ff6..1165ab0 100644 --- a/scripts/schroot.conf +++ b/scripts/schroot.conf @@ -6,3 +6,4 @@ groups=root,sbuild root-groups=root,sbuild profile=sbuild personality=@SCHROOT_PERSONALITY@ +union-type=@SCHROOT_UNION_TYPE@