add:添加仅生成shell脚本参数。
This commit is contained in:
parent
acb036c1ed
commit
fda7e465d8
@ -21,7 +21,9 @@ bool CCmdParse::cmdParse(int argc, char* argv[])
|
|||||||
"安装目标目录")("file,f", cmd::value<std::string>(), "二进制文件")(
|
"安装目标目录")("file,f", cmd::value<std::string>(), "二进制文件")(
|
||||||
"ico,i", cmd::value<std::string>(), "图标文件")(
|
"ico,i", cmd::value<std::string>(), "图标文件")(
|
||||||
"category,c", cmd::value<std::string>()->default_value("Utility"),
|
"category,c", cmd::value<std::string>()->default_value("Utility"),
|
||||||
"分类名称,例如Utility。");
|
"分类名称,例如Utility。")("only,o",
|
||||||
|
cmd::value<bool>()->default_value(false),
|
||||||
|
"仅生成shell启动脚本(mode=1时)");
|
||||||
|
|
||||||
cmd::variables_map vm;
|
cmd::variables_map vm;
|
||||||
cmd::store(cmd::parse_command_line(argc, argv, desc), vm);
|
cmd::store(cmd::parse_command_line(argc, argv, desc), vm);
|
||||||
@ -35,6 +37,9 @@ bool CCmdParse::cmdParse(int argc, char* argv[])
|
|||||||
if (vm.count("mode")) {
|
if (vm.count("mode")) {
|
||||||
result_.mode = vm["mode"].as<int>();
|
result_.mode = vm["mode"].as<int>();
|
||||||
}
|
}
|
||||||
|
if (vm.count("only")) {
|
||||||
|
result_.only_shell = vm["only"].as<bool>();
|
||||||
|
}
|
||||||
if (vm.count("dirs")) {
|
if (vm.count("dirs")) {
|
||||||
result_.lib_dirs = vm["dirs"].as<std::vector<std::string>>();
|
result_.lib_dirs = vm["dirs"].as<std::vector<std::string>>();
|
||||||
}
|
}
|
||||||
@ -113,7 +118,7 @@ bool CCmdParse::Run()
|
|||||||
return pack.startPack(result_);
|
return pack.startPack(result_);
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
if (!check_file_dir(result_.ico, true)) {
|
if (!result_.only_shell && !check_file_dir(result_.ico, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::cout << "结果 ==========================================>\n";
|
std::cout << "结果 ==========================================>\n";
|
||||||
|
@ -51,6 +51,11 @@ bool CInstallBinary::startInstall(const CmdResult& result)
|
|||||||
std::string cmd("chmod +x " + temp_shell.string());
|
std::string cmd("chmod +x " + temp_shell.string());
|
||||||
std::cout << cmd << " Ret:" << std::system(cmd.c_str()) << std::endl;
|
std::cout << cmd << " Ret:" << std::system(cmd.c_str()) << std::endl;
|
||||||
|
|
||||||
|
if (result.only_shell) {
|
||||||
|
std::cout << "仅生成shell完成。" << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!write_file(desktop_tempte, temp_desktop.string())) {
|
if (!write_file(desktop_tempte, temp_desktop.string())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ struct CmdResult {
|
|||||||
bool valid{false};
|
bool valid{false};
|
||||||
int mode{-1};
|
int mode{-1};
|
||||||
bool help_{false};
|
bool help_{false};
|
||||||
|
bool only_shell{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user