create and remove respect dryrun
This commit is contained in:
parent
738606b851
commit
b979bb7a0a
@ -7,6 +7,7 @@
|
|||||||
#include <tclap/CmdLine.h>
|
#include <tclap/CmdLine.h>
|
||||||
|
|
||||||
#include "bottles.hpp"
|
#include "bottles.hpp"
|
||||||
|
#include "cellar.hpp"
|
||||||
#include "internal/bottles.hpp"
|
#include "internal/bottles.hpp"
|
||||||
#include "internal/launch.hpp"
|
#include "internal/launch.hpp"
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
@ -58,22 +59,28 @@ void cellar::bottles::create_bottle(int argc, vector<string> argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fullbottlepath != homepath + "/.wine.template") {
|
if (fullbottlepath != homepath + "/.wine.template") {
|
||||||
|
output::statement("copying template bottle to " + fullbottlepath, true);
|
||||||
|
|
||||||
// all this gets skipped if we're creating the template bottle
|
// all this gets skipped if we're creating the template bottle
|
||||||
if (boost::filesystem::exists(homepath + "/.wine.template")) {
|
if (boost::filesystem::exists(homepath + "/.wine.template")) {
|
||||||
fs::recursive_copy(homepath + "/.wine.template", fullbottlepath);
|
if (!dryrun) {
|
||||||
return;
|
fs::recursive_copy(homepath + "/.wine.template", fullbottlepath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
output::error("no template bottle");
|
output::error("no template bottle, create one using \"cellar create template\"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (boost::filesystem::exists(homepath + "/.wine")) {
|
if (boost::filesystem::exists(homepath + "/.wine")) {
|
||||||
output::statement("using existing bottle at ~/.wine as template bottle");
|
output::statement("using existing bottle at ~/.wine as template bottle");
|
||||||
fs::recursive_copy(homepath + "/.wine", fullbottlepath);
|
if (!dryrun) { fs::recursive_copy(homepath + "/.wine", fullbottlepath); }
|
||||||
} else {
|
} else {
|
||||||
output::statement("creating template bottle from scratch");
|
output::statement("creating template bottle from scratch");
|
||||||
setenv("WINEPREFIX", fullbottlepath.c_str(), 1);
|
if (!dryrun) {
|
||||||
launch::popen("wineboot -u");
|
setenv("WINEPREFIX", fullbottlepath.c_str(), 1);
|
||||||
|
launch::popen("wineboot -u");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
|
|
||||||
#include "bottles.hpp"
|
#include "bottles.hpp"
|
||||||
|
#include "cellar.hpp"
|
||||||
#include "internal/bottles.hpp"
|
#include "internal/bottles.hpp"
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
#include "output.hpp"
|
#include "output.hpp"
|
||||||
@ -34,5 +35,6 @@ void cellar::bottles::remove_bottle(int argc, vector<string> argv) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::recursive_remove(fullbottlepath);
|
output::statement("removing " + fullbottlepath, true);
|
||||||
|
if (!dryrun) { fs::recursive_remove(fullbottlepath); }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user