diff --git a/cmd_parse.cpp b/cmd_parse.cpp index cac36c1..1ba8a3a 100644 --- a/cmd_parse.cpp +++ b/cmd_parse.cpp @@ -21,7 +21,9 @@ bool CCmdParse::cmdParse(int argc, char* argv[]) "安装目标目录")("file,f", cmd::value(), "二进制文件")( "ico,i", cmd::value(), "图标文件")( "category,c", cmd::value()->default_value("Utility"), - "分类名称,例如Utility。"); + "分类名称,例如Utility。")("only,o", + cmd::value()->default_value(false), + "仅生成shell启动脚本(mode=1时)"); cmd::variables_map 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")) { result_.mode = vm["mode"].as(); } + if (vm.count("only")) { + result_.only_shell = vm["only"].as(); + } if (vm.count("dirs")) { result_.lib_dirs = vm["dirs"].as>(); } @@ -113,7 +118,7 @@ bool CCmdParse::Run() return pack.startPack(result_); } case 1: { - if (!check_file_dir(result_.ico, true)) { + if (!result_.only_shell && !check_file_dir(result_.ico, true)) { return false; } std::cout << "结果 ==========================================>\n"; diff --git a/install.cpp b/install.cpp index fe6f913..60911df 100644 --- a/install.cpp +++ b/install.cpp @@ -51,6 +51,11 @@ bool CInstallBinary::startInstall(const CmdResult& result) std::string cmd("chmod +x " + temp_shell.string()); 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())) { return false; } diff --git a/public.hpp b/public.hpp index 6cf25fd..13d4930 100644 --- a/public.hpp +++ b/public.hpp @@ -13,6 +13,7 @@ struct CmdResult { bool valid{false}; int mode{-1}; bool help_{false}; + bool only_shell{false}; }; #endif \ No newline at end of file