gboolean rpmostree_option_context_parse (GOptionContext *context, const GOptionEntry *main_entries, int *argc, char ***argv, RpmOstreeBuiltinFlags flags, GCancellable *cancellable, RPMOSTreeSysroot **out_sysroot_proxy, GError **error) { gboolean use_daemon; gboolean ret = FALSE; use_daemon = ((flags & RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD) == 0); if ((flags & RPM_OSTREE_BUILTIN_FLAG_REQUIRES_ROOT) > 0 && getuid () != 0 && getenv ("RPMOSTREE_SUPPRESS_REQUIRES_ROOT_CHECK") == NULL) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "This command requires root privileges"); goto out; } if (main_entries != NULL) g_option_context_add_main_entries (context, main_entries, NULL); if (use_daemon) g_option_context_add_main_entries (context, daemon_entries, NULL); g_option_context_add_main_entries (context, global_entries, NULL); if (!g_option_context_parse (context, argc, argv, error)) goto out; if (opt_version) { g_print ("%s\n %s\n", PACKAGE_STRING, RPM_OSTREE_FEATURES); exit (EXIT_SUCCESS); } if (use_daemon) { if (!rpmostree_load_sysroot (opt_sysroot, opt_force_peer, cancellable, out_sysroot_proxy, error)) goto out; } ret = TRUE; out: return ret; }
gboolean rpmostree_option_context_parse (GOptionContext *context, const GOptionEntry *main_entries, int *argc, char ***argv, RpmOstreeBuiltinFlags flags, GCancellable *cancellable, RPMOSTreeSysroot **out_sysroot_proxy, GError **error) { gboolean use_daemon; gboolean ret = FALSE; use_daemon = ((flags & RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD) == 0); if (main_entries != NULL) g_option_context_add_main_entries (context, main_entries, NULL); if (use_daemon) g_option_context_add_main_entries (context, daemon_entries, NULL); g_option_context_add_main_entries (context, global_entries, NULL); if (!g_option_context_parse (context, argc, argv, error)) goto out; if (opt_version) { g_print ("%s\n %s\n", PACKAGE_NAME, RPM_OSTREE_FEATURES); exit (EXIT_SUCCESS); } if (use_daemon) { if (!rpmostree_load_sysroot (opt_sysroot, opt_force_peer, cancellable, out_sysroot_proxy, error)) goto out; } ret = TRUE; out: return ret; }