A base class for block-device chroots. More...
#include <sbuild-chroot-block-device-base.h>
Public Member Functions | |
virtual | ~chroot_block_device_base () |
The destructor. | |
std::string const & | get_device () const |
Get the block device of the chroot. | |
void | set_device (std::string const &device) |
Set the block device of the chroot. | |
virtual std::string | get_path () const |
Get the path to the chroot. | |
std::string const & | get_chroot_type () const |
Get the type of the chroot. | |
virtual void | setup_env (chroot const &chroot, environment &env) const |
Set environment. | |
virtual session_flags | get_session_flags (chroot const &chroot) const |
Get the session flags of the chroot. | |
Protected Member Functions | |
chroot_block_device_base () | |
The constructor. | |
chroot_block_device_base (const chroot_block_device_base &rhs) | |
The copy constructor. | |
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. | |
Protected Attributes | |
std::string | device |
The block device to use. | |
Friends | |
class | chroot |
A base class for block-device chroots.
This class doesn't implement a chroot (get_chroot_type is not implemented).
Originally lvm-snapshot inherited from the block-device chroot, but this was changed when union support was introduced. This design prevents lvm-snapshot offering union based sessions.
chroot_block_device_base::chroot_block_device_base | ( | ) | [protected] |
The constructor.
References sbuild::chroot::add_facet(), and sbuild::chroot_facet_mountable::create().
chroot_block_device_base::chroot_block_device_base | ( | const chroot_block_device_base & | rhs | ) | [protected] |
chroot_block_device_base::~chroot_block_device_base | ( | ) | [virtual] |
The destructor.
std::string const & chroot_block_device_base::get_chroot_type | ( | ) | const [virtual] |
Get the type of the chroot.
Implements sbuild::chroot.
Reimplemented in sbuild::chroot_lvm_snapshot.
void chroot_block_device_base::get_details | ( | chroot const & | chroot, | |
format_detail & | detail | |||
) | const [protected, virtual] |
Get detailed information about the chroot for output.
chroot | the chroot to use. | |
detail | the details to output to. |
Implements sbuild::chroot.
Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.
References sbuild::_(), sbuild::format_detail::add(), device, and get_device().
std::string const & chroot_block_device_base::get_device | ( | ) | const |
Get the block device of the chroot.
References device.
Referenced by get_details(), get_keyfile(), setup_env(), sbuild::chroot_lvm_snapshot::setup_lock(), and sbuild::chroot_block_device::setup_lock().
void chroot_block_device_base::get_keyfile | ( | chroot const & | chroot, | |
keyfile & | keyfile | |||
) | const [protected, 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.
Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.
References get_device(), sbuild::chroot::get_keyfile_name(), and sbuild::basic_keyfile< K, P >::set_object_value().
std::string chroot_block_device_base::get_path | ( | ) | const [virtual] |
Get the path to the chroot.
This is the absolute path to the root of the chroot, and is typically the same as the mount location and location concatenated together, but is overridden by the chroot type if required.
Implements sbuild::chroot.
References sbuild::chroot::get_mount_location().
sbuild::chroot::session_flags chroot_block_device_base::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.
Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.
void chroot_block_device_base::set_device | ( | std::string const & | device | ) |
Set the block device of the chroot.
This is the "source" device. It may be the case that the real device is different (for example, an LVM snapshot PV), but by default will be the device to mount.
device | the device. |
References sbuild::chroot::DEVICE_ABS, and sbuild::is_absname().
Referenced by set_keyfile().
void chroot_block_device_base::set_keyfile | ( | chroot & | chroot, | |
keyfile const & | keyfile, | |||
string_list & | used_keys | |||
) | [protected, 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.
Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.
References sbuild::chroot::get_keyfile_name(), sbuild::basic_keyfile< K, P >::get_object_value(), sbuild::keyfile_base::PRIORITY_REQUIRED, and set_device().
void chroot_block_device_base::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.
Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.
References sbuild::environment::add(), and get_device().
friend class chroot [friend] |
Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_lvm_snapshot.
std::string sbuild::chroot_block_device_base::device [protected] |
The block device to use.
Referenced by chroot_block_device_base(), get_details(), get_device(), sbuild::chroot_lvm_snapshot::setup_lock(), and sbuild::chroot_block_device::setup_lock().