schroot-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 2 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, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00016  * MA  02111-1307  USA
00017  *
00018  *********************************************************************/
00019 
00020 #include <config.h>
00021 
00022 #include "schroot-main.h"
00023 
00024 #include <cstdlib>
00025 #include <ctime>
00026 #include <iostream>
00027 #include <locale>
00028 
00029 #include <termios.h>
00030 #include <unistd.h>
00031 
00032 #include <boost/format.hpp>
00033 
00034 using std::endl;
00035 using boost::format;
00036 using sbuild::_;
00037 using namespace schroot;
00038 
00039 main::main (options_base::ptr& options):
00040   main_base("schroot",
00041             // TRANSLATORS: '...' is an ellipsis e.g. U+2026, and '-'
00042             // is an em-dash.
00043             _("[OPTION...] [COMMAND] - run command or shell in a chroot"),
00044             options,
00045             true)
00046 {
00047 }
00048 
00049 main::~main ()
00050 {
00051 }
00052 
00053 void
00054 main::action_config ()
00055 {
00056   std::cout << "# "
00057     // TRANSLATORS: %1% = program name
00058     // TRANSLATORS: %2% = program version
00059     // TRANSLATORS: %3% = current date
00060             << format(_("schroot configuration generated by %1% %2% on %3%"))
00061     % this->program_name % VERSION % sbuild::date(time(0))
00062             << endl;
00063   std::cout << endl;
00064   this->config->print_chroot_config(this->chroots, std::cout);
00065 }
00066 
00067 void
00068 main::action_list ()
00069 {
00070   this->config->print_chroot_list(std::cout);
00071 }
00072 
00073 void
00074 main::create_session(sbuild::session::operation sess_op)
00075 {
00076   sbuild::log_debug(sbuild::DEBUG_INFO) << "Creating schroot session" << endl;
00077 
00078   this->session = sbuild::session::ptr
00079     (new sbuild::session("schroot", this->config, sess_op, this->chroots));
00080 
00081   if (!this->options->user.empty())
00082     this->session->set_user(this->options->user);
00083 }

Generated on Sun Jul 8 21:23:55 2007 for schroot by  doxygen 1.5.2