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_FILE_H |
---|
20 | #define SBUILD_CHROOT_FILE_H |
---|
21 | |
---|
22 | #include <sbuild/sbuild-chroot.h> |
---|
23 | |
---|
24 | namespace sbuild |
---|
25 | { |
---|
26 | |
---|
27 | /** |
---|
28 | * A chroot stored in a file archive (tar or zip). |
---|
29 | * |
---|
30 | * The archive will be unpacked and repacked on demand. |
---|
31 | */ |
---|
32 | class chroot_file : public chroot |
---|
33 | { |
---|
34 | protected: |
---|
35 | /// The constructor. |
---|
36 | chroot_file (); |
---|
37 | |
---|
38 | /// The copy constructor. |
---|
39 | chroot_file (const chroot_file& rhs); |
---|
40 | |
---|
41 | friend class chroot; |
---|
42 | |
---|
43 | public: |
---|
44 | /// The destructor. |
---|
45 | virtual ~chroot_file (); |
---|
46 | |
---|
47 | virtual chroot::ptr |
---|
48 | clone () const; |
---|
49 | |
---|
50 | virtual chroot::ptr |
---|
51 | clone_session (std::string const& session_id, |
---|
52 | std::string const& user, |
---|
53 | bool root) const; |
---|
54 | |
---|
55 | virtual chroot::ptr |
---|
56 | clone_source () const; |
---|
57 | |
---|
58 | /** |
---|
59 | * Get the file used by the chroot. |
---|
60 | * |
---|
61 | * @returns the file. |
---|
62 | */ |
---|
63 | std::string const& |
---|
64 | get_file () const; |
---|
65 | |
---|
66 | /** |
---|
67 | * Set the file used by the chroot. |
---|
68 | * |
---|
69 | * @param file the file. |
---|
70 | */ |
---|
71 | void |
---|
72 | set_file (std::string const& file); |
---|
73 | |
---|
74 | /** |
---|
75 | * Get the repack status. This is true if the unpacked archive |
---|
76 | * file will be repacked. |
---|
77 | * |
---|
78 | * @returns the repack status. |
---|
79 | */ |
---|
80 | bool |
---|
81 | get_file_repack () const; |
---|
82 | |
---|
83 | /** |
---|
84 | * Set the file repack status. Set to true if the unpacked |
---|
85 | * archive file will be repacked on session cleanup, or false to |
---|
86 | * discard. |
---|
87 | * |
---|
88 | * @param repack the repack status. |
---|
89 | */ |
---|
90 | void |
---|
91 | set_file_repack (bool repack); |
---|
92 | |
---|
93 | virtual std::string const& |
---|
94 | get_chroot_type () const; |
---|
95 | |
---|
96 | virtual void |
---|
97 | setup_env (chroot const& chroot, |
---|
98 | environment& env) const; |
---|
99 | |
---|
100 | std::string |
---|
101 | get_path () const; |
---|
102 | |
---|
103 | virtual session_flags |
---|
104 | get_session_flags (chroot const& chroot) const; |
---|
105 | |
---|
106 | protected: |
---|
107 | virtual void |
---|
108 | setup_lock (chroot::setup_type type, |
---|
109 | bool lock, |
---|
110 | int status); |
---|
111 | |
---|
112 | virtual void |
---|
113 | get_details (chroot const& chroot, |
---|
114 | format_detail& detail) const; |
---|
115 | |
---|
116 | virtual void |
---|
117 | get_keyfile (chroot const& chroot, |
---|
118 | keyfile& keyfile) const; |
---|
119 | |
---|
120 | virtual void |
---|
121 | set_keyfile (chroot& chroot, |
---|
122 | keyfile const& keyfile, |
---|
123 | string_list& used_keys); |
---|
124 | |
---|
125 | private: |
---|
126 | /// The file to use. |
---|
127 | std::string file; |
---|
128 | /// Should the chroot be repacked? |
---|
129 | bool repack; |
---|
130 | }; |
---|
131 | |
---|
132 | } |
---|
133 | |
---|
134 | #endif /* SBUILD_CHROOT_FILE_H */ |
---|
135 | |
---|
136 | /* |
---|
137 | * Local Variables: |
---|
138 | * mode:C++ |
---|
139 | * End: |
---|
140 | */ |
---|