~ubuntu-branches/ubuntu/trusty/schroot/trusty

« back to all changes in this revision

Viewing changes to sbuild/sbuild-chroot-source.h

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh
  • Date: 2009-11-07 10:46:54 UTC
  • mfrom: (1.1.20 upstream) (2.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20091107104654-kk1fp1icv8dzfyfi
* New upstream development release.
* schroot:
  - Return success when ending a session and the operation
    succeeded (Closes: #554907).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright © 2005-2008  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
 
#ifndef SBUILD_CHROOT_SOURCE_H
20
 
#define SBUILD_CHROOT_SOURCE_H
21
 
 
22
 
#include <sbuild/sbuild-chroot.h>
23
 
 
24
 
namespace sbuild
25
 
{
26
 
 
27
 
  /**
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.
32
 
   *
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.
36
 
   *
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
40
 
   * chroot.
41
 
   */
42
 
  class chroot_source : virtual public chroot
43
 
  {
44
 
  protected:
45
 
    /// The constructor.
46
 
    chroot_source ();
47
 
 
48
 
    friend class chroot;
49
 
 
50
 
  public:
51
 
    /// The destructor.
52
 
    virtual ~chroot_source ();
53
 
 
54
 
    /**
55
 
     * Create a source chroot.
56
 
     *
57
 
     * @returns a source chroot.
58
 
     */
59
 
    virtual chroot::ptr
60
 
    clone_source () const = 0;
61
 
 
62
 
  protected:
63
 
    /**
64
 
     * Set the defaults in the cloned source chroot.
65
 
     *
66
 
     * @param clone the chroot to set up.
67
 
     */
68
 
    void
69
 
    clone_source_setup (chroot::ptr& clone) const;
70
 
 
71
 
  public:
72
 
    /**
73
 
     * Get the users allowed to access the source chroot.
74
 
     *
75
 
     * @returns a list of users.
76
 
     */
77
 
    virtual string_list const&
78
 
    get_source_users () const;
79
 
 
80
 
    /**
81
 
     * Set the users allowed to access the source chroot.
82
 
     *
83
 
     * @param users a list of users.
84
 
     */
85
 
    virtual void
86
 
    set_source_users (string_list const& users);
87
 
 
88
 
    /**
89
 
     * Get the groups allowed to access the source chroot.
90
 
     *
91
 
     * @returns a list of groups.
92
 
     */
93
 
    virtual string_list const&
94
 
    get_source_groups () const;
95
 
 
96
 
    /**
97
 
     * Set the groups allowed to access the source chroot.
98
 
     *
99
 
     * @param groups a list of groups.
100
 
     */
101
 
    virtual void
102
 
    set_source_groups (string_list const& groups);
103
 
 
104
 
    /**
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.
108
 
     *
109
 
     * @returns a list of users.
110
 
     */
111
 
    virtual string_list const&
112
 
    get_source_root_users () const;
113
 
 
114
 
    /**
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.
118
 
     *
119
 
     * @param users a list of users.
120
 
     */
121
 
    virtual void
122
 
    set_source_root_users (string_list const& users);
123
 
 
124
 
    /**
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.
128
 
     *
129
 
     * @returns a list of groups.
130
 
     */
131
 
    virtual string_list const&
132
 
    get_source_root_groups () const;
133
 
 
134
 
    /**
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.
138
 
     *
139
 
     * @param groups a list of groups.
140
 
     */
141
 
    virtual void
142
 
    set_source_root_groups (string_list const& groups);
143
 
 
144
 
    void
145
 
    setup_env (environment& env);
146
 
 
147
 
  protected:
148
 
    virtual session_flags
149
 
    get_session_flags () const;
150
 
 
151
 
    virtual void
152
 
    get_details (format_detail& detail) const;
153
 
 
154
 
    void
155
 
    get_keyfile (keyfile& keyfile) const;
156
 
 
157
 
    void
158
 
    set_keyfile (keyfile const& keyfile,
159
 
                 string_list&   used_keys);
160
 
 
161
 
  private:
162
 
    /// Is the chroot source or clone?
163
 
    bool          is_source;
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;
172
 
  };
173
 
 
174
 
}
175
 
 
176
 
#endif /* SBUILD_CHROOT_SOURCE_H */
177
 
 
178
 
/*
179
 
 * Local Variables:
180
 
 * mode:C++
181
 
 * End:
182
 
 */