1 | /* Copyright © 2005-2009 Roger Leigh <rleigh@debian.org> |
---|
2 | * |
---|
3 | * schroot is free software: you can redistribute it and/or modify it |
---|
4 | * under the terms of the GNU General Public License as published by |
---|
5 | * the Free Software Foundation, either version 3 of the License, or |
---|
6 | * (at your option) any later version. |
---|
7 | * |
---|
8 | * schroot is distributed in the hope that it will be useful, but |
---|
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | * General Public License for more details. |
---|
12 | * |
---|
13 | * You should have received a copy of the GNU General Public License |
---|
14 | * along with this program. If not, see |
---|
15 | * <http://www.gnu.org/licenses/>. |
---|
16 | * |
---|
17 | *********************************************************************/ |
---|
18 | |
---|
19 | #include <config.h> |
---|
20 | |
---|
21 | #include "sbuild-chroot.h" |
---|
22 | #include "sbuild-chroot-facet-personality.h" |
---|
23 | |
---|
24 | #include <boost/format.hpp> |
---|
25 | |
---|
26 | using boost::format; |
---|
27 | using namespace sbuild; |
---|
28 | |
---|
29 | chroot_facet_personality::chroot_facet_personality (): |
---|
30 | chroot_facet(), |
---|
31 | persona( |
---|
32 | #ifdef __linux__ |
---|
33 | personality("linux") |
---|
34 | #else |
---|
35 | personality("undefined") |
---|
36 | #endif |
---|
37 | ) |
---|
38 | { |
---|
39 | } |
---|
40 | |
---|
41 | chroot_facet_personality::~chroot_facet_personality () |
---|
42 | { |
---|
43 | } |
---|
44 | |
---|
45 | chroot_facet_personality::ptr |
---|
46 | chroot_facet_personality::create () |
---|
47 | { |
---|
48 | return ptr(new chroot_facet_personality()); |
---|
49 | } |
---|
50 | |
---|
51 | chroot_facet::ptr |
---|
52 | chroot_facet_personality::clone () const |
---|
53 | { |
---|
54 | return ptr(new chroot_facet_personality(*this)); |
---|
55 | } |
---|
56 | |
---|
57 | std::string const& |
---|
58 | chroot_facet_personality::get_name () const |
---|
59 | { |
---|
60 | static const std::string name("personality"); |
---|
61 | |
---|
62 | return name; |
---|
63 | } |
---|
64 | |
---|
65 | personality const& |
---|
66 | chroot_facet_personality::get_persona () const |
---|
67 | { |
---|
68 | return this->persona; |
---|
69 | } |
---|
70 | |
---|
71 | void |
---|
72 | chroot_facet_personality::set_persona (personality const& persona) |
---|
73 | { |
---|
74 | this->persona = persona; |
---|
75 | } |
---|
76 | |
---|
77 | void |
---|
78 | chroot_facet_personality::setup_env (chroot const& chroot, |
---|
79 | environment& env) const |
---|
80 | { |
---|
81 | } |
---|
82 | |
---|
83 | chroot::session_flags |
---|
84 | chroot_facet_personality::get_session_flags (chroot const& chroot) const |
---|
85 | { |
---|
86 | return sbuild::chroot::SESSION_NOFLAGS; |
---|
87 | } |
---|
88 | |
---|
89 | void |
---|
90 | chroot_facet_personality::get_details (chroot const& chroot, |
---|
91 | format_detail& detail) const |
---|
92 | { |
---|
93 | // TRANSLATORS: "Personality" is the Linux kernel personality |
---|
94 | // (process execution domain). See schroot.conf(5). |
---|
95 | detail.add(_("Personality"), get_persona().get_name()); |
---|
96 | } |
---|
97 | |
---|
98 | void |
---|
99 | chroot_facet_personality::get_keyfile (chroot const& chroot, |
---|
100 | keyfile& keyfile) const |
---|
101 | { |
---|
102 | keyfile::set_object_value(*this, &chroot_facet_personality::get_persona, |
---|
103 | keyfile, chroot.get_keyfile_name(), "personality"); |
---|
104 | } |
---|
105 | |
---|
106 | void |
---|
107 | chroot_facet_personality::set_keyfile (chroot& chroot, |
---|
108 | keyfile const& keyfile, |
---|
109 | string_list& used_keys) |
---|
110 | { |
---|
111 | keyfile::get_object_value(*this, &chroot_facet_personality::set_persona, |
---|
112 | keyfile, chroot.get_keyfile_name(), "personality", |
---|
113 | keyfile::PRIORITY_OPTIONAL); |
---|
114 | used_keys.push_back("personality"); |
---|
115 | } |
---|