Logo Search packages:      
Sourcecode: schroot version File versions  Download package

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_file, sbuild::chroot_lvm_snapshot, sbuild::chroot_plain, and sbuild::chroot_source.

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

References active, aliases, command_prefix, description, get_active(), sbuild::keyfile::get_list_value(), sbuild::keyfile::get_locale_string(), sbuild::keyfile::get_value(), groups, mount_device, mount_location, priority, sbuild::keyfile::PRIORITY_DEPRECATED, sbuild::keyfile::PRIORITY_DISALLOWED, sbuild::keyfile::PRIORITY_OPTIONAL, sbuild::keyfile::PRIORITY_REQUIRED, root_groups, run_exec_scripts, run_setup_scripts, set_active(), set_aliases(), set_command_prefix(), set_description(), set_groups(), set_mount_device(), set_mount_location(), set_priority(), set_root_groups(), set_run_exec_scripts(), and set_run_setup_scripts().

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

{
  // This is set not in the configuration file, but set in the keyfile
  // manually.  The user must not have the ability to set this option.
  bool active(false);
  if (keyfile.get_value(this->name, "active",
                  keyfile::PRIORITY_REQUIRED, active))
    set_active(active);

  bool run_setup_scripts(false);
  if (keyfile.get_value(this->name, "run-setup-scripts",
                  keyfile::PRIORITY_OPTIONAL, run_setup_scripts))
    set_run_setup_scripts(run_setup_scripts);

  bool run_exec_scripts(false);
  if (keyfile.get_value(this->name, "run-session-scripts",
                  keyfile::PRIORITY_DEPRECATED, run_exec_scripts))
    set_run_exec_scripts(run_exec_scripts);
  if (keyfile.get_value(this->name, "run-exec-scripts",
                  keyfile::PRIORITY_OPTIONAL, run_exec_scripts))
    set_run_exec_scripts(run_exec_scripts);

  int priority(0);
  if (keyfile.get_value(this->name, "priority",
                  keyfile::PRIORITY_OPTIONAL, priority))
    set_priority(priority);

  string_list aliases;
  if (keyfile.get_list_value(this->name, "aliases",
                       keyfile::PRIORITY_OPTIONAL, aliases))
    set_aliases(aliases);

  std::string description;
  if (keyfile.get_locale_string(this->name, "description",
                        keyfile::PRIORITY_OPTIONAL, description))
    set_description(description);

  string_list groups;
  if (keyfile.get_list_value(this->name, "groups",
                       keyfile::PRIORITY_REQUIRED, groups))
    set_groups(groups);

  string_list root_groups;
  if (keyfile.get_list_value(this->name, "root-groups",
                       keyfile::PRIORITY_OPTIONAL, root_groups))
    set_root_groups(root_groups);

  std::string mount_location;
  if (keyfile.get_value(this->name, "mount-location",
                  get_active() ?
                  keyfile::PRIORITY_REQUIRED : keyfile::PRIORITY_DISALLOWED,
                  mount_location))
    set_mount_location(mount_location);

  std::string mount_device;
  if (keyfile.get_value(this->name, "mount-device",
                  get_active() ?
                  keyfile::PRIORITY_OPTIONAL : keyfile::PRIORITY_DISALLOWED,
                  mount_device))
    set_mount_device(mount_device);

  string_list command_prefix;
  if (keyfile.get_list_value(this->name, "command-prefix",
                       keyfile::PRIORITY_OPTIONAL, command_prefix))
    set_command_prefix(command_prefix);
}


Generated by  Doxygen 1.6.0   Back to index