Files
ropkg/ropam/bootstrap.c

61 lines
1.1 KiB
C
Raw Normal View History

#include "commands.h"
#include <blue/cmd.h>
#include <ropkg/instance.h>
enum {
ARG_PATH,
};
static int bootstrap(
const b_command *self,
const b_arglist *opt,
const b_array *args)
{
const char *root_path = NULL;
b_status status = b_arglist_get_string(
opt,
B_COMMAND_INVALID_ID,
ARG_PATH,
0,
&root_path);
if (!B_OK(status)) {
b_arglist_report_missing_args(
opt,
B_COMMAND_INVALID_ID,
ARG_PATH,
0);
return -1;
}
struct ropkg_instance *inst;
b_result result = ropkg_instance_bootstrap(root_path, &inst);
if (b_result_is_error(result)) {
b_throw(result);
return -1;
}
return 0;
}
B_COMMAND(CMD_BOOTSTRAP, CMD_ROOT)
{
B_COMMAND_NAME("bootstrap");
B_COMMAND_DESC(
"initialise a new Rosetta package manager instance. use this "
"command to prepare a sysroot for the installation of Rosetta "
"packages.");
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
B_COMMAND_FUNCTION(bootstrap);
B_COMMAND_ARG(ARG_PATH)
{
B_ARG_NAME("sysroot");
B_ARG_DESC(
"the path to the system root directory to initialise.");
B_ARG_NR_VALUES(1);
}
B_COMMAND_HELP_OPTION();
}