64
67
emap init_errors[] =
66
emap(sbuild::chroot::CHROOT_CREATE, N_("Chroot creation failed")),
67
emap(sbuild::chroot::CHROOT_DEVICE, N_("Device name not set")),
69
emap(sbuild::chroot::CHROOT_CREATE, N_("Chroot creation failed")),
70
emap(sbuild::chroot::CHROOT_DEVICE, N_("Device name not set")),
68
71
// TRANSLATORS: %1% = chroot type name
69
emap(sbuild::chroot::CHROOT_TYPE, N_("Unknown chroot type '%1%'")),
70
emap(sbuild::chroot::DEVICE_ABS, N_("Device must have an absolute path")),
71
emap(sbuild::chroot::DEVICE_LOCK, N_("Failed to lock device")),
72
emap(sbuild::chroot::DEVICE_NOTBLOCK, N_("File is not a block device")),
73
emap(sbuild::chroot::DEVICE_UNLOCK, N_("Failed to unlock device")),
74
emap(sbuild::chroot::DIRECTORY_ABS, N_("Directory must have an absolute path")),
75
emap(sbuild::chroot::FACET_INVALID, N_("Attempt to add object which is not a facet")),
76
emap(sbuild::chroot::FACET_PRESENT, N_("Attempt to add facet which is already in use")),
77
emap(sbuild::chroot::FILE_ABS, N_("File must have an absolute path")),
78
emap(sbuild::chroot::FILE_LOCK, N_("Failed to acquire file lock")),
79
emap(sbuild::chroot::FILE_NOTREG, N_("File is not a regular file")),
80
emap(sbuild::chroot::FILE_OWNER, N_("File is not owned by user root")),
81
emap(sbuild::chroot::FILE_PERMS, N_("File has write permissions for others")),
82
emap(sbuild::chroot::FILE_UNLOCK, N_("Failed to discard file lock")),
83
emap(sbuild::chroot::LOCATION_ABS, N_("Location must have an absolute path")),
72
emap(sbuild::chroot::CHROOT_TYPE, N_("Unknown chroot type '%1%'")),
73
emap(sbuild::chroot::DEVICE_ABS, N_("Device must have an absolute path")),
74
emap(sbuild::chroot::DEVICE_LOCK, N_("Failed to lock device")),
75
emap(sbuild::chroot::DEVICE_NOTBLOCK, N_("File is not a block device")),
76
emap(sbuild::chroot::DEVICE_UNLOCK, N_("Failed to unlock device")),
77
emap(sbuild::chroot::DIRECTORY_ABS, N_("Directory must have an absolute path")),
78
emap(sbuild::chroot::FACET_INVALID, N_("Attempt to add object which is not a facet")),
79
emap(sbuild::chroot::FACET_PRESENT, N_("Attempt to add facet which is already in use")),
80
emap(sbuild::chroot::FILE_ABS, N_("File must have an absolute path")),
81
emap(sbuild::chroot::FILE_LOCK, N_("Failed to acquire file lock")),
82
emap(sbuild::chroot::FILE_NOTREG, N_("File is not a regular file")),
83
emap(sbuild::chroot::FILE_OWNER, N_("File is not owned by user root")),
84
emap(sbuild::chroot::FILE_PERMS, N_("File has write permissions for others")),
85
emap(sbuild::chroot::FILE_UNLOCK, N_("Failed to discard file lock")),
86
emap(sbuild::chroot::LOCATION_ABS, N_("Location must have an absolute path")),
84
87
// TRANSLATORS: unlink refers to the C function which removes a file
85
emap(sbuild::chroot::SESSION_UNLINK, N_("Failed to unlink session file")),
86
emap(sbuild::chroot::SESSION_WRITE, N_("Failed to write session file"))
88
emap(sbuild::chroot::SESSION_UNLINK, N_("Failed to unlink session file")),
89
emap(sbuild::chroot::SESSION_WRITE, N_("Failed to write session file")),
90
emap(sbuild::chroot::VERBOSITY_INVALID, N_("Message verbosity is invalid"))
126
132
root_users(rhs.root_users),
127
133
root_groups(rhs.root_groups),
128
134
aliases(rhs.aliases),
135
preserve_environment(rhs.preserve_environment),
129
136
environment_filter(rhs.environment_filter),
130
137
mount_location(rhs.mount_location),
131
138
original(rhs.original),
132
139
run_setup_scripts(rhs.run_setup_scripts),
133
140
script_config(rhs.script_config),
134
141
command_prefix(rhs.command_prefix),
142
message_verbosity(rhs.message_verbosity),
137
145
/// @todo Use internal version of add_facet to add chroot pointer.
382
406
this->command_prefix = command_prefix;
410
chroot::get_verbosity () const
412
return this->message_verbosity;
416
chroot::get_verbosity_string () const
418
const char *verbosity = 0;
420
switch (this->message_verbosity)
422
case chroot::VERBOSITY_QUIET:
425
case chroot::VERBOSITY_NORMAL:
426
verbosity = "normal";
428
case chroot::VERBOSITY_VERBOSE:
429
verbosity = "verbose";
432
log_debug(DEBUG_CRITICAL) << format("Invalid verbosity level: %1%, falling back to 'normal'")
433
% static_cast<int>(this->message_verbosity)
435
verbosity = "normal";
443
chroot::set_verbosity (chroot::verbosity verbosity)
445
this->message_verbosity = verbosity;
449
chroot::set_verbosity (std::string const& verbosity)
451
if (verbosity == "quiet")
452
this->message_verbosity = VERBOSITY_QUIET;
453
else if (verbosity == "normal")
454
this->message_verbosity = VERBOSITY_NORMAL;
455
else if (verbosity == "verbose")
456
this->message_verbosity = VERBOSITY_VERBOSE;
458
throw error(verbosity, VERBOSITY_INVALID);
386
462
sbuild::chroot::list_facets () const
528
604
.add(_("Description"), chroot.get_description())
529
605
.add(_("Type"), chroot.get_chroot_type())
530
606
.add(_("Priority"), chroot.get_priority())
607
.add(_("Message Verbosity"), chroot.get_verbosity_string())
531
608
.add(_("Users"), chroot.get_users())
532
609
.add(_("Groups"), chroot.get_groups())
533
610
.add(_("Root Users"), chroot.get_root_users())
534
611
.add(_("Root Groups"), chroot.get_root_groups())
535
612
.add(_("Aliases"), chroot.get_aliases())
613
.add(_("Preserve Environment"), chroot.get_preserve_environment())
536
614
.add(_("Environment Filter"), chroot.get_environment_filter())
537
615
.add(_("Run Setup Scripts"), chroot.get_run_setup_scripts())
538
616
.add(_("Script Configuration"), chroot.get_script_config())
777
862
"command-prefix",
778
863
keyfile::PRIORITY_OPTIONAL);
779
864
used_keys.push_back("command-prefix");
866
keyfile::get_object_value(chroot, &chroot::set_verbosity,
867
keyfile, chroot.get_keyfile_name(),
869
keyfile::PRIORITY_OPTIONAL);
870
used_keys.push_back("message-verbosity");
872
keyfile::get_object_value(chroot, &chroot::set_preserve_environment,
873
keyfile, chroot.get_keyfile_name(),
874
"preserve-environment",
875
keyfile::PRIORITY_OPTIONAL);
876
used_keys.push_back("preserve-environment");