From cfe9dfdd472064de5107c1d59c4897d2865083a0 Mon Sep 17 00:00:00 2001 From: John Morris Date: Fri, 10 Apr 2015 13:37:33 -0500 Subject: [PATCH] Clean up sbuild fstab configuration Addresses #9 'Can bindmounts be done better?' --- Dockerfile | 3 --- scripts/sbuild-fstab | 13 +++++++++++++ scripts/sbuild.sh | 13 +++++-------- 3 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 scripts/sbuild-fstab diff --git a/Dockerfile b/Dockerfile index 3476c16..3f6c2fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/scripts/sbuild-fstab b/scripts/sbuild-fstab new file mode 100644 index 0000000..9257c86 --- /dev/null +++ b/scripts/sbuild-fstab @@ -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) +# +# +/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 diff --git a/scripts/sbuild.sh b/scripts/sbuild.sh index a729534..365b20c 100644 --- a/scripts/sbuild.sh +++ b/scripts/sbuild.sh @@ -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() { @@ -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 \ @@ -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 @@ -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