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, EXEC_START,
  EXEC_STOP
}
 Type of setup to perform. More...
enum  session_flags { SESSION_CREATE = 1 << 0 }
 Chroot session properties. More...
enum  error_code {
  CHROOT_CREATE, CHROOT_DEVICE, CHROOT_TYPE, DEVICE_ABS,
  DEVICE_LOCK, DEVICE_NOTBLOCK, DEVICE_STAT, DEVICE_UNLOCK,
  FILE_ABS, FILE_LOCK, FILE_NOTREG, FILE_OWNER,
  FILE_PERMS, FILE_STAT, FILE_UNLOCK, LOCATION_ABS,
  SESSION_UNLINK, SESSION_WRITE
}
 Error codes. More...
typedef custom_error< error_codeerror
 Exception type.
typedef std::tr1::shared_ptr<
chroot
ptr
 A shared_ptr to a chroot object.

Public Member Functions

virtual ~chroot ()
 The destructor.
virtual ptr clone () const=0
 Copy the 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_description () const
 Get the description of the chroot.
void set_description (std::string const &description)
 Set the description of the chroot.
virtual 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 const & get_location () const
 Get the location of the chroot.
virtual std::string get_path () const
 Get the path to the chroot.
virtual std::string const & get_mount_device () const
 Get the mount device of the chroot.
void set_mount_device (std::string const &device)
 Set the mount device of 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_active () const
 Get the activity status of the chroot.
void set_active (bool active)
 Set 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.
void set_run_setup_scripts (bool run_setup_scripts)
 Set whether chroot setup scripts will be run.
bool get_run_exec_scripts () const
 Check if chroot exec scripts will be run.
void set_run_exec_scripts (bool run_exec_scripts)
 Set whether chroot exec scripts will be run.
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.
personality const & get_persona () const
 Get the process execution domain for the chroot.
void set_persona (personality const &persona)
 Set the process execution domain for the chroot.
virtual std::string const & get_chroot_type () const=0
 Get the type of the chroot.
virtual void setup_env (environment &env)
 Set environment.
void lock (setup_type type)
 Lock a chroot during setup.
void unlock (setup_type type, int status)
 Unlock a chroot during setup.
virtual session_flags get_session_flags () const=0
 Get the session flags of the chroot.

Static Public Member Functions

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

Protected Member Functions

 chroot ()
 The constructor.
virtual void set_location (std::string const &location)
 Set the location of the chroot.
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_details (format_detail &detail) const
 Get detailed information about the chroot for output.
void print_details (std::ostream &stream) const
 Print detailed information about the chroot to a stream.
virtual void get_keyfile (keyfile &keyfile) const
 Copy the chroot properties into a keyfile.
virtual void set_keyfile (keyfile const &keyfile)
 Set the chroot properties from a keyfile.

Private Attributes

std::string name
 Chroot name.
std::string description
 Chroot description.
unsigned int priority
 Chroot prioroty.
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.
std::string mount_location
 Location to mount chroot in the filesystem (if any).
std::string location
 Location inside the mount location root.
std::string mount_device
 Block device to mount (if any).
bool active
 Chroot activity status.
bool original
 Was the chroot automatically generated?
bool run_setup_scripts
 Run chroot setup scripts?
bool run_exec_scripts
 Run chroot exec scripts?
string_list command_prefix
 Command prefix.
personality persona
 Process execution domain (Linux only).

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.

Definition at line 43 of file sbuild-chroot.h.


Member Typedef Documentation

typedef custom_error<error_code> sbuild::chroot::error

Exception type.

Definition at line 86 of file sbuild-chroot.h.

typedef std::tr1::shared_ptr<chroot> sbuild::chroot::ptr

A shared_ptr to a chroot object.

Definition at line 89 of file sbuild-chroot.h.


Member Enumeration Documentation

enum sbuild::chroot::setup_type

Type of setup to perform.

Enumerator:
SETUP_START  Activate a chroot.
SETUP_RECOVER  Reactivate a chroot.
SETUP_STOP  Deactivate a chroot.
EXEC_START  Start executing a command in an active chroot.
EXEC_STOP  End executing a command in an active chroot.

Definition at line 47 of file sbuild-chroot.h.

enum sbuild::chroot::session_flags

Chroot session properties.

Enumerator:
SESSION_CREATE  The chroot supports session creation.

Definition at line 57 of file sbuild-chroot.h.

enum sbuild::chroot::error_code

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_STAT  Failed to stat device.
DEVICE_UNLOCK  Failed to unlock device.
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_STAT  Failed to stat file.
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.

Definition at line 63 of file sbuild-chroot.h.


Constructor & Destructor Documentation

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

The constructor.

Definition at line 88 of file sbuild-chroot.cc.

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

The destructor.

Definition at line 115 of file sbuild-chroot.cc.


Member Function Documentation

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.

Definition at line 120 of file sbuild-chroot.cc.

References CHROOT_CREATE, and CHROOT_TYPE.

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

Here is the caller graph for this function:

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_directory, sbuild::chroot_file, sbuild::chroot_lvm_snapshot, and sbuild::chroot_plain.

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

Get the name of the chroot.

Returns:
the name.

Definition at line 144 of file sbuild-chroot.cc.

References name.

Referenced by get_details(), get_keyfile(), sbuild::chroot_source::get_keyfile(), sbuild::chroot_lvm_snapshot::get_keyfile(), sbuild::chroot_file::get_keyfile(), sbuild::chroot_directory::get_keyfile(), sbuild::chroot_block_device::get_keyfile(), set_keyfile(), sbuild::chroot_source::set_keyfile(), sbuild::chroot_lvm_snapshot::set_keyfile(), sbuild::chroot_file::set_keyfile(), sbuild::chroot_directory::set_keyfile(), sbuild::chroot_block_device::set_keyfile(), setup_env(), and setup_session_info().

Here is the caller graph for this function:

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

Set the name of the chroot.

Parameters:
name the name.

Definition at line 150 of file sbuild-chroot.cc.

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

Get the description of the chroot.

Returns:
the description.

Definition at line 156 of file sbuild-chroot.cc.

References description.

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

Here is the caller graph for this function:

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

Set the description of the chroot.

Parameters:
description the description.

Definition at line 162 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

std::string const & sbuild::chroot::get_mount_location (  )  const [virtual]

Get the mount location of the chroot.

Returns:
the mount location.

Definition at line 168 of file sbuild-chroot.cc.

References mount_location.

Referenced by get_details(), get_keyfile(), get_path(), sbuild::chroot_directory::get_path(), and setup_env().

Here is the caller graph for this function:

void sbuild::chroot::set_mount_location ( std::string const &  location  ) 

Set the mount location of the chroot.

Parameters:
location the mount location.

Definition at line 174 of file sbuild-chroot.cc.

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

Referenced by set_keyfile().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string const & sbuild::chroot::get_location (  )  const [virtual]

Get the location of the chroot.

This is the path to the root of the chroot, and is typically the same as the mount location, but is overridden by the chroot type if required.

Returns:
the mount location.

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

Definition at line 182 of file sbuild-chroot.cc.

References location.

Referenced by get_details(), sbuild::chroot_directory::get_location(), sbuild::chroot_block_device::get_location(), get_path(), and setup_env().

Here is the caller graph for this function:

void sbuild::chroot::set_location ( std::string const &  location  )  [protected, virtual]

Set the location of the chroot.

This is the path to the root of the chroot, and is typically the same as the mount location, but is overridden by the chroot type if required.

Parameters:
location the mount location.

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

Definition at line 188 of file sbuild-chroot.cc.

References sbuild::is_absname(), and LOCATION_ABS.

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

Here is the call graph for this function:

Here is the caller graph for this function:

std::string sbuild::chroot::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.

Returns:
the path.

Reimplemented in sbuild::chroot_directory.

Definition at line 197 of file sbuild-chroot.cc.

References get_location(), and get_mount_location().

Referenced by get_details(), and setup_env().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string const & sbuild::chroot::get_mount_device (  )  const [virtual]

Get the mount device of the chroot.

Returns:
the device.

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

Definition at line 203 of file sbuild-chroot.cc.

References mount_device.

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

Here is the caller graph for this function:

void sbuild::chroot::set_mount_device ( std::string const &  device  ) 

Set the mount device of the chroot.

Parameters:
device the device.

Definition at line 209 of file sbuild-chroot.cc.

References DEVICE_ABS, sbuild::is_absname(), and mount_device.

Referenced by set_keyfile().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Definition at line 217 of file sbuild-chroot.cc.

References priority.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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.

Definition at line 223 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

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

Get the users allowed to access the chroot.

Returns:
a list of users.

Definition at line 229 of file sbuild-chroot.cc.

References users.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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

Set the users allowed to access the chroot.

Parameters:
users a list of users.

Definition at line 235 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

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

Get the groups allowed to access the chroot.

Returns:
a list of groups.

Definition at line 241 of file sbuild-chroot.cc.

References groups.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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

Set the users allowed to access the chroot.

Parameters:
groups a list of groups.

Definition at line 247 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

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

Get the users allowed to access the chroot as root.

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

Returns:
a list of users.

Definition at line 253 of file sbuild-chroot.cc.

References root_users.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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

Set the users allowed to access the chroot as root.

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

Parameters:
users a list of users.

Definition at line 259 of file sbuild-chroot.cc.

References root_users.

Referenced by set_keyfile().

Here is the caller graph for this function:

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

Get the groups allowed to access the chroot as root.

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

Returns:
a list of groups.

Definition at line 265 of file sbuild-chroot.cc.

References root_groups.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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

Set the groups allowed to access the chroot as root.

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

Parameters:
groups a list of groups.

Definition at line 271 of file sbuild-chroot.cc.

References root_groups.

Referenced by set_keyfile().

Here is the caller graph for this function:

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.

Definition at line 277 of file sbuild-chroot.cc.

References aliases.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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.

Definition at line 283 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

bool sbuild::chroot::get_active (  )  const

Get the activity status of the chroot.

Returns:
true if active, false if inactive

Definition at line 289 of file sbuild-chroot.cc.

References active.

Referenced by get_keyfile(), sbuild::chroot_lvm_snapshot::get_keyfile(), sbuild::chroot_file::get_keyfile(), sbuild::chroot_config::load_keyfile(), set_keyfile(), sbuild::chroot_lvm_snapshot::set_keyfile(), and sbuild::chroot_file::set_keyfile().

Here is the caller graph for this function:

void sbuild::chroot::set_active ( bool  active  ) 

Set the activity status of the chroot.

Parameters:
active true if active, false if inactive

Definition at line 295 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

bool sbuild::chroot::get_original (  )  const

Get the originality of the chroot.

Returns:
true if original, false if generated.

Definition at line 301 of file sbuild-chroot.cc.

References original.

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

Set the originality of the chroot.

Parameters:
original true if original, false if geneated.

Definition at line 307 of file sbuild-chroot.cc.

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.

Definition at line 313 of file sbuild-chroot.cc.

References run_setup_scripts.

Referenced by get_details(), get_keyfile(), sbuild::chroot_directory::get_path(), sbuild::chroot_directory::get_session_flags(), sbuild::session::run_impl(), and sbuild::chroot_directory::setup_lock().

Here is the caller graph for this function:

void sbuild::chroot::set_run_setup_scripts ( bool  run_setup_scripts  ) 

Set whether chroot setup scripts will be run.

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

Definition at line 319 of file sbuild-chroot.cc.

Referenced by sbuild::chroot_file::chroot_file(), sbuild::chroot_lvm_snapshot::chroot_lvm_snapshot(), and set_keyfile().

Here is the caller graph for this function:

bool sbuild::chroot::get_run_exec_scripts (  )  const

Check if chroot exec scripts will be run.

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

Definition at line 325 of file sbuild-chroot.cc.

References run_exec_scripts.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

void sbuild::chroot::set_run_exec_scripts ( bool  run_exec_scripts  ) 

Set whether chroot exec scripts will be run.

Parameters:
run_exec_scripts true if exec scripts will be run, otherwise false.

Definition at line 331 of file sbuild-chroot.cc.

Referenced by sbuild::chroot_file::chroot_file(), sbuild::chroot_lvm_snapshot::chroot_lvm_snapshot(), and set_keyfile().

Here is the caller graph for this function:

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.

Definition at line 337 of file sbuild-chroot.cc.

References command_prefix.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

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.

Definition at line 343 of file sbuild-chroot.cc.

Referenced by set_keyfile().

Here is the caller graph for this function:

personality const & sbuild::chroot::get_persona (  )  const

Get the process execution domain for the chroot.

Returns:
the personality.

Definition at line 349 of file sbuild-chroot.cc.

References persona.

Referenced by get_details(), and get_keyfile().

Here is the caller graph for this function:

void sbuild::chroot::set_persona ( personality const &  persona  ) 

Set the process execution domain for the chroot.

Parameters:
persona the personality.

Definition at line 355 of file sbuild-chroot.cc.

References persona.

Referenced by set_keyfile().

Here is the caller graph for this function:

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

Get the type of the chroot.

Returns:
the chroot type.

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

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

Here is the caller graph for this function:

void sbuild::chroot::setup_env ( environment env  )  [virtual]

Set environment.

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

Parameters:
env the environment to set.

Reimplemented in sbuild::chroot_block_device, sbuild::chroot_file, sbuild::chroot_lvm_snapshot, and sbuild::chroot_source.

Definition at line 361 of file sbuild-chroot.cc.

References sbuild::environment::add(), get_chroot_type(), get_description(), get_location(), get_mount_device(), get_mount_location(), get_name(), and get_path().

Referenced by sbuild::chroot_file::setup_env(), and sbuild::chroot_block_device::setup_env().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 425 of file sbuild-chroot.cc.

References setup_lock().

Referenced by setup_session_info().

Here is the call graph for this function:

Here is the caller graph for this function:

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).

Definition at line 431 of file sbuild-chroot.cc.

References setup_lock().

Here is the call graph for this function:

void sbuild::chroot::setup_session_info ( bool  start  )  [protected, virtual]

Set up persistent session information.

Parameters:
start true if startion, or false if ending a session.

Definition at line 373 of file sbuild-chroot.cc.

References FILE_LOCK, FILE_UNLOCK, get_keyfile(), get_name(), lock(), sbuild::lock::LOCK_EXCLUSIVE, SESSION_UNLINK, and SESSION_WRITE.

Referenced by sbuild::chroot_lvm_snapshot::setup_lock(), sbuild::chroot_file::setup_lock(), and sbuild::chroot_directory::setup_lock().

Here is the call graph for this function:

Here is the caller graph for this function:

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_directory, sbuild::chroot_file, and sbuild::chroot_lvm_snapshot.

Referenced by lock(), and unlock().

Here is the caller graph for this function:

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

Get the session flags of the chroot.

These determine how the Session controlling the chroot will operate.

Returns:
the session flags.

Implemented in sbuild::chroot_block_device, sbuild::chroot_directory, sbuild::chroot_file, and sbuild::chroot_lvm_snapshot.

Referenced by get_details().

Here is the caller graph for this function:

void sbuild::chroot::get_details ( format_detail detail  )  const [protected, virtual]

Get detailed information about the chroot for output.

Parameters:
detail the details to output to.

Reimplemented in sbuild::chroot_block_device, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_lvm_snapshot, and sbuild::chroot_source.

Definition at line 439 of file sbuild-chroot.cc.

References _, sbuild::format_detail::add(), get_aliases(), get_chroot_type(), get_command_prefix(), get_description(), get_groups(), get_location(), get_mount_device(), get_mount_location(), get_name(), get_path(), get_persona(), get_priority(), get_root_groups(), get_root_users(), get_run_exec_scripts(), get_run_setup_scripts(), get_session_flags(), get_users(), and SESSION_CREATE.

Referenced by sbuild::chroot_file::get_details(), sbuild::chroot_directory::get_details(), sbuild::chroot_block_device::get_details(), and print_details().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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.

Definition at line 475 of file sbuild-chroot.cc.

References _, and get_details().

Here is the call graph for this function:

void sbuild::chroot::get_keyfile ( 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.

Parameters:
keyfile the keyfile to use.

Reimplemented in sbuild::chroot_block_device, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_lvm_snapshot, and sbuild::chroot_source.

Definition at line 486 of file sbuild-chroot.cc.

References get_active(), get_aliases(), get_chroot_type(), get_command_prefix(), get_description(), get_groups(), get_mount_device(), get_mount_location(), get_name(), get_persona(), get_priority(), get_root_groups(), get_root_users(), get_run_exec_scripts(), get_run_setup_scripts(), get_users(), sbuild::keyfile::remove_group(), sbuild::keyfile::set_object_list_value(), and sbuild::keyfile::set_object_value().

Referenced by sbuild::chroot_file::get_keyfile(), sbuild::chroot_directory::get_keyfile(), sbuild::chroot_block_device::get_keyfile(), and setup_session_info().

Here is the call graph for this function:

Here is the caller graph for this function:

void sbuild::chroot::set_keyfile ( keyfile const &  keyfile  )  [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.

Parameters:
keyfile the keyfile to get the properties from.

Reimplemented in sbuild::chroot_block_device, sbuild::chroot_directory, sbuild::chroot_file, sbuild::chroot_lvm_snapshot, and sbuild::chroot_source.

Definition at line 539 of file sbuild-chroot.cc.

References get_active(), get_name(), sbuild::keyfile::get_object_list_value(), sbuild::keyfile::get_object_value(), sbuild::keyfile::PRIORITY_DEPRECATED, sbuild::keyfile::PRIORITY_DISALLOWED, sbuild::keyfile::PRIORITY_OPTIONAL, sbuild::keyfile::PRIORITY_REQUIRED, set_active(), set_aliases(), set_command_prefix(), set_description(), set_groups(), set_mount_device(), set_mount_location(), set_persona(), set_priority(), set_root_groups(), set_root_users(), set_run_exec_scripts(), set_run_setup_scripts(), and set_users().

Referenced by sbuild::chroot_file::set_keyfile(), sbuild::chroot_directory::set_keyfile(), and sbuild::chroot_block_device::set_keyfile().

Here is the call graph for this function:

Here is the caller graph for this function:


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.

Definition at line 520 of file sbuild-chroot.h.

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

Chroot initialisation from a keyfile.

Definition at line 532 of file sbuild-chroot.h.

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

Chroot serialisation to a keyfile.

Definition at line 544 of file sbuild-chroot.h.


Member Data Documentation

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

Chroot name.

Definition at line 593 of file sbuild-chroot.h.

Referenced by get_name().

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

Chroot description.

Definition at line 595 of file sbuild-chroot.h.

Referenced by get_description().

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

Chroot prioroty.

Definition at line 597 of file sbuild-chroot.h.

Referenced by get_priority().

string_list sbuild::chroot::users [private]

Users allowed to access the chroot.

Definition at line 599 of file sbuild-chroot.h.

Referenced by get_users().

string_list sbuild::chroot::groups [private]

Groups allowed to access the chroot.

Definition at line 601 of file sbuild-chroot.h.

Referenced by get_groups().

string_list sbuild::chroot::root_users [private]

Users allowed to access the chroot as root.

Definition at line 603 of file sbuild-chroot.h.

Referenced by get_root_users(), and set_root_users().

string_list sbuild::chroot::root_groups [private]

Groups allowed to access the chroot as root.

Definition at line 605 of file sbuild-chroot.h.

Referenced by get_root_groups(), and set_root_groups().

string_list sbuild::chroot::aliases [private]

Alternative names for the chroot.

Definition at line 607 of file sbuild-chroot.h.

Referenced by sbuild::chroot_source::clone_source_setup(), and get_aliases().

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

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

Definition at line 609 of file sbuild-chroot.h.

Referenced by get_mount_location(), and set_mount_location().

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

Location inside the mount location root.

Definition at line 611 of file sbuild-chroot.h.

Referenced by get_location().

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

Block device to mount (if any).

Definition at line 613 of file sbuild-chroot.h.

Referenced by get_mount_device(), and set_mount_device().

bool sbuild::chroot::active [private]

Chroot activity status.

Definition at line 615 of file sbuild-chroot.h.

Referenced by get_active().

bool sbuild::chroot::original [private]

Was the chroot automatically generated?

Definition at line 617 of file sbuild-chroot.h.

Referenced by get_original().

bool sbuild::chroot::run_setup_scripts [private]

Run chroot setup scripts?

Definition at line 619 of file sbuild-chroot.h.

Referenced by get_run_setup_scripts().

bool sbuild::chroot::run_exec_scripts [private]

Run chroot exec scripts?

Definition at line 621 of file sbuild-chroot.h.

Referenced by get_run_exec_scripts().

string_list sbuild::chroot::command_prefix [private]

Command prefix.

Definition at line 623 of file sbuild-chroot.h.

Referenced by get_command_prefix().

personality sbuild::chroot::persona [private]

Process execution domain (Linux only).

Definition at line 625 of file sbuild-chroot.h.

Referenced by get_persona(), and set_persona().


The documentation for this class was generated from the following files:
Generated on Sat Jan 27 16:14:00 2007 for schroot by  doxygen 1.5.1