#include "commands.h" #include #include enum { ARG_PATH, }; static int bootstrap( const fx_command *self, const fx_arglist *opt, const fx_array *args) { const char *root_path = NULL; fx_status status = fx_arglist_get_string( opt, FX_COMMAND_INVALID_ID, ARG_PATH, 0, &root_path); if (!FX_OK(status)) { fx_arglist_report_missing_args( opt, FX_COMMAND_INVALID_ID, ARG_PATH, 0); return -1; } struct ropkg_instance *inst; fx_result result = ropkg_instance_bootstrap(root_path, &inst); if (fx_result_is_error(result)) { fx_throw(result); return -1; } ropkg_instance_close(inst); return 0; } FX_COMMAND(CMD_BOOTSTRAP, CMD_ROOT) { FX_COMMAND_NAME("bootstrap"); FX_COMMAND_DESC( "initialise a new Rosetta package manager instance. use this " "command to prepare a sysroot for the installation of Rosetta " "packages."); FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT); FX_COMMAND_FUNCTION(bootstrap); FX_COMMAND_ARG(ARG_PATH) { FX_ARG_NAME("sysroot"); FX_ARG_DESC( "the path to the system root directory to initialise."); FX_ARG_NR_VALUES(1); } FX_COMMAND_HELP_OPTION(); }