dchroot-dsa-main.cc

Go to the documentation of this file.
00001 /* Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
00002  *
00003  * schroot is free software: you can redistribute it and/or modify it
00004  * under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation, either version 3 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * schroot is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>.
00016  *
00017  *********************************************************************/
00018 
00019 #include <config.h>
00020 
00021 #include "dchroot-dsa-main.h"
00022 #include "dchroot-dsa-chroot-config.h"
00023 #include "dchroot-dsa-session.h"
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 #include <locale>
00028 
00029 #include <sys/types.h>
00030 #include <sys/stat.h>
00031 #include <termios.h>
00032 #include <unistd.h>
00033 
00034 #include <boost/format.hpp>
00035 
00036 using std::endl;
00037 using sbuild::_;
00038 using boost::format;
00039 using namespace dchroot_dsa;
00040 
00041 main::main (schroot::options_base::ptr& options):
00042   main_base("dchroot-dsa",
00043             // TRANSLATORS: '...' is an ellipsis e.g. U+2026, and '-'
00044             // is an em-dash.
00045             _("[OPTION...] chroot [COMMAND] - run command or shell in a chroot"),
00046             options)
00047 {
00048 }
00049 
00050 main::~main ()
00051 {
00052 }
00053 
00054 void
00055 main::load_config ()
00056 {
00057   check_dchroot_conf();
00058 
00059   if (this->use_dchroot_conf)
00060     {
00061       this->config =
00062         sbuild::chroot_config::ptr(new dchroot_dsa::chroot_config);
00063       if (this->options->load_chroots == true)
00064         this->config->add(DCHROOT_CONF, false);
00065     }
00066   else
00067     {
00068       schroot::main_base::load_config();
00069     }
00070 }
00071 
00072 void
00073 main::create_session(sbuild::session::operation sess_op)
00074 {
00075   sbuild::log_debug(sbuild::DEBUG_INFO)
00076     << "Creating dchroot-dsa session" << endl;
00077 
00078   // Using dchroot.conf implies using dchroot_session_base, which does
00079   // not require user or group access.
00080   this->session = sbuild::session::ptr
00081     (new dchroot_dsa::session("schroot",
00082                               this->config,
00083                               sess_op,
00084                               this->chroots,
00085                               this->use_dchroot_conf));
00086 }

Generated on Mon Jan 21 00:38:28 2008 for schroot by  doxygen 1.5.4