Skip to content

Commit

Permalink
Add aufs on tmpfs for sbuild config
Browse files Browse the repository at this point in the history
Seems aufs isn't on 3.8 kernels, so this is untested and turned off by
default.

Addresses #9 'Do package configure and other steps with aufs (on tmpfs)'
  • Loading branch information
zultron committed Apr 13, 2015
1 parent 7a9a573 commit e80db8c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
#
Expand Down
3 changes: 3 additions & 0 deletions local-config-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
3 changes: 3 additions & 0 deletions scripts/base-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Default arch list
ARCHES="amd64 i386 armhf"

# Use aufs on tmpfs in sbuild
SBUILD_USE_AUFS="false"


####################################
# Docker configuration
Expand Down
6 changes: 1 addition & 5 deletions scripts/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 10 additions & 0 deletions scripts/sbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down
14 changes: 4 additions & 10 deletions scripts/schroot-04tmpfs
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions scripts/schroot.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ groups=root,sbuild
root-groups=root,sbuild
profile=sbuild
personality=@SCHROOT_PERSONALITY@
union-type=@SCHROOT_UNION_TYPE@

0 comments on commit e80db8c

Please sign in to comment.