~ubuntu-branches/ubuntu/maverick/schroot/maverick-updates

« back to all changes in this revision

Viewing changes to doc/schroot/html/dchroot-main-base_8cc-source.html

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh
  • Date: 2008-01-20 22:51:04 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080120225104-3zhs8gk9byqigato
Tags: 1.1.6-1
* New upstream development release.
* Acknowledge NMU.  Thanks to Lucas Nussbaum for fixing the Boost
  library names following another incompatible change in Boost
  (Closes: #439215).
* debian/control: Suggest lvm2 instead of lvm-common (Closes: #452263).
* debian/copyright:
  - Update with new GIT source code repository location.
  - Update licence to GPLv3.
* debian/schroot.init: Update licence to GPLv3.
* bin/schroot/setup/20network, bin/schroot/setup/30passwd: For files to
  copy, compare file device, inode and contents to avoid copying
  identical files (Closes: #428808).
* If unknown keys are present in the configuration file, print a warning
  message to alert the user (Closes: #459658).
* The filesystems to mount in the chroot may be customised by the system
  administrator through the use of an fstab file on a per-chroot basis,
  and a new helper utility, schroot-mount (Closes: #395062, #427047).
  Thanks for your patience while we took the time to implement this the
  right way.
* Update Vietnamese translation (Closes: #461531).  Thanks to Clytie
  Siddall.
* debian/schroot.preinst: Add rm_conffile function to remove
  /etc/schroot/setup.d/20network and /etc/schroot/setup.d/30passwd for
  versions prior to this.  These are replaced by
  /etc/schroot/setup.d/20copyfiles.
* debian/schroot.NEWS: Document conffile changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
5
<link href="tabs.css" rel="stylesheet" type="text/css">
6
6
</head><body>
7
 
<!-- Generated by Doxygen 1.5.2 -->
 
7
<!-- Generated by Doxygen 1.5.4 -->
8
8
<div class="tabs">
9
9
  <ul>
10
10
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
15
15
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
16
16
  </ul>
17
17
</div>
18
 
<div class="tabs">
19
 
  <ul>
20
 
    <li><a href="files.html"><span>File&nbsp;List</span></a></li>
21
 
    <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
22
 
  </ul>
23
 
</div>
24
18
<div class="nav">
25
 
<a class="el" href="dir_101a379c6bb6ea5a405fc1dc3c87af45.html">bin</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_371826f56c30980ba8ffa3c1aaf927e5.html">dchroot</a></div>
 
19
<a class="el" href="dir_85aaf03b3f18b2b8320021a91397a390.html">bin</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_1464a4cea228427c85c68a675424585d.html">dchroot</a></div>
26
20
<h1>dchroot-main-base.cc</h1><a href="dchroot-main-base_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* Copyright © 2005-2007  Roger Leigh &lt;rleigh@debian.org&gt;</span>
27
21
<a name="l00002"></a>00002 <span class="comment"> *</span>
28
 
<a name="l00003"></a>00003 <span class="comment"> * schroot is free software; you can redistribute it and/or modify it</span>
 
22
<a name="l00003"></a>00003 <span class="comment"> * schroot is free software: you can redistribute it and/or modify it</span>
29
23
<a name="l00004"></a>00004 <span class="comment"> * under the terms of the GNU General Public License as published by</span>
30
 
<a name="l00005"></a>00005 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
 
24
<a name="l00005"></a>00005 <span class="comment"> * the Free Software Foundation, either version 3 of the License, or</span>
31
25
<a name="l00006"></a>00006 <span class="comment"> * (at your option) any later version.</span>
32
26
<a name="l00007"></a>00007 <span class="comment"> *</span>
33
27
<a name="l00008"></a>00008 <span class="comment"> * schroot is distributed in the hope that it will be useful, but</span>
36
30
<a name="l00011"></a>00011 <span class="comment"> * General Public License for more details.</span>
37
31
<a name="l00012"></a>00012 <span class="comment"> *</span>
38
32
<a name="l00013"></a>00013 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
39
 
<a name="l00014"></a>00014 <span class="comment"> * along with this program; if not, write to the Free Software</span>
40
 
<a name="l00015"></a>00015 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston,</span>
41
 
<a name="l00016"></a>00016 <span class="comment"> * MA  02111-1307  USA</span>
42
 
<a name="l00017"></a>00017 <span class="comment"> *</span>
43
 
<a name="l00018"></a>00018 <span class="comment"> *********************************************************************/</span>
44
 
<a name="l00019"></a>00019 
45
 
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;config.h&gt;</span>
46
 
<a name="l00021"></a>00021 
47
 
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="dchroot-main_8h.html">dchroot-main.h</a>"</span>
48
 
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="dchroot-chroot-config_8h.html">dchroot-chroot-config.h</a>"</span>
49
 
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="dchroot-session_8h.html">dchroot-session.h</a>"</span>
50
 
<a name="l00025"></a>00025 
51
 
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
52
 
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;iostream&gt;</span>
53
 
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;locale&gt;</span>
54
 
<a name="l00029"></a>00029 
55
 
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
56
 
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;sys/stat.h&gt;</span>
57
 
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;termios.h&gt;</span>
58
 
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
59
 
<a name="l00034"></a>00034 
60
 
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;boost/format.hpp&gt;</span>
61
 
<a name="l00036"></a>00036 
62
 
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;syslog.h&gt;</span>
63
 
<a name="l00038"></a>00038 
64
 
<a name="l00039"></a>00039 <span class="keyword">using</span> std::endl;
65
 
<a name="l00040"></a>00040 <span class="keyword">using</span> boost::format;
66
 
<a name="l00041"></a>00041 <span class="keyword">using</span> sbuild::_;
67
 
<a name="l00042"></a>00042 <span class="keyword">using</span> <a class="code" href="classschroot_1_1options__base.html" title="Basic schroot command-line options.">schroot::options_base</a>;
68
 
<a name="l00043"></a>00043 <span class="keyword">using namespace </span>dchroot;
69
 
<a name="l00044"></a>00044 
70
 
<a name="l00045"></a><a class="code" href="classdchroot_1_1main__base.html#81731388c0ec393ddbf866b3bfec5c91">00045</a> main_base::main_base (std::string <span class="keyword">const</span>&amp; program_name,
71
 
<a name="l00046"></a>00046                       std::string <span class="keyword">const</span>&amp; program_usage,
72
 
<a name="l00047"></a>00047                       <a class="code" href="classschroot_1_1options__base.html#f263f91b2073c330e89a81bf77615b05" title="A shared_ptr to an options_base object.">schroot::options_base::ptr</a>&amp; <a class="code" href="classdchroot_1_1options.html" title="dchroot command-line options.">options</a>):
73
 
<a name="l00048"></a>00048   schroot::<a class="code" href="classdchroot_1_1main__base.html" title="Frontend base class for dchroot.">main_base</a>(program_name, program_usage, options, true),
74
 
<a name="l00049"></a>00049   use_dchroot_conf(false)
75
 
<a name="l00050"></a>00050 {
76
 
<a name="l00051"></a>00051 }
77
 
<a name="l00052"></a>00052 
78
 
<a name="l00053"></a><a class="code" href="classdchroot_1_1main__base.html#cdaeaeaf78c73277f68cfd7f12480232">00053</a> <a class="code" href="classdchroot_1_1main__base.html#cdaeaeaf78c73277f68cfd7f12480232" title="The destructor.">main_base::~main_base</a> ()
79
 
<a name="l00054"></a>00054 {
80
 
<a name="l00055"></a>00055 }
81
 
<a name="l00056"></a>00056 
82
 
<a name="l00057"></a>00057 <span class="keywordtype">void</span>
83
 
<a name="l00058"></a><a class="code" href="classdchroot_1_1main__base.html#f33c774b0b0542ec012c4a016f1aa64c">00058</a> <a class="code" href="classdchroot_1_1main__base.html#f33c774b0b0542ec012c4a016f1aa64c" title="Dump configuration file for chroots.">main_base::action_config</a> ()
84
 
<a name="l00059"></a>00059 {
85
 
<a name="l00060"></a>00060   std::cout &lt;&lt; <span class="stringliteral">"# "</span>
86
 
<a name="l00061"></a>00061     <span class="comment">// TRANSLATORS: %1% = program name</span>
87
 
<a name="l00062"></a>00062     <span class="comment">// TRANSLATORS: %2% = program version</span>
88
 
<a name="l00063"></a>00063     <span class="comment">// TRANSLATORS: %3% = current date</span>
89
 
<a name="l00064"></a>00064             &lt;&lt; format(_(<span class="stringliteral">"schroot configuration generated by %1% %2% on %3%"</span>))
90
 
<a name="l00065"></a>00065     % this-&gt;<a class="code" href="classschroot__base_1_1main.html#3d6be1d425f4d74cfced7ca5b6b6f79b" title="The name of the program.">program_name</a> % VERSION % <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/classsbuild_1_1date.html">sbuild::date</a>(time(0))
91
 
<a name="l00066"></a>00066             &lt;&lt; endl;
92
 
<a name="l00067"></a>00067   <span class="keywordflow">if</span> (this-&gt;use_dchroot_conf)
93
 
<a name="l00068"></a>00068     {
94
 
<a name="l00069"></a>00069       <span class="comment">// Help text at head of new config.</span>
95
 
<a name="l00070"></a>00070       std::cout &lt;&lt; <span class="stringliteral">"# "</span> &lt;&lt; endl
96
 
<a name="l00071"></a>00071                 &lt;&lt; <span class="stringliteral">"# "</span>
97
 
<a name="l00072"></a>00072                 <span class="comment">// TODO: Quote "users" and "groups".</span>
98
 
<a name="l00073"></a>00073                 <span class="comment">// TRANSLATORS: Do not translate "users" and "groups";</span>
99
 
<a name="l00074"></a>00074                 <span class="comment">// these are keywords used in the configuration file.</span>
100
 
<a name="l00075"></a>00075                 &lt;&lt; _(<span class="stringliteral">"To allow users access to the chroots, use the users or groups keys."</span>) &lt;&lt; endl;
101
 
<a name="l00076"></a>00076       std::cout &lt;&lt; <span class="stringliteral">"# "</span>
102
 
<a name="l00077"></a>00077                 <span class="comment">// TODO: Quote "root-users" and "root-groups".</span>
103
 
<a name="l00078"></a>00078                 <span class="comment">// TRANSLATORS: Do not translate "root-users" and</span>
104
 
<a name="l00079"></a>00079                 <span class="comment">// "root-groups"; these are keywords used in the</span>
105
 
<a name="l00080"></a>00080                 <span class="comment">// configuration file.</span>
106
 
<a name="l00081"></a>00081                 &lt;&lt; _(<span class="stringliteral">"To allow password-less root access, use the root-users or root-groups keys."</span>) &lt;&lt; endl;
107
 
<a name="l00082"></a>00082       std::cout &lt;&lt; <span class="stringliteral">"# "</span>
108
 
<a name="l00083"></a>00083         <span class="comment">// TRANSLATORS: %1% = file</span>
109
 
<a name="l00084"></a>00084                 &lt;&lt; format(_(<span class="stringliteral">"Remove '%1%' to use the new configuration."</span>))
110
 
<a name="l00085"></a>00085         % DCHROOT_CONF
111
 
<a name="l00086"></a>00086                 &lt;&lt; endl;
112
 
<a name="l00087"></a>00087     }
113
 
<a name="l00088"></a>00088   std::cout &lt;&lt; endl;
114
 
<a name="l00089"></a>00089   this-&gt;<a class="code" href="classschroot_1_1main__base.html#640ac7896d7ae52ce0949180c63a0c5b" title="The chroot configuration.">config</a>-&gt;print_chroot_config(this-&gt;chroots, std::cout);
115
 
<a name="l00090"></a>00090 }
116
 
<a name="l00091"></a>00091 
117
 
<a name="l00092"></a>00092 <span class="keywordtype">void</span>
118
 
<a name="l00093"></a><a class="code" href="classdchroot_1_1main__base.html#a7243d8ef3295b06fd5a164fd1c1fc4b">00093</a> <a class="code" href="classdchroot_1_1main__base.html#a7243d8ef3295b06fd5a164fd1c1fc4b" title="List chroots.">main_base::action_list</a> ()
119
 
<a name="l00094"></a>00094 {
120
 
<a name="l00095"></a>00095   this-&gt;<a class="code" href="classschroot_1_1main__base.html#640ac7896d7ae52ce0949180c63a0c5b" title="The chroot configuration.">config</a>-&gt;print_chroot_list_simple(std::cout);
121
 
<a name="l00096"></a>00096 }
122
 
<a name="l00097"></a>00097 
123
 
<a name="l00098"></a>00098 <span class="keywordtype">void</span>
124
 
<a name="l00099"></a><a class="code" href="classdchroot_1_1main__base.html#52bd3a9bc2d975daa81a86239a96dd35">00099</a> <a class="code" href="classdchroot_1_1main__base.html#52bd3a9bc2d975daa81a86239a96dd35" title="Check compatibility.">main_base::compat_check</a> ()
125
 
<a name="l00100"></a>00100 {
126
 
<a name="l00101"></a>00101   <span class="keywordflow">if</span> (this-&gt;options-&gt;verbose)
127
 
<a name="l00102"></a>00102     {
128
 
<a name="l00103"></a>00103       <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#133a221b9d5fbd4756937f2ec0a02958">sbuild::log_warning</a>()
129
 
<a name="l00104"></a>00104         <span class="comment">// TRANSLATORS: %1% = program name</span>
130
 
<a name="l00105"></a>00105         &lt;&lt; format(_(<span class="stringliteral">"Running schroot in %1% compatibility mode"</span>))
131
 
<a name="l00106"></a>00106         % this-&gt;<a class="code" href="classschroot__base_1_1main.html#3d6be1d425f4d74cfced7ca5b6b6f79b" title="The name of the program.">program_name</a>
132
 
<a name="l00107"></a>00107         &lt;&lt; endl;
133
 
<a name="l00108"></a>00108       <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
134
 
<a name="l00109"></a>00109         <span class="comment">// TRANSLATORS: "full capabilities" in this context means "all</span>
135
 
<a name="l00110"></a>00110         <span class="comment">// features"</span>
136
 
<a name="l00111"></a>00111         &lt;&lt; _(<span class="stringliteral">"Run \"schroot\" for full capabilities"</span>)
137
 
<a name="l00112"></a>00112         &lt;&lt; endl;
138
 
<a name="l00113"></a>00113     }
139
 
<a name="l00114"></a>00114 }
140
 
<a name="l00115"></a>00115 
141
 
<a name="l00116"></a>00116 <span class="keywordtype">void</span>
142
 
<a name="l00117"></a><a class="code" href="classdchroot_1_1main__base.html#c3f944ff1ac95a770caa6488a75e7bff">00117</a> <a class="code" href="classdchroot_1_1main__base.html#c3f944ff1ac95a770caa6488a75e7bff" title="Check dchroot.conf exists.">main_base::check_dchroot_conf</a> ()
143
 
<a name="l00118"></a>00118 {
144
 
<a name="l00119"></a>00119   this-&gt;<a class="code" href="classdchroot_1_1main__base.html#19665ccca92db2cbea0cd6cbe9f834a8" title="Use dchroot.conf as the configuration file.">use_dchroot_conf</a> = <span class="keyword">false</span>;
145
 
<a name="l00120"></a>00120   <span class="keyword">struct </span>stat statbuf;
146
 
<a name="l00121"></a>00121   <span class="keywordflow">if</span> (stat(DCHROOT_CONF, &amp;statbuf) == 0 &amp;&amp; !S_ISDIR(statbuf.st_mode))
147
 
<a name="l00122"></a>00122     {
148
 
<a name="l00123"></a>00123       this-&gt;<a class="code" href="classdchroot_1_1main__base.html#19665ccca92db2cbea0cd6cbe9f834a8" title="Use dchroot.conf as the configuration file.">use_dchroot_conf</a> = <span class="keyword">true</span>;
149
 
<a name="l00124"></a>00124 
150
 
<a name="l00125"></a>00125       <span class="keywordflow">if</span> (this-&gt;options-&gt;verbose)
151
 
<a name="l00126"></a>00126         {
152
 
<a name="l00127"></a>00127           <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#133a221b9d5fbd4756937f2ec0a02958">sbuild::log_warning</a>()
153
 
<a name="l00128"></a>00128             <span class="comment">// TRANSLATORS: %1% = program name</span>
154
 
<a name="l00129"></a>00129             <span class="comment">// TRANSLATORS: %2% = configuration file</span>
155
 
<a name="l00130"></a>00130             &lt;&lt; format(_(<span class="stringliteral">"Using %1% configuration file: '%2%'"</span>))
156
 
<a name="l00131"></a>00131             % this-&gt;<a class="code" href="classschroot__base_1_1main.html#3d6be1d425f4d74cfced7ca5b6b6f79b" title="The name of the program.">program_name</a> % DCHROOT_CONF
157
 
<a name="l00132"></a>00132             &lt;&lt; endl;
158
 
<a name="l00133"></a>00133           <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
159
 
<a name="l00134"></a>00134             &lt;&lt; format(_(<span class="stringliteral">"Run \"%1%\""</span>))
160
 
<a name="l00135"></a>00135             % <span class="stringliteral">"dchroot --config &gt;&gt; "</span> SCHROOT_CONF
161
 
<a name="l00136"></a>00136             &lt;&lt; endl;
162
 
<a name="l00137"></a>00137           <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
163
 
<a name="l00138"></a>00138             &lt;&lt; _(<span class="stringliteral">"to migrate to a schroot configuration."</span>)
164
 
<a name="l00139"></a>00139             &lt;&lt; endl;
165
 
<a name="l00140"></a>00140           <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
166
 
<a name="l00141"></a>00141             &lt;&lt; format(_(<span class="stringliteral">"Edit '%1%' to add appropriate user and/or group access."</span>))
167
 
<a name="l00142"></a>00142             % SCHROOT_CONF
168
 
<a name="l00143"></a>00143             &lt;&lt; endl;
169
 
<a name="l00144"></a>00144           <a class="codeRef" doxygen="sbuild.tag:/tmp/sr/schroot-1.1.5/doc/sbuild/html/" href="/tmp/sr/schroot-1.1.5/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
170
 
<a name="l00145"></a>00145             &lt;&lt; format(_(<span class="stringliteral">"Remove '%1%' to use the new configuration."</span>))
171
 
<a name="l00146"></a>00146             % DCHROOT_CONF
172
 
<a name="l00147"></a>00147             &lt;&lt; endl;
173
 
<a name="l00148"></a>00148         }
174
 
<a name="l00149"></a>00149     }
175
 
<a name="l00150"></a>00150 }
176
 
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sun Jul 8 21:23:55 2007 for schroot by&nbsp;
 
33
<a name="l00014"></a>00014 <span class="comment"> * along with this program.  If not, see</span>
 
34
<a name="l00015"></a>00015 <span class="comment"> * &lt;http://www.gnu.org/licenses/&gt;.</span>
 
35
<a name="l00016"></a>00016 <span class="comment"> *</span>
 
36
<a name="l00017"></a>00017 <span class="comment"> *********************************************************************/</span>
 
37
<a name="l00018"></a>00018 
 
38
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;config.h&gt;</span>
 
39
<a name="l00020"></a>00020 
 
40
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="dchroot-main_8h.html">dchroot-main.h</a>"</span>
 
41
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="dchroot-chroot-config_8h.html">dchroot-chroot-config.h</a>"</span>
 
42
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="dchroot-session_8h.html">dchroot-session.h</a>"</span>
 
43
<a name="l00024"></a>00024 
 
44
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
 
45
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;iostream&gt;</span>
 
46
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;locale&gt;</span>
 
47
<a name="l00028"></a>00028 
 
48
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;sys/types.h&gt;</span>
 
49
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;sys/stat.h&gt;</span>
 
50
<a name="l00031"></a>00031 <span class="preprocessor">#include &lt;termios.h&gt;</span>
 
51
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
 
52
<a name="l00033"></a>00033 
 
53
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;boost/format.hpp&gt;</span>
 
54
<a name="l00035"></a>00035 
 
55
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;syslog.h&gt;</span>
 
56
<a name="l00037"></a>00037 
 
57
<a name="l00038"></a>00038 <span class="keyword">using</span> std::endl;
 
58
<a name="l00039"></a>00039 <span class="keyword">using</span> boost::format;
 
59
<a name="l00040"></a>00040 <span class="keyword">using</span> sbuild::_;
 
60
<a name="l00041"></a>00041 <span class="keyword">using</span> <a class="code" href="classschroot_1_1options__base.html" title="Basic schroot command-line options.">schroot::options_base</a>;
 
61
<a name="l00042"></a>00042 <span class="keyword">using namespace </span>dchroot;
 
62
<a name="l00043"></a>00043 
 
63
<a name="l00044"></a><a class="code" href="classdchroot_1_1main__base.html#81731388c0ec393ddbf866b3bfec5c91">00044</a> main_base::main_base (std::string <span class="keyword">const</span>&amp; program_name,
 
64
<a name="l00045"></a>00045                       std::string <span class="keyword">const</span>&amp; program_usage,
 
65
<a name="l00046"></a>00046                       <a class="code" href="classschroot_1_1options__base.html#f263f91b2073c330e89a81bf77615b05" title="A shared_ptr to an options_base object.">schroot::options_base::ptr</a>&amp; <a class="code" href="classdchroot_1_1options.html" title="dchroot command-line options.">options</a>):
 
66
<a name="l00047"></a>00047   schroot::<a class="code" href="classdchroot_1_1main__base.html" title="Frontend base class for dchroot.">main_base</a>(program_name, program_usage, options, true),
 
67
<a name="l00048"></a>00048   use_dchroot_conf(false)
 
68
<a name="l00049"></a>00049 {
 
69
<a name="l00050"></a>00050 }
 
70
<a name="l00051"></a>00051 
 
71
<a name="l00052"></a><a class="code" href="classdchroot_1_1main__base.html#cdaeaeaf78c73277f68cfd7f12480232">00052</a> <a class="code" href="classdchroot_1_1main__base.html#cdaeaeaf78c73277f68cfd7f12480232" title="The destructor.">main_base::~main_base</a> ()
 
72
<a name="l00053"></a>00053 {
 
73
<a name="l00054"></a>00054 }
 
74
<a name="l00055"></a>00055 
 
75
<a name="l00056"></a>00056 <span class="keywordtype">void</span>
 
76
<a name="l00057"></a><a class="code" href="classdchroot_1_1main__base.html#f33c774b0b0542ec012c4a016f1aa64c">00057</a> <a class="code" href="classdchroot_1_1main__base.html#f33c774b0b0542ec012c4a016f1aa64c" title="Dump configuration file for chroots.">main_base::action_config</a> ()
 
77
<a name="l00058"></a>00058 {
 
78
<a name="l00059"></a>00059   std::cout &lt;&lt; <span class="stringliteral">"# "</span>
 
79
<a name="l00060"></a>00060     <span class="comment">// TRANSLATORS: %1% = program name</span>
 
80
<a name="l00061"></a>00061     <span class="comment">// TRANSLATORS: %2% = program version</span>
 
81
<a name="l00062"></a>00062     <span class="comment">// TRANSLATORS: %3% = current date</span>
 
82
<a name="l00063"></a>00063             &lt;&lt; format(_(<span class="stringliteral">"schroot configuration generated by %1% %2% on %3%"</span>))
 
83
<a name="l00064"></a>00064     % this-&gt;<a class="code" href="classschroot__base_1_1main.html#3d6be1d425f4d74cfced7ca5b6b6f79b" title="The name of the program.">program_name</a> % VERSION % <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/classsbuild_1_1date.html">sbuild::date</a>(time(0))
 
84
<a name="l00065"></a>00065             &lt;&lt; endl;
 
85
<a name="l00066"></a>00066   <span class="keywordflow">if</span> (this-&gt;use_dchroot_conf)
 
86
<a name="l00067"></a>00067     {
 
87
<a name="l00068"></a>00068       <span class="comment">// Help text at head of new config.</span>
 
88
<a name="l00069"></a>00069       std::cout &lt;&lt; <span class="stringliteral">"# "</span> &lt;&lt; endl
 
89
<a name="l00070"></a>00070                 &lt;&lt; <span class="stringliteral">"# "</span>
 
90
<a name="l00071"></a>00071                 <span class="comment">// TODO: Quote "users" and "groups".</span>
 
91
<a name="l00072"></a>00072                 <span class="comment">// TRANSLATORS: Do not translate "users" and "groups";</span>
 
92
<a name="l00073"></a>00073                 <span class="comment">// these are keywords used in the configuration file.</span>
 
93
<a name="l00074"></a>00074                 &lt;&lt; _(<span class="stringliteral">"To allow users access to the chroots, use the users or groups keys."</span>) &lt;&lt; endl;
 
94
<a name="l00075"></a>00075       std::cout &lt;&lt; <span class="stringliteral">"# "</span>
 
95
<a name="l00076"></a>00076                 <span class="comment">// TODO: Quote "root-users" and "root-groups".</span>
 
96
<a name="l00077"></a>00077                 <span class="comment">// TRANSLATORS: Do not translate "root-users" and</span>
 
97
<a name="l00078"></a>00078                 <span class="comment">// "root-groups"; these are keywords used in the</span>
 
98
<a name="l00079"></a>00079                 <span class="comment">// configuration file.</span>
 
99
<a name="l00080"></a>00080                 &lt;&lt; _(<span class="stringliteral">"To allow password-less root access, use the root-users or root-groups keys."</span>) &lt;&lt; endl;
 
100
<a name="l00081"></a>00081       std::cout &lt;&lt; <span class="stringliteral">"# "</span>
 
101
<a name="l00082"></a>00082         <span class="comment">// TRANSLATORS: %1% = file</span>
 
102
<a name="l00083"></a>00083                 &lt;&lt; format(_(<span class="stringliteral">"Remove '%1%' to use the new configuration."</span>))
 
103
<a name="l00084"></a>00084         % DCHROOT_CONF
 
104
<a name="l00085"></a>00085                 &lt;&lt; endl;
 
105
<a name="l00086"></a>00086     }
 
106
<a name="l00087"></a>00087   std::cout &lt;&lt; endl;
 
107
<a name="l00088"></a>00088   this-&gt;<a class="code" href="classschroot_1_1main__base.html#640ac7896d7ae52ce0949180c63a0c5b" title="The chroot configuration.">config</a>-&gt;print_chroot_config(this-&gt;chroots, std::cout);
 
108
<a name="l00089"></a>00089 }
 
109
<a name="l00090"></a>00090 
 
110
<a name="l00091"></a>00091 <span class="keywordtype">void</span>
 
111
<a name="l00092"></a><a class="code" href="classdchroot_1_1main__base.html#a7243d8ef3295b06fd5a164fd1c1fc4b">00092</a> <a class="code" href="classdchroot_1_1main__base.html#a7243d8ef3295b06fd5a164fd1c1fc4b" title="List chroots.">main_base::action_list</a> ()
 
112
<a name="l00093"></a>00093 {
 
113
<a name="l00094"></a>00094   this-&gt;<a class="code" href="classschroot_1_1main__base.html#640ac7896d7ae52ce0949180c63a0c5b" title="The chroot configuration.">config</a>-&gt;print_chroot_list_simple(std::cout);
 
114
<a name="l00095"></a>00095 }
 
115
<a name="l00096"></a>00096 
 
116
<a name="l00097"></a>00097 <span class="keywordtype">void</span>
 
117
<a name="l00098"></a><a class="code" href="classdchroot_1_1main__base.html#52bd3a9bc2d975daa81a86239a96dd35">00098</a> <a class="code" href="classdchroot_1_1main__base.html#52bd3a9bc2d975daa81a86239a96dd35" title="Check compatibility.">main_base::compat_check</a> ()
 
118
<a name="l00099"></a>00099 {
 
119
<a name="l00100"></a>00100   <span class="keywordflow">if</span> (this-&gt;options-&gt;verbose)
 
120
<a name="l00101"></a>00101     {
 
121
<a name="l00102"></a>00102       <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#133a221b9d5fbd4756937f2ec0a02958">sbuild::log_warning</a>()
 
122
<a name="l00103"></a>00103         <span class="comment">// TRANSLATORS: %1% = program name</span>
 
123
<a name="l00104"></a>00104         &lt;&lt; format(_(<span class="stringliteral">"Running schroot in %1% compatibility mode"</span>))
 
124
<a name="l00105"></a>00105         % this-&gt;<a class="code" href="classschroot__base_1_1main.html#3d6be1d425f4d74cfced7ca5b6b6f79b" title="The name of the program.">program_name</a>
 
125
<a name="l00106"></a>00106         &lt;&lt; endl;
 
126
<a name="l00107"></a>00107       <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
 
127
<a name="l00108"></a>00108         <span class="comment">// TRANSLATORS: "full capabilities" in this context means "all</span>
 
128
<a name="l00109"></a>00109         <span class="comment">// features"</span>
 
129
<a name="l00110"></a>00110         &lt;&lt; _(<span class="stringliteral">"Run \"schroot\" for full capabilities"</span>)
 
130
<a name="l00111"></a>00111         &lt;&lt; endl;
 
131
<a name="l00112"></a>00112     }
 
132
<a name="l00113"></a>00113 }
 
133
<a name="l00114"></a>00114 
 
134
<a name="l00115"></a>00115 <span class="keywordtype">void</span>
 
135
<a name="l00116"></a><a class="code" href="classdchroot_1_1main__base.html#c3f944ff1ac95a770caa6488a75e7bff">00116</a> <a class="code" href="classdchroot_1_1main__base.html#c3f944ff1ac95a770caa6488a75e7bff" title="Check dchroot.conf exists.">main_base::check_dchroot_conf</a> ()
 
136
<a name="l00117"></a>00117 {
 
137
<a name="l00118"></a>00118   this-&gt;<a class="code" href="classdchroot_1_1main__base.html#19665ccca92db2cbea0cd6cbe9f834a8" title="Use dchroot.conf as the configuration file.">use_dchroot_conf</a> = <span class="keyword">false</span>;
 
138
<a name="l00119"></a>00119   <span class="keyword">struct </span>stat statbuf;
 
139
<a name="l00120"></a>00120   <span class="keywordflow">if</span> (stat(DCHROOT_CONF, &amp;statbuf) == 0 &amp;&amp; !S_ISDIR(statbuf.st_mode))
 
140
<a name="l00121"></a>00121     {
 
141
<a name="l00122"></a>00122       this-&gt;<a class="code" href="classdchroot_1_1main__base.html#19665ccca92db2cbea0cd6cbe9f834a8" title="Use dchroot.conf as the configuration file.">use_dchroot_conf</a> = <span class="keyword">true</span>;
 
142
<a name="l00123"></a>00123 
 
143
<a name="l00124"></a>00124       <span class="keywordflow">if</span> (this-&gt;options-&gt;verbose)
 
144
<a name="l00125"></a>00125         {
 
145
<a name="l00126"></a>00126           <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#133a221b9d5fbd4756937f2ec0a02958">sbuild::log_warning</a>()
 
146
<a name="l00127"></a>00127             <span class="comment">// TRANSLATORS: %1% = program name</span>
 
147
<a name="l00128"></a>00128             <span class="comment">// TRANSLATORS: %2% = configuration file</span>
 
148
<a name="l00129"></a>00129             &lt;&lt; format(_(<span class="stringliteral">"Using %1% configuration file: '%2%'"</span>))
 
149
<a name="l00130"></a>00130             % this-&gt;<a class="code" href="classschroot__base_1_1main.html#3d6be1d425f4d74cfced7ca5b6b6f79b" title="The name of the program.">program_name</a> % DCHROOT_CONF
 
150
<a name="l00131"></a>00131             &lt;&lt; endl;
 
151
<a name="l00132"></a>00132           <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
 
152
<a name="l00133"></a>00133             &lt;&lt; format(_(<span class="stringliteral">"Run \"%1%\""</span>))
 
153
<a name="l00134"></a>00134             % <span class="stringliteral">"dchroot --config &gt;&gt; "</span> SCHROOT_CONF
 
154
<a name="l00135"></a>00135             &lt;&lt; endl;
 
155
<a name="l00136"></a>00136           <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
 
156
<a name="l00137"></a>00137             &lt;&lt; _(<span class="stringliteral">"to migrate to a schroot configuration."</span>)
 
157
<a name="l00138"></a>00138             &lt;&lt; endl;
 
158
<a name="l00139"></a>00139           <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
 
159
<a name="l00140"></a>00140             &lt;&lt; format(_(<span class="stringliteral">"Edit '%1%' to add appropriate user and/or group access."</span>))
 
160
<a name="l00141"></a>00141             % SCHROOT_CONF
 
161
<a name="l00142"></a>00142             &lt;&lt; endl;
 
162
<a name="l00143"></a>00143           <a class="codeRef" doxygen="sbuild.tag:/tmp/sb/schroot/doc/sbuild/html/" href="/tmp/sb/schroot/doc/sbuild/html/namespacesbuild.html#4b668d467f8c9c6063cd2c9c7aaf3086">sbuild::log_info</a>()
 
163
<a name="l00144"></a>00144             &lt;&lt; format(_(<span class="stringliteral">"Remove '%1%' to use the new configuration."</span>))
 
164
<a name="l00145"></a>00145             % DCHROOT_CONF
 
165
<a name="l00146"></a>00146             &lt;&lt; endl;
 
166
<a name="l00147"></a>00147         }
 
167
<a name="l00148"></a>00148     }
 
168
<a name="l00149"></a>00149 }
 
169
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Mon Jan 21 00:38:28 2008 for schroot by&nbsp;
177
170
<a href="http://www.doxygen.org/index.html">
178
 
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address>
 
171
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.4 </small></address>
179
172
</body>
180
173
</html>