sbuild  1.6.10
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
sbuild::chroot_facet_union Class Reference

Chroot support for filesystem union based sessions. More...

#include <sbuild-chroot-facet-union.h>

+ Inheritance diagram for sbuild::chroot_facet_union:
+ Collaboration diagram for sbuild::chroot_facet_union:

Public Types

enum  error_code { UNION_TYPE_UNKNOWN, UNION_OVERLAY_ABS, UNION_UNDERLAY_ABS }
 Error codes. More...
 
typedef custom_error< error_codeerror
 Exception type.
 
typedef std::shared_ptr< chroot_facet_unionptr
 A shared_ptr to a chroot facet object.
 
typedef std::shared_ptr< const chroot_facet_unionconst_ptr
 A shared_ptr to a const chroot facet object.
 
- Public Types inherited from sbuild::chroot_facet
typedef std::shared_ptr< chroot_facetptr
 A shared_ptr to a chroot facet object.
 
typedef std::shared_ptr< const chroot_facetconst_ptr
 A shared_ptr to a const chroot facet object.
 

Public Member Functions

virtual ~chroot_facet_union ()
 The destructor.
 
virtual chroot_facet::ptr clone () const
 Copy the chroot facet. More...
 
std::string const & get_name () const
 Get the name of the chroot facet. More...
 
bool get_union_configured () const
 Get fs union configured state. More...
 
virtual std::string const & get_union_type () const
 Get the filesystem union type. More...
 
virtual void set_union_type (std::string const &union_type)
 Set the filesystem union type. More...
 
virtual std::string const & get_union_mount_options () const
 Get the filesystem union mount options (branch configuration). More...
 
virtual void set_union_mount_options (std::string const &union_mount_options)
 Set the filesystem union mount options (branch configuration). More...
 
virtual std::string const & get_union_overlay_directory () const
 Get the union overlay directory. More...
 
virtual void set_union_overlay_directory (std::string const &directory)
 Set the union overlay directory. More...
 
virtual std::string const & get_union_underlay_directory () const
 Get the union underlay directory. More...
 
virtual void set_union_underlay_directory (std::string const &directory)
 Set the union underlay directory. More...
 
virtual void setup_env (chroot const &chroot, environment &env) const
 Set environment. More...
 
virtual chroot::session_flags get_session_flags (chroot const &chroot) const
 Get the session flags of the chroot. More...
 
virtual void get_details (chroot const &chroot, format_detail &detail) const
 Get detailed information about the chroot for output. More...
 
virtual void get_keyfile (chroot const &chroot, keyfile &keyfile) const
 Copy the chroot properties into a keyfile. More...
 
virtual void set_keyfile (chroot &chroot, keyfile const &keyfile, string_list &used_keys)
 Set the chroot properties from a keyfile. More...
 
- Public Member Functions inherited from sbuild::chroot_facet
virtual ~chroot_facet ()
 The destructor.
 

Static Public Member Functions

static ptr create ()
 Create a chroot facet. More...
 

Private Member Functions

 chroot_facet_union ()
 The constructor.
 

Private Attributes

std::string union_type
 filesystem union type.
 
std::string union_mount_options
 Union mount options (branch configuration).
 
std::string union_overlay_directory
 Union read-write overlay directory.
 
std::string union_underlay_directory
 Union read-only underlay directory.
 

Additional Inherited Members

- Protected Member Functions inherited from sbuild::chroot_facet
 chroot_facet ()
 The constructor.
 
void set_chroot (chroot &chroot)
 Set containing chroot. More...
 
- Protected Attributes inherited from sbuild::chroot_facet
chrootowner
 Chroot owning this facet.
 

Detailed Description

Chroot support for filesystem union based sessions.

A chroot may offer session support using a filesystem union like aufs or unionfs. A new union type may need to adapt the 10mount or 05union script to properly populate the underlay and mount directory. The overlay directory and union setup is already handled.

Member Enumeration Documentation

Error codes.

Enumerator
UNION_TYPE_UNKNOWN 

Unknown filesystem union type.

UNION_OVERLAY_ABS 

Union overlay must have an absolute path.

UNION_UNDERLAY_ABS 

Union underlay must have an absolute path.

Member Function Documentation

chroot_facet::ptr chroot_facet_union::clone ( ) const
virtual

Copy the chroot facet.

This is a virtual copy constructor.

Returns
a shared_ptr to the new copy of the chroot facet.

Implements sbuild::chroot_facet.

References chroot_facet_union().

chroot_facet_union::ptr chroot_facet_union::create ( )
static

Create a chroot facet.

Returns
a shared_ptr to the new chroot facet.

References chroot_facet_union().

Referenced by sbuild::chroot_block_device::chroot_block_device(), sbuild::chroot_directory::chroot_directory(), and sbuild::chroot_loopback::chroot_loopback().

+ Here is the caller graph for this function:

void chroot_facet_union::get_details ( chroot const &  chroot,
format_detail detail 
) const
virtual

Get detailed information about the chroot for output.

Parameters
chrootthe chroot to use.
detailthe details to output to.

Implements sbuild::chroot_facet.

References sbuild::_(), sbuild::format_detail::add(), get_union_configured(), get_union_mount_options(), get_union_overlay_directory(), get_union_type(), get_union_underlay_directory(), union_overlay_directory, and union_underlay_directory.

void chroot_facet_union::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.

Parameters
chrootthe chroot to use.
keyfilethe keyfile to use.

Implements sbuild::chroot_facet.

References sbuild::chroot::get_name(), get_union_configured(), get_union_mount_options(), get_union_overlay_directory(), get_union_type(), get_union_underlay_directory(), and sbuild::basic_keyfile< K, P >::set_object_value().

std::string const & chroot_facet_union::get_name ( ) const
virtual

Get the name of the chroot facet.

Returns
the chroot facet name.

Implements sbuild::chroot_facet.

sbuild::chroot::session_flags chroot_facet_union::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.

Parameters
chrootthe chroot to use.
Returns
the session flags.

Implements sbuild::chroot_facet.

References sbuild::chroot::get_facet(), get_union_configured(), sbuild::chroot::SESSION_NOFLAGS, and sbuild::chroot::SESSION_PURGE.

bool chroot_facet_union::get_union_configured ( ) const

Get fs union configured state.

Returns
if fs union is configured

References get_union_type().

Referenced by get_details(), get_keyfile(), get_session_flags(), set_keyfile(), and setup_env().

+ Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_mount_options ( ) const
virtual

Get the filesystem union mount options (branch configuration).

See also
set_union_mount_options
Returns
the filesystem union branch configuration.

References set_union_mount_options(), and union_mount_options.

Referenced by get_details(), get_keyfile(), and setup_env().

+ Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_overlay_directory ( ) const
virtual

Get the union overlay directory.

Returns
the writeable overlay directory.

References set_union_overlay_directory(), and union_overlay_directory.

Referenced by get_details(), get_keyfile(), and setup_env().

+ Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_type ( ) const
virtual

Get the filesystem union type.

See also
set_union_type
Returns
the union filesytem type.

References union_type.

Referenced by get_details(), get_keyfile(), get_union_configured(), and setup_env().

+ Here is the caller graph for this function:

std::string const & chroot_facet_union::get_union_underlay_directory ( ) const
virtual

Get the union underlay directory.

Returns
the writeable underlay directory.

References set_union_underlay_directory(), and union_underlay_directory.

Referenced by get_details(), get_keyfile(), and setup_env().

+ Here is the caller graph for this function:

void chroot_facet_union::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.

Parameters
chrootthe chroot to use.
keyfilethe keyfile to get the properties from.
used_keysa 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(), get_union_configured(), sbuild::keyfile_base::PRIORITY_OPTIONAL, sbuild::keyfile_base::PRIORITY_REQUIRED, set_union_mount_options(), set_union_overlay_directory(), set_union_type(), and set_union_underlay_directory().

void chroot_facet_union::set_union_mount_options ( std::string const &  union_mount_options)
virtual

Set the filesystem union mount options (branch configuration).

Normally a temporary directory is used as the writeable branch, which is removed on session end. This allows the building of a complex union which can merge multiple branches. The string has to be constructed as expected by the filesystem union type and is directly used as the mount '-o' option string.

Parameters
union_mount_optionsa union filesystem-specific branch description

References union_mount_options.

Referenced by get_union_mount_options(), and set_keyfile().

+ Here is the caller graph for this function:

void chroot_facet_union::set_union_overlay_directory ( std::string const &  directory)
virtual

Set the union overlay directory.

Parameters
directorythe writeable overlay directory.

References sbuild::is_absname(), UNION_OVERLAY_ABS, and union_overlay_directory.

Referenced by get_union_overlay_directory(), and set_keyfile().

+ Here is the caller graph for this function:

void chroot_facet_union::set_union_type ( std::string const &  union_type)
virtual

Set the filesystem union type.

Currently supported values are aufs, unionfs and none.

Parameters
union_typethe filesystem type.

References sbuild::chroot::add_facet(), sbuild::chroot_facet_source_clonable::create(), sbuild::chroot::get_facet(), sbuild::chroot_facet::owner, sbuild::chroot::remove_facet(), union_type, and UNION_TYPE_UNKNOWN.

Referenced by set_keyfile().

+ Here is the caller graph for this function:

void chroot_facet_union::set_union_underlay_directory ( std::string const &  directory)
virtual

Set the union underlay directory.

Parameters
directorythe writeable underlay directory.

References sbuild::is_absname(), UNION_UNDERLAY_ABS, and union_underlay_directory.

Referenced by get_union_underlay_directory(), and set_keyfile().

+ Here is the caller graph for this function:

void chroot_facet_union::setup_env ( chroot const &  chroot,
environment env 
) const
virtual

Set environment.

Set the environment that the setup scripts will see during execution.

Parameters
chrootthe chroot to use.
envthe environment to set.

Implements sbuild::chroot_facet.

References sbuild::environment::add(), get_union_configured(), get_union_mount_options(), get_union_overlay_directory(), get_union_type(), and get_union_underlay_directory().


The documentation for this class was generated from the following files: