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 | #ifndef SBUILD_CHROOT_FACET_MOUNTABLE_H |
---|
20 | #define SBUILD_CHROOT_FACET_MOUNTABLE_H |
---|
21 | |
---|
22 | #include <sbuild/sbuild-chroot-facet.h> |
---|
23 | |
---|
24 | namespace sbuild |
---|
25 | { |
---|
26 | |
---|
27 | /** |
---|
28 | * Chroot support for mountable devices and filesystems. |
---|
29 | * |
---|
30 | * This facet should be selected for sessions using the mount |
---|
31 | * command to create the chroot. The specified device will be |
---|
32 | * mounted on demand. |
---|
33 | * |
---|
34 | * This facet is not restricted to block devices and can also be |
---|
35 | * used for network filesystems, loopback files and other |
---|
36 | * mountable objects. |
---|
37 | */ |
---|
38 | class chroot_facet_mountable : public chroot_facet |
---|
39 | { |
---|
40 | public: |
---|
41 | /// A shared_ptr to a chroot facet object. |
---|
42 | typedef std::tr1::shared_ptr<chroot_facet_mountable> ptr; |
---|
43 | |
---|
44 | /// A shared_ptr to a const chroot facet object. |
---|
45 | typedef std::tr1::shared_ptr<const chroot_facet_mountable> const_ptr; |
---|
46 | |
---|
47 | private: |
---|
48 | /// The constructor. |
---|
49 | chroot_facet_mountable (); |
---|
50 | |
---|
51 | public: |
---|
52 | /// The destructor. |
---|
53 | virtual ~chroot_facet_mountable (); |
---|
54 | |
---|
55 | /** |
---|
56 | * Create a chroot facet. |
---|
57 | * |
---|
58 | * @returns a shared_ptr to the new chroot facet. |
---|
59 | */ |
---|
60 | static ptr |
---|
61 | create (); |
---|
62 | |
---|
63 | virtual chroot_facet::ptr |
---|
64 | clone () const; |
---|
65 | |
---|
66 | virtual std::string const& |
---|
67 | get_name () const; |
---|
68 | |
---|
69 | /** |
---|
70 | * Get the device path of the chroot block device to mount. |
---|
71 | * |
---|
72 | * @returns the mount device. |
---|
73 | */ |
---|
74 | virtual std::string const& |
---|
75 | get_mount_device () const; |
---|
76 | |
---|
77 | /** |
---|
78 | * Set the device path of the chroot block device to mount. |
---|
79 | * |
---|
80 | * @param mount_device the mount device. |
---|
81 | */ |
---|
82 | virtual void |
---|
83 | set_mount_device (std::string const& mount_device); |
---|
84 | |
---|
85 | /** |
---|
86 | * Get the filesystem mount options of the chroot block device. |
---|
87 | * |
---|
88 | * @returns the mount options. |
---|
89 | */ |
---|
90 | virtual std::string const& |
---|
91 | get_mount_options () const; |
---|
92 | |
---|
93 | /** |
---|
94 | * Set the filesystem mount options of the chroot block device. |
---|
95 | * |
---|
96 | * @param mount_options the mount options. |
---|
97 | */ |
---|
98 | virtual void |
---|
99 | set_mount_options (std::string const& mount_options); |
---|
100 | |
---|
101 | /** |
---|
102 | * Get the location. This is a path to the chroot directory |
---|
103 | * inside the device (absolute path from the device root). |
---|
104 | * |
---|
105 | * @returns the location. |
---|
106 | */ |
---|
107 | virtual std::string const& |
---|
108 | get_location () const; |
---|
109 | |
---|
110 | /** |
---|
111 | * Set the location. This is a path to the chroot directory |
---|
112 | * inside the device (absolute path from the device root). |
---|
113 | * |
---|
114 | * @param location the location. |
---|
115 | */ |
---|
116 | virtual void |
---|
117 | set_location (std::string const& location); |
---|
118 | |
---|
119 | virtual void |
---|
120 | setup_env (chroot const& chroot, |
---|
121 | environment& env) const; |
---|
122 | |
---|
123 | virtual chroot::session_flags |
---|
124 | get_session_flags (chroot const& chroot) const; |
---|
125 | |
---|
126 | virtual void |
---|
127 | get_details (chroot const& chroot, |
---|
128 | format_detail& detail) const; |
---|
129 | |
---|
130 | virtual void |
---|
131 | get_keyfile (chroot const& chroot, |
---|
132 | keyfile& keyfile) const; |
---|
133 | |
---|
134 | virtual void |
---|
135 | set_keyfile (chroot& chroot, |
---|
136 | keyfile const& keyfile, |
---|
137 | string_list& used_keys); |
---|
138 | |
---|
139 | private: |
---|
140 | /// The device to mount. |
---|
141 | std::string mount_device; |
---|
142 | /// The options to mount the device with. |
---|
143 | std::string mount_options; |
---|
144 | /// Location inside the mount location root. |
---|
145 | std::string location; |
---|
146 | }; |
---|
147 | |
---|
148 | } |
---|
149 | |
---|
150 | #endif /* SBUILD_CHROOT_FACET_MOUNTABLE_H */ |
---|
151 | |
---|
152 | /* |
---|
153 | * Local Variables: |
---|
154 | * mode:C++ |
---|
155 | * End: |
---|
156 | */ |
---|