Remove old commands which are not supported anymore

This commit is contained in:
Simon Fels 2016-09-17 11:12:50 +02:00
commit 1b4857db89
6 changed files with 1 additions and 166 deletions

View file

@ -125,9 +125,7 @@ set(SOURCES
anbox/cmds/run.cpp
anbox/cmds/install_app.cpp
anbox/cmds/launch_app.cpp
anbox/cmds/reset.cpp
anbox/cmds/container_manager.cpp
anbox/cmds/start_container.cpp
anbox/do_not_copy_or_move.h
anbox/optional.h

View file

@ -1,40 +0,0 @@
/*
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <boost/filesystem.hpp>
#include "anbox/config.h"
#include "anbox/cmds/reset.h"
namespace fs = boost::filesystem;
anbox::cmds::Reset::Reset()
: CommandWithFlagsAndAction{cli::Name{"reset"}, cli::Usage{"reset"}, cli::Description{"Reset the container to its default settings"}}
{
action([this](const cli::Command::Context &) {
// FIXME(morphis): check if container is currently running and if stop here.
if (!fs::is_directory(config::data_path()))
return EXIT_SUCCESS;
// FIXME(morphis): This currently requires us to run as root as otherwise we can't
// remove some of the files stored there even if they are created from a user namespace!?
fs::remove_all(config::data_path());
return EXIT_SUCCESS;
});
}

View file

@ -1,36 +0,0 @@
/*
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ANBOX_CMDS_RESET_H_
#define ANBOX_CMDS_RESET_H_
#include <functional>
#include <iostream>
#include <memory>
#include "anbox/cli.h"
namespace anbox {
namespace cmds {
class Reset : public cli::CommandWithFlagsAndAction {
public:
Reset();
};
} // namespace cmds
} // namespace anbox
#endif

View file

@ -1,47 +0,0 @@
/*
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "anbox/cmds/start_container.h"
#include "anbox/container/lxc_container.h"
#include "anbox/runtime.h"
#include "anbox/logger.h"
#include "core/posix/signal.h"
anbox::cmds::StartContainer::StartContainer()
: CommandWithFlagsAndAction{cli::Name{"start-container"}, cli::Usage{"start-container"}, cli::Description{"Start a container"}}
{
action([](const cli::Command::Context& ctxt) {
auto trap = core::posix::trap_signals_for_process({core::posix::Signal::sig_term,
core::posix::Signal::sig_int});
trap->signal_raised().connect([trap](const core::posix::Signal &signal) {
INFO("Signal %i received. Good night.", static_cast<int>(signal));
trap->stop();
});
auto rt = Runtime::create();
auto container = std::make_shared<container::LxcContainer>();
container::Configuration config;
rt->start();
container->start(config);
trap->run();
rt->stop();
return 0;
});
}

View file

@ -1,36 +0,0 @@
/*
* Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef ANBOX_CMDS_START_CONTAINER_H_
#define ANBOX_CMDS_START_CONTAINER_H_
#include <functional>
#include <iostream>
#include <memory>
#include "anbox/cli.h"
namespace anbox {
namespace cmds {
class StartContainer : public cli::CommandWithFlagsAndAction {
public:
StartContainer();
};
} // namespace cmds
} // namespace anbox
#endif

View file

@ -26,9 +26,7 @@
#include "anbox/cmds/run.h"
#include "anbox/cmds/install_app.h"
#include "anbox/cmds/launch_app.h"
#include "anbox/cmds/reset.h"
#include "anbox/cmds/container_manager.h"
#include "anbox/cmds/start_container.h"
#include <boost/filesystem.hpp>
@ -42,9 +40,7 @@ Daemon::Daemon() :
.command(std::make_shared<cmds::Run>())
.command(std::make_shared<cmds::InstallApp>())
.command(std::make_shared<cmds::LaunchApp>())
.command(std::make_shared<cmds::Reset>())
.command(std::make_shared<cmds::ContainerManager>())
.command(std::make_shared<cmds::StartContainer>());
.command(std::make_shared<cmds::ContainerManager>());
}
int Daemon::Run(const std::vector<std::string> &arguments)