Files
ropkg/ropam/bootstrap.c
T

63 lines
1.2 KiB
C
Raw Normal View History

#include "commands.h"
2026-06-22 17:45:54 +01:00
#include <fx/cmdline/cmd.h>
#include <ropkg/instance.h>
enum {
ARG_PATH,
};
static int bootstrap(
2026-06-22 17:45:54 +01:00
const fx_command *self,
const fx_arglist *opt,
const fx_array *args)
{
const char *root_path = NULL;
2026-06-22 17:45:54 +01:00
fx_status status = fx_arglist_get_string(
opt,
2026-06-22 17:45:54 +01:00
FX_COMMAND_INVALID_ID,
ARG_PATH,
0,
&root_path);
2026-06-22 17:45:54 +01:00
if (!FX_OK(status)) {
fx_arglist_report_missing_args(
opt,
2026-06-22 17:45:54 +01:00
FX_COMMAND_INVALID_ID,
ARG_PATH,
0);
return -1;
}
struct ropkg_instance *inst;
2026-06-22 17:45:54 +01:00
fx_result result = ropkg_instance_bootstrap(root_path, &inst);
if (fx_result_is_error(result)) {
fx_throw(result);
return -1;
}
2026-06-22 17:45:54 +01:00
ropkg_instance_close(inst);
return 0;
}
2026-06-22 17:45:54 +01:00
FX_COMMAND(CMD_BOOTSTRAP, CMD_ROOT)
{
2026-06-22 17:45:54 +01:00
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.");
2026-06-22 17:45:54 +01:00
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
FX_COMMAND_FUNCTION(bootstrap);
2026-06-22 17:45:54 +01:00
FX_COMMAND_ARG(ARG_PATH)
{
2026-06-22 17:45:54 +01:00
FX_ARG_NAME("sysroot");
FX_ARG_DESC(
"the path to the system root directory to initialise.");
2026-06-22 17:45:54 +01:00
FX_ARG_NR_VALUES(1);
}
2026-06-22 17:45:54 +01:00
FX_COMMAND_HELP_OPTION();
}