00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <config.h>
00020
00021 #include "schroot-main.h"
00022
00023 #include <cstdlib>
00024 #include <ctime>
00025 #include <iostream>
00026 #include <locale>
00027
00028 #include <termios.h>
00029 #include <unistd.h>
00030
00031 #include <boost/format.hpp>
00032
00033 using std::endl;
00034 using boost::format;
00035 using sbuild::_;
00036 using namespace schroot;
00037
00038 main::main (options_base::ptr& options):
00039 main_base("schroot",
00040
00041
00042 _("[OPTION...] [COMMAND] - run command or shell in a chroot"),
00043 options,
00044 true)
00045 {
00046 }
00047
00048 main::~main ()
00049 {
00050 }
00051
00052 void
00053 main::action_config ()
00054 {
00055 std::cout << "# "
00056
00057
00058
00059 << format(_("schroot configuration generated by %1% %2% on %3%"))
00060 % this->program_name % VERSION % sbuild::date(time(0))
00061 << endl;
00062 std::cout << endl;
00063 this->config->print_chroot_config(this->chroots, std::cout);
00064 }
00065
00066 void
00067 main::action_list ()
00068 {
00069 this->config->print_chroot_list(std::cout);
00070 }
00071
00072 void
00073 main::create_session(sbuild::session::operation sess_op)
00074 {
00075 sbuild::log_debug(sbuild::DEBUG_INFO) << "Creating schroot session" << endl;
00076
00077 this->session = sbuild::session::ptr
00078 (new sbuild::session("schroot", this->config, sess_op, this->chroots));
00079
00080 if (!this->options->user.empty())
00081 this->session->set_user(this->options->user);
00082 }