1
/* Copyright © 2005-2008 Roger Leigh <rleigh@debian.org>
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.
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.
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/>.
17
*********************************************************************/
19
#ifndef SBUILD_CHROOT_SOURCE_H
20
#define SBUILD_CHROOT_SOURCE_H
22
#include <sbuild/sbuild-chroot.h>
28
* A chroot may offer a "source" chroot in addition to its normal
29
* "session" copy, to allow for maintenence of the source data.
30
* This interface may be implemented by any chroot wishing to
31
* provide such functionality.
33
* While this is effectively an interface, in practice this derives
34
* from sbuild::chroot, to allow setting and getting of data from a
35
* keyfile, including storing the keyfile options.
37
* Chroot types implementing chroot_source should, at a minimum,
38
* implement clone_source(). This should create and return a source
39
* chroot, and must call clone_source_setup() to set up the source
42
class chroot_source : virtual public chroot
52
virtual ~chroot_source ();
55
* Create a source chroot.
57
* @returns a source chroot.
60
clone_source () const = 0;
64
* Set the defaults in the cloned source chroot.
66
* @param clone the chroot to set up.
69
clone_source_setup (chroot::ptr& clone) const;
73
* Get the users allowed to access the source chroot.
75
* @returns a list of users.
77
virtual string_list const&
78
get_source_users () const;
81
* Set the users allowed to access the source chroot.
83
* @param users a list of users.
86
set_source_users (string_list const& users);
89
* Get the groups allowed to access the source chroot.
91
* @returns a list of groups.
93
virtual string_list const&
94
get_source_groups () const;
97
* Set the groups allowed to access the source chroot.
99
* @param groups a list of groups.
102
set_source_groups (string_list const& groups);
105
* Get the users allowed to access the source chroot as root.
106
* Members of these users can switch to root without
107
* authenticating themselves.
109
* @returns a list of users.
111
virtual string_list const&
112
get_source_root_users () const;
115
* Set the users allowed to access the source chroot as root.
116
* Members of these users can switch to root without
117
* authenticating themselves.
119
* @param users a list of users.
122
set_source_root_users (string_list const& users);
125
* Get the groups allowed to access the source chroot as root.
126
* Members of these groups can switch to root without
127
* authenticating themselves.
129
* @returns a list of groups.
131
virtual string_list const&
132
get_source_root_groups () const;
135
* Set the groups allowed to access the source chroot as root.
136
* Members of these groups can switch to root without
137
* authenticating themselves.
139
* @param groups a list of groups.
142
set_source_root_groups (string_list const& groups);
145
setup_env (environment& env);
148
virtual session_flags
149
get_session_flags () const;
152
get_details (format_detail& detail) const;
155
get_keyfile (keyfile& keyfile) const;
158
set_keyfile (keyfile const& keyfile,
159
string_list& used_keys);
162
/// Is the chroot source or clone?
164
/// Users allowed to access the source chroot.
165
string_list source_users;
166
/// Groups allowed to access the source chroot.
167
string_list source_groups;
168
/// Users allowed to access the source chroot as root.
169
string_list source_root_users;
170
/// Groups allowed to access the source chroot as root.
171
string_list source_root_groups;
176
#endif /* SBUILD_CHROOT_SOURCE_H */