[Buildd-tools-devel] Bug#475515: Bug#475515: schroot: Patch to allow loop mounts
Roger Leigh
rleigh at whinlatter.ukfsn.org
Tue Jul 1 21:50:43 UTC 2008
tags 475515 + confirmed fixed-upstream patch pending
thanks
Ionut Ciocirlan <ionut.ciocirlan at gmail.com> writes:
> I really wanted to use a loop mount without doing losetup before, so
> this simple patch does it.
>
> The downside is it doesn't lock the device, but then again you can loop
> mount the same file multiple times anyway, so it's rather irrelevant.
Yes.
> A potential improvement could be grep-ing for something like -o\s.*\bloop\b
> in $CHROOT_MOUNT_OPTIONS under 00check if the "device" is a file, but
> that's not really necessary either since mount will fail and error nicely
> with "not a block device (maybe try `-o loop'?)".
I implemented the following over the last two nights (your patch
arrived after I was about half-way through!). This creates a new
"loopback" chroot type, which uses -o loop transparently, solving all
the problems. Use exactly as for "block-device", but use
type=loopback and file=/path/to/loopback-file instead of
device=/path/to/device (I'll document it next).
% schroot -i -c sid-loop
─── Chroot ───
Name sid-loop
Description Debian sid (unstable) loopback mount
Type loopback
^^^^^^^^
Priority 3
Users
Groups sbuild root
Root Users
Root Groups root sbuild
Aliases sid-looptest
Environment Filter ^(BASH_ENV|CDPATH|ENV|HOSTALIASES|IFS|KRB5_CONFIG|KRBCONFDIR|KRBTKFILE|KRB_CONF|LD_.*|LOCALDOMAIN|NLSPATH|PATH_LOCALE|RES_OPTIONS|TERMINFO|TERMINFO_DIRS|TERMPATH)$
Run Setup Scripts true
Run Execution Scripts true
Script Configuration script-defaults
Session Managed false
Session Cloned false
Session Purged false
Personality linux
Mount Device /home/rleigh/sid-loop
^^^^^^^^^^^^^^^^^^^^^
Mount Options -o noatime,async,user_xattr
File /home/rleigh/sid-loop
^^^^^^^^^^^^^^^^^^^^^
% schroot --config -c sid-loop
# schroot configuration generated by schroot 1.3.0 on 01 Jul 2008
[sid-loop]
active=false
aliases=sid-looptest
command-prefix=
description=Debian sid (unstable) loopback mount
environment-filter=^(BASH_ENV|CDPATH|ENV|HOSTALIASES|IFS|KRB5_CONFIG|KRBCONFDIR|KRBTKFILE|KRB_CONF|LD_.*|LOCALDOMAIN|NLSPATH|PATH_LOCALE|RES_OPTIONS|TERMINFO|TERMINFO_DIRS|TERMPATH)$
file=/home/rleigh/sid-loop
^^^^^^^^^^^^^^^^^^^^^^^^^^
groups=sbuild,root
location=
mount-options=-o noatime,async,user_xattr
personality=linux
priority=3
root-groups=root,sbuild
root-users=
run-exec-scripts=true
run-setup-scripts=true
script-config=script-defaults
type=loopback
^^^^^^^^^^^^^
users=
diff --git a/bin/schroot/setup/00check b/bin/schroot/setup/00check
index 77271be..62447db 100755
--- a/bin/schroot/setup/00check
+++ b/bin/schroot/setup/00check
@@ -71,7 +71,7 @@ if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then
exit 1
fi
;;
- file)
+ file | loopback)
if [ ! -f "$CHROOT_FILE" ]; then
echo "File '$CHROOT_FILE' does not exist"
exit 1
diff --git a/bin/schroot/setup/10mount b/bin/schroot/setup/10mount
index 4b42db7..367ed86 100755
--- a/bin/schroot/setup/10mount
+++ b/bin/schroot/setup/10mount
@@ -70,7 +70,7 @@ if [ "$AUTH_VERBOSITY" = "verbose" ]; then
# FSCK_VERBOSE="-V"
fi
-if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "loopback" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
if [ "$CHROOT_TYPE" = "plain" ]; then
CHROOT_MOUNT_OPTIONS="--rbind"
@@ -78,6 +78,8 @@ if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROO
elif [ "$CHROOT_TYPE" = "directory" ]; then
CHROOT_MOUNT_OPTIONS="--bind"
CHROOT_MOUNT_DEVICE="$CHROOT_LOCATION"
+ elif [ "$CHROOT_TYPE" = "loopback" ]; then
+ CHROOT_MOUNT_OPTIONS="$CHROOT_MOUNT_OPTIONS -o loop"
elif [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
CHROOT_MOUNT_DEVICE="$CHROOT_LVM_SNAPSHOT_DEVICE"
fi
diff --git a/sbuild/Makefile.am b/sbuild/Makefile.am
index a0080e9..0e4fc33 100644
--- a/sbuild/Makefile.am
+++ b/sbuild/Makefile.am
@@ -36,7 +36,9 @@ sbuild_public_h_sources = \
sbuild-chroot-block-device.h \
sbuild-chroot-directory.h \
sbuild-chroot-file.h \
+ sbuild-chroot-loopback.h \
sbuild-chroot-lvm-snapshot.h \
+ sbuild-chroot-mountable.h \
sbuild-chroot-plain.h \
sbuild-chroot-source.h \
sbuild-chroot-config.h \
@@ -76,7 +78,9 @@ sbuild_public_cc_sources = \
sbuild-chroot-block-device.cc \
sbuild-chroot-directory.cc \
sbuild-chroot-file.cc \
+ sbuild-chroot-loopback.cc \
sbuild-chroot-lvm-snapshot.cc \
+ sbuild-chroot-mountable.cc \
sbuild-chroot-plain.cc \
sbuild-chroot-source.cc \
sbuild-chroot-config.cc \
diff --git a/sbuild/sbuild-chroot-block-device.cc b/sbuild/sbuild-chroot-block-device.cc
index 9b9188a..5891b67 100644
--- a/sbuild/sbuild-chroot-block-device.cc
+++ b/sbuild/sbuild-chroot-block-device.cc
@@ -33,8 +33,8 @@ using namespace sbuild;
chroot_block_device::chroot_block_device ():
chroot(),
- device(),
- mount_options()
+ chroot_mountable(),
+ device()
{
}
@@ -70,33 +70,6 @@ chroot_block_device::get_mount_device () const
}
std::string const&
-chroot_block_device::get_mount_options () const
-{
- return this->mount_options;
-}
-
-void
-chroot_block_device::set_mount_options (std::string const& mount_options)
-{
- this->mount_options = mount_options;
-}
-
-std::string const&
-chroot_block_device::get_location () const
-{
- return chroot::get_location();
-}
-
-void
-chroot_block_device::set_location (std::string const& location)
-{
- if (!location.empty() && !is_absname(location))
- throw error(location, LOCATION_ABS);
-
- chroot::set_location(location);
-}
-
-std::string const&
chroot_block_device::get_chroot_type () const
{
static const std::string type("block-device");
@@ -107,10 +80,10 @@ chroot_block_device::get_chroot_type () const
void
chroot_block_device::setup_env (environment& env)
{
- this->chroot::setup_env(env);
+ chroot::setup_env(env);
+ chroot_mountable::setup_env(env);
env.add("CHROOT_DEVICE", get_device());
- env.add("CHROOT_MOUNT_OPTIONS", get_mount_options());
}
void
@@ -174,33 +147,27 @@ chroot_block_device::setup_lock (chroot::setup_type type,
sbuild::chroot::session_flags
chroot_block_device::get_session_flags () const
{
- return SESSION_NOFLAGS;
+ return SESSION_NOFLAGS | chroot_mountable::get_session_flags();
}
void
chroot_block_device::get_details (format_detail& detail) const
{
this->chroot::get_details(detail);
+ this->chroot_mountable::get_details(detail);
if (!this->device.empty())
detail.add(_("Device"), get_device());
- if (!this->mount_options.empty())
- detail.add(_("Mount Options"), get_mount_options());
}
void
chroot_block_device::get_keyfile (keyfile& keyfile) const
{
chroot::get_keyfile(keyfile);
+ chroot_mountable::get_keyfile(keyfile);
keyfile::set_object_value(*this, &chroot_block_device::get_device,
keyfile, get_name(), "device");
-
- keyfile::set_object_value(*this, &chroot_block_device::get_mount_options,
- keyfile, get_name(), "mount-options");
-
- keyfile::set_object_value(*this, &chroot_block_device::get_location,
- keyfile, get_name(), "location");
}
void
@@ -208,19 +175,10 @@ chroot_block_device::set_keyfile (keyfile const& keyfile,
string_list& used_keys)
{
chroot::set_keyfile(keyfile, used_keys);
+ chroot_mountable::set_keyfile(keyfile, used_keys);
keyfile::get_object_value(*this, &chroot_block_device::set_device,
keyfile, get_name(), "device",
keyfile::PRIORITY_REQUIRED);
used_keys.push_back("device");
-
- keyfile::get_object_value(*this, &chroot_block_device::set_mount_options,
- keyfile, get_name(), "mount-options",
- keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("mount-options");
-
- keyfile::get_object_value(*this, &chroot_block_device::set_location,
- keyfile, get_name(), "location",
- keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("location");
}
diff --git a/sbuild/sbuild-chroot-block-device.h b/sbuild/sbuild-chroot-block-device.h
index 4976b91..abbddca 100644
--- a/sbuild/sbuild-chroot-block-device.h
+++ b/sbuild/sbuild-chroot-block-device.h
@@ -20,6 +20,7 @@
#define SBUILD_CHROOT_BLOCK_DEVICE_H
#include <sbuild/sbuild-chroot.h>
+#include <sbuild/sbuild-chroot-mountable.h>
namespace sbuild
{
@@ -29,7 +30,8 @@ namespace sbuild
*
* The device will be mounted on demand.
*/
- class chroot_block_device : virtual public chroot
+ class chroot_block_device : virtual public chroot,
+ public chroot_mountable
{
protected:
/// The constructor.
@@ -66,41 +68,7 @@ namespace sbuild
virtual std::string const&
get_mount_device () const;
- /**
- * Get the filesystem mount_options of the chroot block device.
- *
- * @returns the mount options.
- */
std::string const&
- get_mount_options () const;
-
- /**
- * Set the filesystem mount_options of the chroot block device.
- *
- * @param mount_options the mount options.
- */
- void
- set_mount_options (std::string const& mount_options);
-
- /**
- * Get the location. This is a path to the chroot directory
- * inside the LV (absolute path from the LV root).
- *
- * @returns the location.
- */
- virtual std::string const&
- get_location () const;
-
- /**
- * Set the location. This is a path to the chroot directory
- * inside the LV (absolute path from the LV root).
- *
- * @param location the location.
- */
- virtual void
- set_location (std::string const& location);
-
- virtual std::string const&
get_chroot_type () const;
virtual void
@@ -128,8 +96,6 @@ namespace sbuild
private:
/// The block device to use.
std::string device;
- /// The options to mount the device with.
- std::string mount_options;
};
}
diff --git a/sbuild/sbuild-chroot-loopback.cc b/sbuild/sbuild-chroot-loopback.cc
new file mode 100644
index 0000000..c679107
--- /dev/null
+++ b/sbuild/sbuild-chroot-loopback.cc
@@ -0,0 +1,148 @@
+/* Copyright © 2005-2008 Roger Leigh <rleigh at debian.org>
+ *
+ * schroot is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * schroot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *********************************************************************/
+
+#include <config.h>
+
+#include "sbuild-chroot-loopback.h"
+#include "sbuild-format-detail.h"
+#include "sbuild-lock.h"
+#include "sbuild-util.h"
+
+#include <cerrno>
+#include <cstring>
+
+#include <boost/format.hpp>
+
+using boost::format;
+using namespace sbuild;
+
+chroot_loopback::chroot_loopback ():
+ chroot(),
+ chroot_mountable(),
+ file()
+{
+}
+
+chroot_loopback::~chroot_loopback ()
+{
+}
+
+sbuild::chroot::ptr
+chroot_loopback::clone () const
+{
+ return ptr(new chroot_loopback(*this));
+}
+
+std::string const&
+chroot_loopback::get_file () const
+{
+ return this->file;
+}
+
+void
+chroot_loopback::set_file (std::string const& file)
+{
+ if (!is_absname(file))
+ throw error(file, FILE_ABS);
+
+ this->file = file;
+}
+
+std::string const&
+chroot_loopback::get_mount_device () const
+{
+ return this->file;
+}
+
+std::string const&
+chroot_loopback::get_chroot_type () const
+{
+ static const std::string type("loopback");
+
+ return type;
+}
+
+void
+chroot_loopback::setup_env (environment& env)
+{
+ chroot::setup_env(env);
+ chroot_mountable::setup_env(env);
+
+ env.add("CHROOT_FILE", get_file());
+}
+
+void
+chroot_loopback::setup_lock (chroot::setup_type type,
+ bool lock,
+ int status)
+{
+ // Check ownership and permissions.
+ if (type == SETUP_START && lock == true)
+ {
+ stat file_status(this->file);
+
+ // NOTE: taken from chroot_config::check_security.
+ if (file_status.uid() != 0)
+ throw error(this->file, FILE_OWNER);
+ if (file_status.check_mode(stat::PERM_OTHER_WRITE))
+ throw error(this->file, FILE_PERMS);
+ if (!file_status.is_regular())
+ throw error(this->file, FILE_NOTREG);
+ }
+
+ /* By default, loopback chroots do no locking. */
+}
+
+sbuild::chroot::session_flags
+chroot_loopback::get_session_flags () const
+{
+ return SESSION_NOFLAGS | chroot_mountable::get_session_flags();
+}
+
+void
+chroot_loopback::get_details (format_detail& detail) const
+{
+ this->chroot::get_details(detail);
+ this->chroot_mountable::get_details(detail);
+
+ if (!this->file.empty())
+ detail.add(_("File"), get_file());
+}
+
+void
+chroot_loopback::get_keyfile (keyfile& keyfile) const
+{
+ chroot::get_keyfile(keyfile);
+ chroot_mountable::get_keyfile(keyfile);
+
+ keyfile::set_object_value(*this, &chroot_loopback::get_file,
+ keyfile, get_name(), "file");
+}
+
+void
+chroot_loopback::set_keyfile (keyfile const& keyfile,
+ string_list& used_keys)
+{
+ chroot::set_keyfile(keyfile, used_keys);
+ chroot_mountable::set_keyfile(keyfile, used_keys);
+
+ keyfile::get_object_value(*this, &chroot_loopback::set_file,
+ keyfile, get_name(), "file",
+ keyfile::PRIORITY_REQUIRED);
+ used_keys.push_back("file");
+}
diff --git a/sbuild/sbuild-chroot-loopback.h b/sbuild/sbuild-chroot-loopback.h
new file mode 100644
index 0000000..9f46080
--- /dev/null
+++ b/sbuild/sbuild-chroot-loopback.h
@@ -0,0 +1,106 @@
+/* Copyright © 2005-2008 Roger Leigh <rleigh at debian.org>
+ *
+ * schroot is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * schroot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *********************************************************************/
+
+#ifndef SBUILD_CHROOT_LOOPBACK_H
+#define SBUILD_CHROOT_LOOPBACK_H
+
+#include <sbuild/sbuild-chroot.h>
+#include <sbuild/sbuild-chroot-mountable.h>
+
+namespace sbuild
+{
+
+ /**
+ * A chroot stored in a file for loopback mounting.
+ *
+ * The file will be mounted on demand.
+ */
+ class chroot_loopback : virtual public chroot,
+ public chroot_mountable
+ {
+ protected:
+ /// The constructor.
+ chroot_loopback ();
+
+ friend class chroot;
+
+ public:
+ /// The destructor.
+ virtual ~chroot_loopback ();
+
+ virtual chroot::ptr
+ clone () const;
+
+ /**
+ * Get the file containing the chroot.
+ *
+ * @returns the file.
+ */
+ std::string const&
+ get_file () const;
+
+ /**
+ * Set the file containing the chroot.
+ *
+ * @param file the file.
+ */
+ void
+ set_file (std::string const& file);
+
+ virtual std::string const&
+ get_mount_device () const;
+
+ std::string const&
+ get_chroot_type () const;
+
+ virtual void
+ setup_env (environment& env);
+
+ virtual session_flags
+ get_session_flags () const;
+
+ protected:
+ virtual void
+ setup_lock (chroot::setup_type type,
+ bool lock,
+ int status);
+
+ virtual void
+ get_details (format_detail& detail) const;
+
+ virtual void
+ get_keyfile (keyfile& keyfile) const;
+
+ virtual void
+ set_keyfile (keyfile const& keyfile,
+ string_list& used_keys);
+
+ private:
+ /// The file to use.
+ std::string file;
+ };
+
+}
+
+#endif /* SBUILD_CHROOT_LOOPBACK_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/sbuild/sbuild-chroot-mountable.cc b/sbuild/sbuild-chroot-mountable.cc
new file mode 100644
index 0000000..548a709
--- /dev/null
+++ b/sbuild/sbuild-chroot-mountable.cc
@@ -0,0 +1,121 @@
+/* Copyright © 2005-2008 Roger Leigh <rleigh at debian.org>
+ *
+ * schroot is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * schroot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *********************************************************************/
+
+#include <config.h>
+
+#include "sbuild-chroot-block-device.h"
+#include "sbuild-format-detail.h"
+#include "sbuild-lock.h"
+#include "sbuild-util.h"
+
+#include <cerrno>
+#include <cstring>
+
+#include <boost/format.hpp>
+
+using boost::format;
+using namespace sbuild;
+
+chroot_mountable::chroot_mountable ():
+ chroot(),
+ mount_options()
+{
+}
+
+chroot_mountable::~chroot_mountable ()
+{
+}
+
+std::string const&
+chroot_mountable::get_mount_options () const
+{
+ return this->mount_options;
+}
+
+void
+chroot_mountable::set_mount_options (std::string const& mount_options)
+{
+ this->mount_options = mount_options;
+}
+
+std::string const&
+chroot_mountable::get_location () const
+{
+ return chroot::get_location();
+}
+
+void
+chroot_mountable::set_location (std::string const& location)
+{
+ if (!location.empty() && !is_absname(location))
+ throw error(location, LOCATION_ABS);
+
+ chroot::set_location(location);
+}
+
+void
+chroot_mountable::setup_env (environment& env)
+{
+ this->chroot::setup_env(env);
+
+ env.add("CHROOT_MOUNT_OPTIONS", get_mount_options());
+}
+
+sbuild::chroot::session_flags
+chroot_mountable::get_session_flags () const
+{
+ return SESSION_NOFLAGS;
+}
+
+void
+chroot_mountable::get_details (format_detail& detail) const
+{
+ this->chroot::get_details(detail);
+
+ if (!this->mount_options.empty())
+ detail.add(_("Mount Options"), get_mount_options());
+}
+
+void
+chroot_mountable::get_keyfile (keyfile& keyfile) const
+{
+ chroot::get_keyfile(keyfile);
+
+ keyfile::set_object_value(*this, &chroot_mountable::get_mount_options,
+ keyfile, get_name(), "mount-options");
+
+ keyfile::set_object_value(*this, &chroot_mountable::get_location,
+ keyfile, get_name(), "location");
+}
+
+void
+chroot_mountable::set_keyfile (keyfile const& keyfile,
+ string_list& used_keys)
+{
+ chroot::set_keyfile(keyfile, used_keys);
+
+ keyfile::get_object_value(*this, &chroot_mountable::set_mount_options,
+ keyfile, get_name(), "mount-options",
+ keyfile::PRIORITY_OPTIONAL);
+ used_keys.push_back("mount-options");
+
+ keyfile::get_object_value(*this, &chroot_mountable::set_location,
+ keyfile, get_name(), "location",
+ keyfile::PRIORITY_OPTIONAL);
+ used_keys.push_back("location");
+}
diff --git a/sbuild/sbuild-chroot-mountable.h b/sbuild/sbuild-chroot-mountable.h
new file mode 100644
index 0000000..80a55c2
--- /dev/null
+++ b/sbuild/sbuild-chroot-mountable.h
@@ -0,0 +1,111 @@
+/* Copyright © 2005-2008 Roger Leigh <rleigh at debian.org>
+ *
+ * schroot is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * schroot is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *********************************************************************/
+
+#ifndef SBUILD_CHROOT_MOUNTABLE_H
+#define SBUILD_CHROOT_MOUNTABLE_H
+
+#include <sbuild/sbuild-chroot.h>
+
+namespace sbuild
+{
+
+ /**
+ * A chroot stored on an unmounted block device.
+ *
+ * The device will be mounted on demand.
+ */
+ class chroot_mountable : virtual public chroot
+ {
+ protected:
+ /// The constructor.
+ chroot_mountable ();
+
+ friend class chroot;
+
+ public:
+ /// The destructor.
+ virtual ~chroot_mountable ();
+
+ virtual std::string const&
+ get_mount_device () const = 0;
+
+ /**
+ * Get the filesystem mount_options of the chroot block device.
+ *
+ * @returns the mount options.
+ */
+ std::string const&
+ get_mount_options () const;
+
+ /**
+ * Set the filesystem mount_options of the chroot block device.
+ *
+ * @param mount_options the mount options.
+ */
+ void
+ set_mount_options (std::string const& mount_options);
+
+ /**
+ * Get the location. This is a path to the chroot directory
+ * inside the device (absolute path from the device root).
+ *
+ * @returns the location.
+ */
+ virtual std::string const&
+ get_location () const;
+
+ /**
+ * Set the location. This is a path to the chroot directory
+ * inside the device (absolute path from the device root).
+ *
+ * @param location the location.
+ */
+ virtual void
+ set_location (std::string const& location);
+
+ virtual void
+ setup_env (environment& env);
+
+ virtual session_flags
+ get_session_flags () const;
+
+ protected:
+ virtual void
+ get_details (format_detail& detail) const;
+
+ virtual void
+ get_keyfile (keyfile& keyfile) const;
+
+ virtual void
+ set_keyfile (keyfile const& keyfile,
+ string_list& used_keys);
+
+ private:
+ /// The options to mount the device with.
+ std::string mount_options;
+ };
+
+}
+
+#endif /* SBUILD_CHROOT_MOUNTABLE_H */
+
+/*
+ * Local Variables:
+ * mode:C++
+ * End:
+ */
diff --git a/sbuild/sbuild-chroot.cc b/sbuild/sbuild-chroot.cc
index ece51be..103773b 100644
--- a/sbuild/sbuild-chroot.cc
+++ b/sbuild/sbuild-chroot.cc
@@ -23,6 +23,7 @@
#include "sbuild-chroot-plain.h"
#include "sbuild-chroot-file.h"
#include "sbuild-chroot-block-device.h"
+#include "sbuild-chroot-loopback.h"
#include "sbuild-chroot-lvm-snapshot.h"
#include "sbuild-lock.h"
@@ -126,6 +127,8 @@ sbuild::chroot::create (std::string const& type)
new_chroot = new chroot_file();
else if (type == "block-device")
new_chroot = new chroot_block_device();
+ else if (type == "loopback")
+ new_chroot = new chroot_loopback();
else if (type == "lvm-snapshot")
new_chroot = new chroot_lvm_snapshot();
else
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
More information about the Buildd-tools-devel
mailing list