Create macOS bundle for simplified installation #58
This commit is contained in:
19
repertory/Info.plist.in
Normal file
19
repertory/Info.plist.in
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>@PROJECT_NAME@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.fifthgrid.blockstorage.@PROJECT_NAME@</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>@PROJECT_NAME@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_REVISION_VERSION@-@PROJECT_RELEASE_ITER@_@PROJECT_GIT_REV@</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
@@ -49,12 +49,22 @@ auto main(int argc, char **argv) -> int {
|
||||
std::ranges::copy(args_span, std::back_inserter(args));
|
||||
}
|
||||
|
||||
int ret{0};
|
||||
|
||||
if (argc == 1) {
|
||||
#if defined(__APPLE__)
|
||||
args.push_back("-ui");
|
||||
#else // !defined(__APPLE__)
|
||||
args.push_back("-h");
|
||||
#endif // defined(__APPLE__)
|
||||
}
|
||||
|
||||
int ret{0};
|
||||
if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
||||
if (utils::cli::has_option(args, utils::cli::options::help_option)) {
|
||||
cli::actions::help<repertory_drive>(args);
|
||||
} else if (utils::cli::has_option(args,
|
||||
utils::cli::options::version_option)) {
|
||||
cli::actions::version<repertory_drive>(args);
|
||||
} else if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
||||
ui::mgmt_app_config config{
|
||||
utils::cli::has_option(args, utils::cli::options::hidden_option),
|
||||
utils::cli::has_option(args, utils::cli::options::launch_only_option),
|
||||
@@ -71,7 +81,11 @@ auto main(int argc, char **argv) -> int {
|
||||
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
||||
} else {
|
||||
httplib::Server server;
|
||||
#if defined(__APPLE__)
|
||||
if (not server.set_mount_point("/ui", "../Resources/web")) {
|
||||
#else // !defined(__APPLE__)
|
||||
if (not server.set_mount_point("/ui", "./web")) {
|
||||
#endif // defined(__APPLE__)
|
||||
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
||||
} else {
|
||||
ui::handlers handlers(&config, &server);
|
||||
@@ -133,8 +147,7 @@ auto main(int argc, char **argv) -> int {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ((prov == provider_type::s3) || (prov == provider_type::sia) ||
|
||||
(prov == provider_type::encrypt)) {
|
||||
} else {
|
||||
std::string data;
|
||||
res = utils::cli::parse_string_option(
|
||||
args, utils::cli::options::name_option, data);
|
||||
@@ -160,32 +173,25 @@ auto main(int argc, char **argv) -> int {
|
||||
|
||||
int mount_result{};
|
||||
if (res == exit_code::success) {
|
||||
if (utils::cli::has_option(args, utils::cli::options::help_option)) {
|
||||
cli::actions::help<repertory_drive>(args);
|
||||
} else if (utils::cli::has_option(args,
|
||||
utils::cli::options::version_option)) {
|
||||
cli::actions::version<repertory_drive>(args);
|
||||
} else {
|
||||
res = exit_code::option_not_found;
|
||||
for (std::size_t idx = 0U;
|
||||
(res == exit_code::option_not_found) &&
|
||||
(idx < utils::cli::options::option_list.size());
|
||||
idx++) {
|
||||
try {
|
||||
res = cli::actions::perform_action(
|
||||
utils::cli::options::option_list[idx], args, data_directory,
|
||||
prov, unique_id, user, password);
|
||||
} catch (const std::exception &ex) {
|
||||
res = exit_code::exception;
|
||||
} catch (...) {
|
||||
res = exit_code::exception;
|
||||
}
|
||||
res = exit_code::option_not_found;
|
||||
for (std::size_t idx = 0U;
|
||||
(res == exit_code::option_not_found) &&
|
||||
(idx < utils::cli::options::option_list.size());
|
||||
idx++) {
|
||||
try {
|
||||
res = cli::actions::perform_action(
|
||||
utils::cli::options::option_list[idx], args, data_directory, prov,
|
||||
unique_id, user, password);
|
||||
} catch (const std::exception &ex) {
|
||||
res = exit_code::exception;
|
||||
} catch (...) {
|
||||
res = exit_code::exception;
|
||||
}
|
||||
}
|
||||
|
||||
if (res == exit_code::option_not_found) {
|
||||
res = cli::actions::mount(args, data_directory, mount_result, prov,
|
||||
remote_host, remote_port, unique_id);
|
||||
}
|
||||
if (res == exit_code::option_not_found) {
|
||||
res = cli::actions::mount(args, data_directory, mount_result, prov,
|
||||
remote_host, remote_port, unique_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user