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_LOOPBACK_H |
---|
20 | #define SBUILD_CHROOT_LOOPBACK_H |
---|
21 | |
---|
22 | #include <sbuild/sbuild-config.h> |
---|
23 | #include <sbuild/sbuild-chroot.h> |
---|
24 | |
---|
25 | namespace sbuild |
---|
26 | { |
---|
27 | |
---|
28 | /** |
---|
29 | * A chroot stored in a file for loopback mounting. |
---|
30 | * |
---|
31 | * The file will be mounted on demand. |
---|
32 | */ |
---|
33 | class chroot_loopback : public chroot |
---|
34 | { |
---|
35 | public: |
---|
36 | /// Exception type. |
---|
37 | typedef chroot::error error; |
---|
38 | |
---|
39 | protected: |
---|
40 | /// The constructor. |
---|
41 | chroot_loopback (); |
---|
42 | |
---|
43 | /// The copy constructor. |
---|
44 | chroot_loopback (const chroot_loopback& rhs); |
---|
45 | |
---|
46 | friend class chroot; |
---|
47 | |
---|
48 | public: |
---|
49 | /// The destructor. |
---|
50 | virtual ~chroot_loopback (); |
---|
51 | |
---|
52 | virtual chroot::ptr |
---|
53 | clone () const; |
---|
54 | |
---|
55 | virtual chroot::ptr |
---|
56 | clone_session (std::string const& session_id, |
---|
57 | std::string const& user, |
---|
58 | bool root) const; |
---|
59 | |
---|
60 | virtual chroot::ptr |
---|
61 | clone_source () const; |
---|
62 | |
---|
63 | /** |
---|
64 | * Get the file containing the chroot. |
---|
65 | * |
---|
66 | * @returns the file. |
---|
67 | */ |
---|
68 | std::string const& |
---|
69 | get_file () const; |
---|
70 | |
---|
71 | /** |
---|
72 | * Set the file containing the chroot. |
---|
73 | * |
---|
74 | * @param file the file. |
---|
75 | */ |
---|
76 | void |
---|
77 | set_file (std::string const& file); |
---|
78 | |
---|
79 | std::string const& |
---|
80 | get_chroot_type () const; |
---|
81 | |
---|
82 | virtual std::string |
---|
83 | get_path () const; |
---|
84 | |
---|
85 | virtual void |
---|
86 | setup_env (chroot const& chroot, |
---|
87 | environment& env) const; |
---|
88 | |
---|
89 | virtual session_flags |
---|
90 | get_session_flags (chroot const& chroot) const; |
---|
91 | |
---|
92 | protected: |
---|
93 | virtual void |
---|
94 | setup_lock (chroot::setup_type type, |
---|
95 | bool lock, |
---|
96 | int status); |
---|
97 | |
---|
98 | virtual void |
---|
99 | get_details (chroot const& chroot, |
---|
100 | format_detail& detail) const; |
---|
101 | |
---|
102 | virtual void |
---|
103 | get_keyfile (chroot const& chroot, |
---|
104 | keyfile& keyfile) const; |
---|
105 | |
---|
106 | virtual void |
---|
107 | set_keyfile (chroot& chroot, |
---|
108 | keyfile const& keyfile, |
---|
109 | string_list& used_keys); |
---|
110 | |
---|
111 | private: |
---|
112 | /// The file to use. |
---|
113 | std::string file; |
---|
114 | }; |
---|
115 | |
---|
116 | } |
---|
117 | |
---|
118 | #endif /* SBUILD_CHROOT_LOOPBACK_H */ |
---|
119 | |
---|
120 | /* |
---|
121 | * Local Variables: |
---|
122 | * mode:C++ |
---|
123 | * End: |
---|
124 | */ |
---|