00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 namespace schroot;
00037
00038 main::main (options_base::ptr& options):
00039 main_base("schroot",
00040
00041
00042 N_("[OPTION...] [COMMAND] - run command or shell in a chroot"),
00043 options)
00044 {
00045 }
00046
00047 main::~main ()
00048 {
00049 }
00050
00051 void
00052 main::action_config ()
00053 {
00054 std::cout << "# "
00055
00056
00057
00058 << format(_("schroot configuration generated by %1% %2% on %3%"))
00059 % this->program_name % VERSION % sbuild::date(time(0))
00060 << endl;
00061 std::cout << endl;
00062 this->config->print_chroot_config(this->chroots, std::cout);
00063 }
00064
00065 void
00066 main::action_list ()
00067 {
00068 this->config->print_chroot_list(std::cout);
00069 }
00070
00071 void
00072 main::create_session(sbuild::session::operation sess_op)
00073 {
00074 sbuild::log_debug(sbuild::DEBUG_INFO) << "Creating schroot session" << endl;
00075
00076 this->session = sbuild::session::ptr
00077 (new sbuild::session("schroot", this->config, sess_op, this->chroots));
00078
00079 if (!this->options->user.empty())
00080 this->session->set_user(this->options->user);
00081 }