Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Attributes | Friends

sbuild::chroot Class Reference

Common chroot data. More...

#include <sbuild-chroot.h>

Inheritance diagram for sbuild::chroot:
Inheritance graph
[legend]
Collaboration diagram for sbuild::chroot:
Collaboration graph
[legend]

List of all members.

Public Types

enum  setup_type { SETUP_START, SETUP_RECOVER, SETUP_STOP }
 

Type of setup to perform.

More...
enum  session_flags { SESSION_NOFLAGS = 0, SESSION_CREATE = 1 << 0, SESSION_CLONE = 1 << 1, SESSION_PURGE = 1 << 2 }
 

Chroot session properties.

More...
enum  verbosity { VERBOSITY_QUIET, VERBOSITY_NORMAL, VERBOSITY_VERBOSE }
 

Message verbosity.

More...
enum  error_code {
  CHROOT_CREATE, CHROOT_DEVICE, CHROOT_TYPE, DEVICE_ABS,
  DEVICE_LOCK, DEVICE_NOTBLOCK, DEVICE_UNLOCK, DIRECTORY_ABS,
  FACET_INVALID, FACET_PRESENT, FILE_ABS, FILE_LOCK,
  FILE_NOTREG, FILE_OWNER, FILE_PERMS, FILE_UNLOCK,
  LOCATION_ABS, SESSION_UNLINK, SESSION_WRITE, VERBOSITY_INVALID
}
 

Error codes.

More...
typedef custom_error< error_codeerror
 Exception type.
typedef std::tr1::shared_ptr
< chroot
ptr
 A shared_ptr to a chroot object.
typedef std::tr1::shared_ptr
< const chroot
const_ptr
 A shared_ptr to a const chroot object.

Public Member Functions

virtual ~chroot ()
 The destructor.
virtual ptr clone () const =0
 Copy the chroot.
virtual chroot::ptr clone_session (std::string const &session_id, std::string const &user, bool root) const =0
 Create a session chroot.
virtual chroot::ptr clone_source () const =0
 Create a source chroot.
std::string const & get_name () const
 Get the name of the chroot.
void set_name (std::string const &name)
 Set the name of the chroot.
std::string const & get_session_id () const
 Get the session ID of the chroot.
void set_session_id (std::string const &session_id)
 Set the session ID of the chroot.
std::string const & get_keyfile_name () const
 Get the keyfile name of the chroot.
std::string const & get_description () const
 Get the description of the chroot.
void set_description (std::string const &description)
 Set the description of the chroot.
std::string const & get_mount_location () const
 Get the mount location of the chroot.
void set_mount_location (std::string const &location)
 Set the mount location of the chroot.
virtual std::string get_path () const =0
 Get the path to the chroot.
unsigned int get_priority () const
 Get the priority of the chroot.
void set_priority (unsigned int priority)
 Set the priority of a chroot.
string_list const & get_users () const
 Get the users allowed to access the chroot.
void set_users (string_list const &users)
 Set the users allowed to access the chroot.
string_list const & get_groups () const
 Get the groups allowed to access the chroot.
void set_groups (string_list const &groups)
 Set the users allowed to access the chroot.
string_list const & get_root_users () const
 Get the users allowed to access the chroot as root.
void set_root_users (string_list const &users)
 Set the users allowed to access the chroot as root.
string_list const & get_root_groups () const
 Get the groups allowed to access the chroot as root.
void set_root_groups (string_list const &groups)
 Set the groups allowed to access the chroot as root.
string_list const & get_aliases () const
 Get the aliases of the chroot.
void set_aliases (string_list const &aliases)
 Set the aliases of the chroot.
bool get_preserve_environment () const
 Check if the environment should be preserved in the chroot.
void set_preserve_environment (bool preserve_environment)
 Set if the environment should be preserved in the chroot.
regex const & get_environment_filter () const
 Get the environment filter of the chroot.
void set_environment_filter (regex const &environment_filter)
 Set the environment filter of the chroot.
bool get_active () const
 Get the activity status of the chroot.
bool get_original () const
 Get the originality of the chroot.
void set_original (bool original)
 Set the originality of the chroot.
bool get_run_setup_scripts () const
 Check if chroot setup scripts will be run.
std::string const & get_script_config () const
 Get the script configuration file for the chroot.
void set_script_config (std::string const &script_config)
 Set the script configuration file for the chroot.
string_list const & get_command_prefix () const
 Get the command_prefix for the chroot.
void set_command_prefix (string_list const &command_prefix)
 Set the command_prefix for the chroot.
verbosity get_verbosity () const
 Get the message verbosity.
const char * get_verbosity_string () const
 Get the message verbosity.
void set_verbosity (verbosity verbosity)
 Set the message verbosity.
void set_verbosity (std::string const &verbosity)
 Set the message verbosity.
virtual std::string const & get_chroot_type () const =0
 Get the type of the chroot.
void setup_env (environment &env) const
 Set environment.
virtual void setup_env (chroot const &chroot, environment &env) const =0
 Set environment.
void lock (setup_type type)
 Lock a chroot during setup.
void unlock (setup_type type, int status)
 Unlock a chroot during setup.
template<typename T >
std::tr1::shared_ptr< T > get_facet ()
template<typename T >
const std::tr1::shared_ptr
< const T > 
get_facet () const
template<typename T >
void add_facet (std::tr1::shared_ptr< T > facet)
template<typename T >
void remove_facet ()
template<typename T >
void remove_facet (std::tr1::shared_ptr< T > facet)
template<typename T >
void replace_facet (std::tr1::shared_ptr< T > facet)
string_list list_facets () const
session_flags get_session_flags () const
 Get the session flags of the chroot.
virtual chroot::session_flags get_session_flags (chroot const &chroot) const =0
 Get the session flags of the chroot.
void get_details (format_detail &detail) const
 Get detailed information about the chroot for output.
virtual void get_details (chroot const &chroot, format_detail &detail) const =0
 Get detailed information about the chroot for output.
void print_details (std::ostream &stream) const
 Print detailed information about the chroot to a stream.
void get_keyfile (keyfile &keyfile) const
 Copy the chroot properties into a keyfile.
void set_keyfile (keyfile const &keyfile, string_list &used_keys)
 Set the chroot properties from a keyfile.

Static Public Member Functions

static ptr create (std::string const &type)
 Create a chroot.

Protected Member Functions

 chroot ()
 The constructor.
 chroot (const chroot &rhs)
 The copy constructor.
void set_run_setup_scripts (bool run_setup_scripts)
 Set whether chroot setup scripts will be run.
virtual void setup_session_info (bool start)
 Set up persistent session information.
virtual void setup_lock (setup_type type, bool lock, int status)=0
 Unlock a chroot during setup.
virtual void get_keyfile (chroot const &chroot, keyfile &keyfile) const =0
 Copy the chroot properties into a keyfile.
virtual void set_keyfile (chroot &chroot, keyfile const &keyfile, string_list &used_keys)=0
 Set the chroot properties from a keyfile.

Private Types

typedef std::tr1::shared_ptr
< chroot_facet
facet_ptr
typedef std::list< facet_ptrfacet_list

Private Attributes

std::string name
 Chroot name.
std::string session_id
 Chroot session ID.
std::string description
 Chroot description.
unsigned int priority
 Chroot priority.
string_list users
 Users allowed to access the chroot.
string_list groups
 Groups allowed to access the chroot.
string_list root_users
 Users allowed to access the chroot as root.
string_list root_groups
 Groups allowed to access the chroot as root.
string_list aliases
 Alternative names for the chroot.
bool preserve_environment
 Preserve environment?
regex environment_filter
 Environment filter regex.
std::string mount_location
 Location to mount chroot in the filesystem (if any).
bool original
 Was the chroot automatically generated?
bool run_setup_scripts
 Run chroot setup scripts?
std::string script_config
 Configuration of the setup and exec scripts.
string_list command_prefix
 Command prefix.
verbosity message_verbosity
 The message verbosity.
facet_list facets
 Contained chroot facets.

Friends

std::ostream & operator<< (std::ostream &stream, ptr const &rhs)
 Print detailed information about the chroot to a stream.
keyfile const & operator>> (keyfile const &keyfile, ptr &rhs)
 Chroot initialisation from a keyfile.
keyfileoperator<< (keyfile &keyfile, ptr const &rhs)
 Chroot serialisation to a keyfile.

Detailed Description

Common chroot data.

This class contains all of the metadata associated with a single chroot, for all chroot types. This is the in-core representation of a chroot definition in the configuration file, and may be initialised directly from an open keyfile.


Member Typedef Documentation

typedef std::tr1::shared_ptr<const chroot> sbuild::chroot::const_ptr

A shared_ptr to a const chroot object.

Exception type.

Reimplemented in sbuild::chroot_block_device, and sbuild::chroot_loopback.

typedef std::list<facet_ptr> sbuild::chroot::facet_list [private]
typedef std::tr1::shared_ptr<chroot_facet> sbuild::chroot::facet_ptr [private]
typedef std::tr1::shared_ptr<chroot> sbuild::chroot::ptr

A shared_ptr to a chroot object.


Member Enumeration Documentation

Error codes.

Enumerator:
CHROOT_CREATE 

Chroot creation failed.

CHROOT_DEVICE 

Chroot device name not set.

CHROOT_TYPE 

Unknown chroot type.

DEVICE_ABS 

Device must have an absolute path.

DEVICE_LOCK 

Failed to lock device.

DEVICE_NOTBLOCK 

File is not a block device.

DEVICE_UNLOCK 

Failed to unlock device.

DIRECTORY_ABS 

Directory must have an absolute path.

FACET_INVALID 

Attempt to add object which is not a facet.

FACET_PRESENT 

Attempt to add facet which is already in use.

FILE_ABS 

File must have an absolute path.

FILE_LOCK 

Failed to acquire lock.

FILE_NOTREG 

File is not a regular file.

FILE_OWNER 

File is not owned by user root.

FILE_PERMS 

File has write permissions for others.

FILE_UNLOCK 

Failed to discard lock.

LOCATION_ABS 

Location must have an absolute path.

SESSION_UNLINK 

Failed to unlink session file.

SESSION_WRITE 

Failed to write session file.

VERBOSITY_INVALID 

Message verbosity is invalid.

Chroot session properties.

Enumerator:
SESSION_NOFLAGS 

No flags are set.

SESSION_CREATE 

The chroot supports session creation.

SESSION_CLONE 

The chroot supports cloning.

SESSION_PURGE 

The chroot should be purged.

Type of setup to perform.

Enumerator:
SETUP_START 

Activate a chroot.

SETUP_RECOVER 

Reactivate a chroot.

SETUP_STOP 

Deactivate a chroot.

Message verbosity.

Enumerator:
VERBOSITY_QUIET 

Only print essential messages.

VERBOSITY_NORMAL 

Print messages (the default).

VERBOSITY_VERBOSE 

Print all messages.


Constructor & Destructor Documentation

sbuild::chroot::chroot (  )  [protected]
sbuild::chroot::chroot ( const chroot rhs  )  [protected]

The copy constructor.

Todo:
Use internal version of add_facet to add chroot pointer.

References facets.

sbuild::chroot::~chroot (  )  [virtual]

The destructor.


Member Function Documentation

template<typename T >
void sbuild::chroot::add_facet ( std::tr1::shared_ptr< T >  facet  ) 
virtual ptr sbuild::chroot::clone (  )  const [pure virtual]

Copy the chroot.

This is a virtual copy constructor.

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

Implemented in sbuild::chroot_block_device, sbuild::chroot_btrfs_snapshot, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_loopback, sbuild::chroot_lvm_snapshot, and sbuild::chroot_plain.

virtual chroot::ptr sbuild::chroot::clone_session ( std::string const &  session_id,
std::string const &  user,
bool  root 
) const [pure virtual]

Create a session chroot.

Parameters:
session_id the identifier for the new session.
user the user creating the session.
root true if the user has root access, otherwise false.
Returns:
a session chroot.

Implemented in sbuild::chroot_block_device, sbuild::chroot_btrfs_snapshot, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_loopback, sbuild::chroot_lvm_snapshot, and sbuild::chroot_plain.

virtual chroot::ptr sbuild::chroot::clone_source (  )  const [pure virtual]
sbuild::chroot::ptr sbuild::chroot::create ( std::string const &  type  )  [static]

Create a chroot.

This is a factory function.

Parameters:
type the type of chroot to create.
Returns:
a shared_ptr to the new chroot.

References CHROOT_CREATE, and CHROOT_TYPE.

Referenced by sbuild::chroot_config::load_keyfile().

bool sbuild::chroot::get_active (  )  const
string_list const & sbuild::chroot::get_aliases (  )  const

Get the aliases of the chroot.

These are alternative names for the chroot.

Returns:
a list of names.

References aliases.

Referenced by get_details(), and get_keyfile().

virtual std::string const& sbuild::chroot::get_chroot_type (  )  const [pure virtual]
string_list const & sbuild::chroot::get_command_prefix (  )  const

Get the command_prefix for the chroot.

This is a command to prefix to any command run in the chroot.

Returns:
the command prefix.

References command_prefix.

Referenced by get_details(), and get_keyfile().

std::string const & sbuild::chroot::get_description (  )  const

Get the description of the chroot.

Returns:
the description.

References description.

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

void sbuild::chroot::get_details ( format_detail detail  )  const

Get detailed information about the chroot for output.

Parameters:
detail the details to output to.

References facets.

Referenced by print_details().

void sbuild::chroot::get_details ( chroot const &  chroot,
format_detail detail 
) const [pure virtual]
regex const & sbuild::chroot::get_environment_filter (  )  const

Get the environment filter of the chroot.

This is a POSIX extended regular expression used to remove insecure environment variables from the chroot environment.

Returns:
the filter

References environment_filter.

Referenced by get_details(), and get_keyfile().

template<typename T >
std::tr1::shared_ptr< T > sbuild::chroot::get_facet (  ) 
template<typename T >
const std::tr1::shared_ptr< const T > sbuild::chroot::get_facet (  )  const

References facets.

string_list const & sbuild::chroot::get_groups (  )  const

Get the groups allowed to access the chroot.

Returns:
a list of groups.

References groups.

Referenced by get_details(), and get_keyfile().

void sbuild::chroot::get_keyfile ( chroot const &  chroot,
keyfile keyfile 
) const [protected, pure virtual]
void sbuild::chroot::get_keyfile ( keyfile keyfile  )  const

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:
keyfile the keyfile to use.

References facets.

Referenced by setup_session_info().

std::string const & sbuild::chroot::get_keyfile_name (  )  const
std::string const & sbuild::chroot::get_mount_location (  )  const
std::string const & sbuild::chroot::get_name (  )  const

Get the name of the chroot.

Returns:
the name.

References name.

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

bool sbuild::chroot::get_original (  )  const

Get the originality of the chroot.

Returns:
true if original, false if generated.

References original.

virtual std::string sbuild::chroot::get_path (  )  const [pure 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.

Returns:
the path.

Implemented in sbuild::chroot_block_device_base, sbuild::chroot_btrfs_snapshot, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_loopback, and sbuild::chroot_plain.

Referenced by get_details(), and setup_env().

bool sbuild::chroot::get_preserve_environment (  )  const

Check if the environment should be preserved in the chroot.

Returns:
true to preserve or false to clean.

References preserve_environment.

Referenced by get_details(), and get_keyfile().

unsigned int sbuild::chroot::get_priority (  )  const

Get the priority of the chroot.

This is a number indicating whether than a ditribution is older than another.

Returns:
the priority.

References priority.

Referenced by get_details(), and get_keyfile().

string_list const & sbuild::chroot::get_root_groups (  )  const

Get the groups allowed to access the chroot as root.

Members of these groups can switch to root without authenticating themselves.

Returns:
a list of groups.

References root_groups.

Referenced by get_details(), and get_keyfile().

string_list const & sbuild::chroot::get_root_users (  )  const

Get the users allowed to access the chroot as root.

Members of these users can switch to root without authenticating themselves.

Returns:
a list of users.

References root_users.

Referenced by get_details(), and get_keyfile().

bool sbuild::chroot::get_run_setup_scripts (  )  const

Check if chroot setup scripts will be run.

Returns:
true if setup scripts will be run, otherwise false.

References run_setup_scripts.

Referenced by get_details().

std::string const & sbuild::chroot::get_script_config (  )  const

Get the script configuration file for the chroot.

This is a filename, either relative to the configured pkgsysconfdir or an absolute path.

Returns:
the configuration file name.

References script_config.

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

virtual chroot::session_flags sbuild::chroot::get_session_flags ( chroot const &  chroot  )  const [pure virtual]

Get the session flags of the chroot.

These determine how the Session controlling the chroot will operate.

Parameters:
chroot the chroot to use.
Returns:
the session flags.

Implemented in sbuild::chroot_block_device_base, sbuild::chroot_block_device, sbuild::chroot_btrfs_snapshot, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_loopback, sbuild::chroot_lvm_snapshot, and sbuild::chroot_plain.

sbuild::chroot::session_flags sbuild::chroot::get_session_flags (  )  const

Get the session flags of the chroot.

These determine how the Session controlling the chroot will operate.

Returns:
the session flags.

References facets.

Referenced by get_details(), sbuild::chroot_block_device::get_session_flags(), and setup_env().

std::string const & sbuild::chroot::get_session_id (  )  const

Get the session ID of the chroot.

Returns:
the session ID.

References session_id.

Referenced by sbuild::chroot_facet_session::get_details().

string_list const & sbuild::chroot::get_users (  )  const

Get the users allowed to access the chroot.

Returns:
a list of users.

References users.

Referenced by get_details(), and get_keyfile().

chroot::verbosity chroot::get_verbosity (  )  const

Get the message verbosity.

Returns the verbosity level.

References message_verbosity.

const char * chroot::get_verbosity_string (  )  const

Get the message verbosity.

Returns the verbosity level.

References sbuild::DEBUG_CRITICAL, sbuild::log_debug(), message_verbosity, VERBOSITY_NORMAL, VERBOSITY_QUIET, and VERBOSITY_VERBOSE.

Referenced by get_details(), and get_keyfile().

string_list sbuild::chroot::list_facets (  )  const

References facets.

void sbuild::chroot::lock ( setup_type  type  ) 

Lock a chroot during setup.

The locking technique (if any) may vary depending upon the chroot type and setup stage. For example, during creation of an LVM snapshot a block device might require locking, but afterwards this will change to the new block device.

An error will be thrown on failure.

Parameters:
type the type of setup being performed

References setup_lock().

Referenced by setup_session_info().

void sbuild::chroot::print_details ( std::ostream &  stream  )  const

Print detailed information about the chroot to a stream.

The information is printed in plain text with one line per property.

Parameters:
stream the stream to output to.

References sbuild::_(), get_active(), and get_details().

template<typename T >
void sbuild::chroot::remove_facet ( std::tr1::shared_ptr< T >  facet  ) 
template<typename T >
void sbuild::chroot::remove_facet (  ) 
template<typename T >
void sbuild::chroot::replace_facet ( std::tr1::shared_ptr< T >  facet  ) 

References add_facet().

void sbuild::chroot::set_aliases ( string_list const &  aliases  ) 

Set the aliases of the chroot.

These are alternative names for the chroot.

Parameters:
aliases a list of names.

Referenced by set_keyfile(), and set_session_id().

void sbuild::chroot::set_command_prefix ( string_list const &  command_prefix  ) 

Set the command_prefix for the chroot.

This is a command to prefix to any command run in the chroot.

Parameters:
command_prefix the command prefix.

Referenced by set_keyfile().

void sbuild::chroot::set_description ( std::string const &  description  ) 

Set the description of the chroot.

Parameters:
description the description.

Referenced by set_keyfile().

void sbuild::chroot::set_environment_filter ( regex const &  environment_filter  ) 

Set the environment filter of the chroot.

This is a POSIX extended regular expression used to remove insecure environment variables from the chroot environment.

Parameters:
environment_filter the filter.

Referenced by set_keyfile().

void sbuild::chroot::set_groups ( string_list const &  groups  ) 

Set the users allowed to access the chroot.

Parameters:
groups a list of groups.

Referenced by set_keyfile().

void sbuild::chroot::set_keyfile ( keyfile const &  keyfile,
string_list used_keys 
)

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:
keyfile the keyfile to get the properties from.
used_keys a list of the keys used will be set.

References facets.

void sbuild::chroot::set_keyfile ( chroot chroot,
keyfile const &  keyfile,
string_list used_keys 
) [protected, pure virtual]
void sbuild::chroot::set_mount_location ( std::string const &  location  ) 

Set the mount location of the chroot.

Parameters:
location the mount location.

References sbuild::is_absname(), LOCATION_ABS, and mount_location.

Referenced by set_keyfile().

void sbuild::chroot::set_name ( std::string const &  name  ) 

Set the name of the chroot.

Parameters:
name the name.

Referenced by set_keyfile(), and set_session_id().

void sbuild::chroot::set_original ( bool  original  ) 

Set the originality of the chroot.

Parameters:
original true if original, false if generated.
void sbuild::chroot::set_preserve_environment ( bool  preserve_environment  ) 

Set if the environment should be preserved in the chroot.

Parameters:
preserve_environment true to preserve or false to clean.

Referenced by set_keyfile().

void sbuild::chroot::set_priority ( unsigned int  priority  ) 

Set the priority of a chroot.

This is a number indicating whether a distribution is older than another. For example, "oldstable" and "oldstable-security" might be 0, while "stable" and "stable-security" 1, "testing" 2 and "unstable" 3. The values are not important, but the difference between them is.

Parameters:
priority the priority.

Referenced by set_keyfile().

void sbuild::chroot::set_root_groups ( string_list const &  groups  ) 

Set the groups allowed to access the chroot as root.

Members of these groups can switch to root without authenticating themselves.

Parameters:
groups a list of groups.

References root_groups.

Referenced by set_keyfile().

void sbuild::chroot::set_root_users ( string_list const &  users  ) 

Set the users allowed to access the chroot as root.

Members of these users can switch to root without authenticating themselves.

Parameters:
users a list of users.

References root_users.

Referenced by set_keyfile().

void sbuild::chroot::set_run_setup_scripts ( bool  run_setup_scripts  )  [protected]

Set whether chroot setup scripts will be run.

Parameters:
run_setup_scripts true if setup scripts will be run, otherwise false.

Referenced by sbuild::chroot_plain::chroot_plain().

void sbuild::chroot::set_script_config ( std::string const &  script_config  ) 

Set the script configuration file for the chroot.

This is a filename, either relative to the configured pkgsysconfdir or an absolute path.

Parameters:
script_config the script configuration file.

Referenced by set_keyfile().

void sbuild::chroot::set_session_id ( std::string const &  session_id  ) 

Set the session ID of the chroot.

Todo:
Create as chroot facet
Parameters:
session_id the session ID.

References set_aliases(), and set_name().

void sbuild::chroot::set_users ( string_list const &  users  ) 

Set the users allowed to access the chroot.

Parameters:
users a list of users.

Referenced by set_keyfile().

void chroot::set_verbosity ( chroot::verbosity  verbosity  ) 

Set the message verbosity.

Parameters:
verbosity the verbosity level.

References message_verbosity.

Referenced by set_keyfile().

void chroot::set_verbosity ( std::string const &  verbosity  ) 

Set the message verbosity.

Parameters:
verbosity the verbosity level.

References message_verbosity, and VERBOSITY_INVALID.

void sbuild::chroot::setup_env ( environment env  )  const

Set environment.

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

Parameters:
env the environment to set.

References facets.

void sbuild::chroot::setup_env ( chroot const &  chroot,
environment env 
) const [pure virtual]
virtual void sbuild::chroot::setup_lock ( setup_type  type,
bool  lock,
int  status 
) [protected, pure virtual]

Unlock a chroot during setup.

The locking technique (if any) may vary depending upon the chroot type and setup stage. For example, during creation of an LVM snapshot a block device might require locking, but afterwards this will change to the new block device.

An error will be thrown on failure.

Parameters:
type the type of setup being performed
lock true to lock, false to unlock
status the exit status of the setup commands (0 for success, nonzero for failure).

Implemented in sbuild::chroot_block_device, sbuild::chroot_btrfs_snapshot, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_loopback, sbuild::chroot_lvm_snapshot, and sbuild::chroot_plain.

Referenced by lock(), and unlock().

void sbuild::chroot::setup_session_info ( bool  start  )  [protected, virtual]
void sbuild::chroot::unlock ( setup_type  type,
int  status 
)

Unlock a chroot during setup.

The locking technique (if any) may vary depending upon the chroot type and setup stage. For example, during creation of an LVM snapshot a block device might require locking, but afterwards this will change to the new block device.

An error will be thrown on failure.

Parameters:
type the type of setup being performed
status the exit status of the setup commands (0 for success, nonzero for failure).

References setup_lock().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
ptr const &  rhs 
) [friend]

Print detailed information about the chroot to a stream.

The information is printed in plain text with one line per property.

Parameters:
stream the stream to output to.
rhs the chroot to output.
Returns:
the stream.
keyfile& operator<< ( keyfile keyfile,
ptr const &  rhs 
) [friend]

Chroot serialisation to a keyfile.

keyfile const& operator>> ( keyfile const &  keyfile,
ptr rhs 
) [friend]

Chroot initialisation from a keyfile.


Member Data Documentation

Alternative names for the chroot.

Referenced by get_aliases().

Command prefix.

Referenced by get_command_prefix().

std::string sbuild::chroot::description [private]

Chroot description.

Referenced by get_description().

Environment filter regex.

Referenced by get_environment_filter().

Groups allowed to access the chroot.

Referenced by get_groups().

The message verbosity.

Referenced by get_verbosity(), get_verbosity_string(), and set_verbosity().

std::string sbuild::chroot::mount_location [private]

Location to mount chroot in the filesystem (if any).

Referenced by get_mount_location(), and set_mount_location().

std::string sbuild::chroot::name [private]

Chroot name.

Referenced by get_keyfile_name(), and get_name().

bool sbuild::chroot::original [private]

Was the chroot automatically generated?

Referenced by get_original().

Preserve environment?

Referenced by get_preserve_environment().

unsigned int sbuild::chroot::priority [private]

Chroot priority.

Referenced by get_priority().

Groups allowed to access the chroot as root.

Referenced by get_root_groups(), and set_root_groups().

Users allowed to access the chroot as root.

Referenced by get_root_users(), and set_root_users().

Run chroot setup scripts?

Referenced by get_run_setup_scripts().

std::string sbuild::chroot::script_config [private]

Configuration of the setup and exec scripts.

Referenced by get_script_config().

std::string sbuild::chroot::session_id [private]

Chroot session ID.

Referenced by get_keyfile_name(), and get_session_id().

Users allowed to access the chroot.

Referenced by get_users().


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