sbuild 1.4.23
|
Chroot support for mountable devices and filesystems. More...
#include <sbuild-chroot-facet-mountable.h>
Public Types | |
typedef std::tr1::shared_ptr < chroot_facet_mountable > | ptr |
A shared_ptr to a chroot facet object. | |
typedef std::tr1::shared_ptr < const chroot_facet_mountable > | const_ptr |
A shared_ptr to a const chroot facet object. | |
Public Member Functions | |
virtual | ~chroot_facet_mountable () |
The destructor. | |
virtual chroot_facet::ptr | clone () const |
Copy the chroot facet. | |
virtual std::string const & | get_name () const |
Get the name of the chroot facet. | |
virtual std::string const & | get_mount_device () const |
Get the device path of the chroot block device to mount. | |
virtual void | set_mount_device (std::string const &mount_device) |
Set the device path of the chroot block device to mount. | |
virtual std::string const & | get_mount_options () const |
Get the filesystem mount options of the chroot block device. | |
virtual void | set_mount_options (std::string const &mount_options) |
Set the filesystem mount options of the chroot block device. | |
virtual std::string const & | get_location () const |
Get the location. | |
virtual void | set_location (std::string const &location) |
Set the location. | |
virtual void | setup_env (chroot const &chroot, environment &env) const |
Set environment. | |
virtual chroot::session_flags | get_session_flags (chroot const &chroot) const |
Get the session flags of the chroot. | |
virtual void | get_details (chroot const &chroot, format_detail &detail) const |
Get detailed information about the chroot for output. | |
virtual void | get_keyfile (chroot const &chroot, keyfile &keyfile) const |
Copy the chroot properties into a keyfile. | |
virtual void | set_keyfile (chroot &chroot, keyfile const &keyfile, string_list &used_keys) |
Set the chroot properties from a keyfile. | |
Static Public Member Functions | |
static ptr | create () |
Create a chroot facet. | |
Private Member Functions | |
chroot_facet_mountable () | |
The constructor. | |
Private Attributes | |
std::string | mount_device |
The device to mount. | |
std::string | mount_options |
The options to mount the device with. | |
std::string | location |
Location inside the mount location root. |
Chroot support for mountable devices and filesystems.
This facet should be selected for sessions using the mount command to create the chroot. The specified device will be mounted on demand.
This facet is not restricted to block devices and can also be used for network filesystems, loopback files and other mountable objects.
chroot_facet::ptr chroot_facet_mountable::clone | ( | ) | const [virtual] |
Copy the chroot facet.
This is a virtual copy constructor.
Implements sbuild::chroot_facet.
References chroot_facet_mountable().
chroot_facet_mountable::ptr chroot_facet_mountable::create | ( | ) | [static] |
Create a chroot facet.
References chroot_facet_mountable().
Referenced by sbuild::chroot_block_device_base::chroot_block_device_base(), and sbuild::chroot_loopback::chroot_loopback().
void chroot_facet_mountable::get_details | ( | chroot const & | chroot, |
format_detail & | detail | ||
) | const [virtual] |
Get detailed information about the chroot for output.
chroot | the chroot to use. |
detail | the details to output to. |
Implements sbuild::chroot_facet.
References sbuild::_(), sbuild::format_detail::add(), get_location(), get_mount_device(), and get_mount_options().
void chroot_facet_mountable::get_keyfile | ( | chroot const & | chroot, |
keyfile & | keyfile | ||
) | const [virtual] |
Copy the chroot properties into a keyfile.
The keyfile group with the name of the chroot will be set; if it already exists, it will be removed before setting it.
chroot | the chroot to use. |
keyfile | the keyfile to use. |
Implements sbuild::chroot_facet.
References sbuild::chroot::get_facet(), get_location(), get_mount_device(), get_mount_options(), sbuild::chroot::get_name(), and sbuild::basic_keyfile< K, P >::set_object_value().
std::string const & chroot_facet_mountable::get_location | ( | ) | const [virtual] |
Get the location.
This is a path to the chroot directory inside the device (absolute path from the device root).
References location.
Referenced by get_details(), get_keyfile(), and setup_env().
std::string const & chroot_facet_mountable::get_mount_device | ( | ) | const [virtual] |
Get the device path of the chroot block device to mount.
References mount_device.
Referenced by get_details(), get_keyfile(), and setup_env().
std::string const & chroot_facet_mountable::get_mount_options | ( | ) | const [virtual] |
Get the filesystem mount options of the chroot block device.
References mount_options.
Referenced by get_details(), get_keyfile(), and setup_env().
std::string const & chroot_facet_mountable::get_name | ( | ) | const [virtual] |
sbuild::chroot::session_flags chroot_facet_mountable::get_session_flags | ( | chroot const & | chroot | ) | const [virtual] |
Get the session flags of the chroot.
These determine how the Session controlling the chroot will operate.
chroot | the chroot to use. |
Implements sbuild::chroot_facet.
References sbuild::chroot::SESSION_NOFLAGS.
void chroot_facet_mountable::set_keyfile | ( | chroot & | chroot, |
keyfile const & | keyfile, | ||
string_list & | used_keys | ||
) | [virtual] |
Set the chroot properties from a keyfile.
The chroot name must have previously been set, so that the correct keyfile group may be determined.
chroot | the chroot to use. |
keyfile | the keyfile to get the properties from. |
used_keys | a list of the keys used will be set. |
Implements sbuild::chroot_facet.
References sbuild::chroot::get_facet(), sbuild::chroot::get_name(), sbuild::basic_keyfile< K, P >::get_object_value(), sbuild::keyfile_base::PRIORITY_DISALLOWED, sbuild::keyfile_base::PRIORITY_OPTIONAL, sbuild::keyfile_base::PRIORITY_REQUIRED, set_location(), set_mount_device(), and set_mount_options().
void chroot_facet_mountable::set_location | ( | std::string const & | location | ) | [virtual] |
Set the location.
This is a path to the chroot directory inside the device (absolute path from the device root).
location | the location. |
References sbuild::is_absname(), location, and sbuild::chroot::LOCATION_ABS.
Referenced by set_keyfile().
void chroot_facet_mountable::set_mount_device | ( | std::string const & | mount_device | ) | [virtual] |
Set the device path of the chroot block device to mount.
mount_device | the mount device. |
References mount_device.
Referenced by set_keyfile().
void chroot_facet_mountable::set_mount_options | ( | std::string const & | mount_options | ) | [virtual] |
Set the filesystem mount options of the chroot block device.
mount_options | the mount options. |
References mount_options.
Referenced by set_keyfile().
void chroot_facet_mountable::setup_env | ( | chroot const & | chroot, |
environment & | env | ||
) | const [virtual] |
Set environment.
Set the environment that the setup scripts will see during execution.
chroot | the chroot to use. |
env | the environment to set. |
Implements sbuild::chroot_facet.
References sbuild::environment::add(), get_location(), get_mount_device(), and get_mount_options().