Skip to content

Commit

Permalink
Clean up sbuild fstab configuration
Browse files Browse the repository at this point in the history
Addresses #9 'Can bindmounts be done better?'
  • Loading branch information
zultron committed Apr 10, 2015
1 parent 269e612 commit cfe9dfd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ RUN wget -O - -q http://archive.raspbian.org/raspbian.public.key | \

############################
# Sbuild configuration:
# - bind mounts
RUN echo "/srv\t\t/srv\t\tnone\trw,bind\t\t0\t0" \
>> /etc/schroot/default/fstab
# - aufs on tmpfs config
ADD schroot-04tmpfs /etc/schroot/setup.d/04tmpfs

Expand Down
13 changes: 13 additions & 0 deletions scripts/sbuild-fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# fstab: static file system information for chroots. -*-conf-*-
# Note that the mount point will be prefixed by the chroot path
# (CHROOT_PATH)
#
# <file system> <mount point> <type> <options> <dump> <pass>
/proc /proc none rw,bind 0 0
/sys /sys none rw,bind 0 0
/dev /dev none rw,bind 0 0
/dev/pts /dev/pts none rw,bind 0 0
/home /home none rw,bind 0 0
/tmp /tmp none rw,bind 0 0
# The main script/build directory
/srv /srv none rw,bind 0 0
13 changes: 5 additions & 8 deletions scripts/sbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ sbuild_install_sbuild_conf() {
-e "s/@/\\\\@/g"
debug " Contents of /etc/sbuild/sbuild.conf:"
run_debug grep -v -e '^$' -e '^#' /etc/sbuild/sbuild.conf

debug " Installing fstab into /etc/schroot/sbuild/fstab"
run cp $SCRIPTS_DIR/sbuild-fstab /etc/schroot/sbuild/fstab
}

sbuild_chroot_save_keys() {
Expand Down Expand Up @@ -107,14 +110,6 @@ sbuild_save_config() {
run_user cp $SBUILD_CHROOT_GEN \
$CONFIG_DIR/chroot.d/$SBUILD_CHROOT

if ! grep -q setup.fstab $CONFIG_DIR/chroot.d/$SBUILD_CHROOT; then
debug " Adding fstab setting to schroot config"
run_user sed -i $CONFIG_DIR/chroot.d/$SBUILD_CHROOT \
-e '"$ a setup.fstab=default/fstab"'
else
debug " (Found fstab setting in schroot config)"
fi

if test $DISTRO != $CODENAME; then
debug " Patching schroot config name"
run sed -i $CONFIG_DIR/chroot.d/$SBUILD_CHROOT \
Expand Down Expand Up @@ -225,6 +220,7 @@ sbuild_chroot_setup() {

sbuild_configure_package() {
sbuild_chroot_init
sbuild_install_sbuild_conf
sbuild_install_config

# FIXME run with union-type=aufs in schroot.conf
Expand Down Expand Up @@ -276,6 +272,7 @@ sbuild_shell() {
msg "Starting shell in sbuild chroot $SBUILD_CHROOT"

sbuild_chroot_init
sbuild_install_sbuild_conf
sbuild_install_config
if test $DOCKER_UID = 0; then
run sbuild-shell $SBUILD_CHROOT
Expand Down

0 comments on commit cfe9dfd

Please sign in to comment.