sbuild  1.6.10
sbuild-chroot-loopback.h
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 
33  class chroot_loopback : public chroot
34  {
35  public:
38 
39  protected:
41  chroot_loopback ();
42 
44  chroot_loopback (const chroot_loopback& rhs);
45 
46  friend class chroot;
47 
48  public:
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& alias,
58  std::string const& user,
59  bool root) const;
60 
61  virtual chroot::ptr
62  clone_source () const;
63 
69  std::string const&
70  get_file () const;
71 
77  void
78  set_file (std::string const& file);
79 
80  std::string const&
81  get_chroot_type () const;
82 
83  virtual std::string
84  get_path () const;
85 
86  virtual void
87  setup_env (chroot const& chroot,
88  environment& env) const;
89 
90  virtual session_flags
91  get_session_flags (chroot const& chroot) const;
92 
93  protected:
94  virtual void
96  bool lock,
97  int status);
98 
99  virtual void
100  get_details (chroot const& chroot,
101  format_detail& detail) const;
102 
103  virtual void
104  get_keyfile (chroot const& chroot,
105  keyfile& keyfile) const;
106 
107  virtual void
109  keyfile const& keyfile,
110  string_list& used_keys);
111 
112  private:
114  std::string file;
115  };
116 
117 }
118 
119 #endif /* SBUILD_CHROOT_LOOPBACK_H */
120 
121 /*
122  * Local Variables:
123  * mode:C++
124  * End:
125  */
A chroot stored in a file for loopback mounting.
Definition: sbuild-chroot-loopback.h:33
Debian source builder components.
Definition: sbuild-auth-null.h:24
virtual void set_keyfile(chroot &chroot, keyfile const &keyfile, string_list &used_keys)
Set the chroot properties from a keyfile.
Definition: sbuild-chroot-loopback.cc:198
virtual chroot::ptr clone_session(std::string const &session_id, std::string const &alias, std::string const &user, bool root) const
Create a session chroot.
Definition: sbuild-chroot-loopback.cc:68
virtual std::string get_path() const
Get the path to the chroot.
Definition: sbuild-chroot-loopback.cc:113
std::string const & get_chroot_type() const
Get the type of the chroot.
Definition: sbuild-chroot-loopback.cc:127
Container of environment variables.
Definition: sbuild-environment.h:38
virtual void setup_env(chroot const &chroot, environment &env) const
Set environment.
Definition: sbuild-chroot-loopback.cc:135
Advisory locking.
Definition: sbuild-lock.h:38
void set_file(std::string const &file)
Set the file containing the chroot.
Definition: sbuild-chroot-loopback.cc:104
Configuration file parser.
Definition: sbuild-basic-keyfile.h:138
virtual chroot::ptr clone() const
Copy the chroot.
Definition: sbuild-chroot-loopback.cc:62
virtual void get_keyfile(chroot const &chroot, keyfile &keyfile) const
Copy the chroot properties into a keyfile.
Definition: sbuild-chroot-loopback.cc:188
std::string file
The file to use.
Definition: sbuild-chroot-loopback.h:114
std::string const & get_file() const
Get the file containing the chroot.
Definition: sbuild-chroot-loopback.cc:98
std::vector< std::string > string_list
A string vector.
Definition: sbuild-types.h:38
Custom error.
Definition: sbuild-custom-error.h:32
session_flags get_session_flags() const
Get the session flags of the chroot.
Definition: sbuild-chroot.cc:638
virtual ~chroot_loopback()
The destructor.
Definition: sbuild-chroot-loopback.cc:51
session_flags
Chroot session properties.
Definition: sbuild-chroot.h:57
virtual chroot::ptr clone_source() const
Create a source chroot.
Definition: sbuild-chroot-loopback.cc:84
virtual void setup_lock(chroot::setup_type type, bool lock, int status)
Unlock a chroot during setup.
Definition: sbuild-chroot-loopback.cc:144
Format names and values for output.
Definition: sbuild-format-detail.h:38
setup_type
Type of setup to perform.
Definition: sbuild-chroot.h:49
chroot::error error
Exception type.
Definition: sbuild-chroot-loopback.h:37
Common chroot data.
Definition: sbuild-chroot.h:45
virtual void get_details(chroot const &chroot, format_detail &detail) const
Get detailed information about the chroot for output.
Definition: sbuild-chroot-loopback.cc:178
chroot_loopback()
The constructor.
Definition: sbuild-chroot-loopback.cc:41
std::shared_ptr< chroot > ptr
A shared_ptr to a chroot object.
Definition: sbuild-chroot.h:105