From: Michael Tremer Date: Sun, 5 Jan 2025 14:43:36 +0000 (+0000) Subject: cli: Remove legacy distro configuration loading code X-Git-Tag: 0.9.30~529 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eeb97b6f07f6467d225b417df5ef159ccde9643d;p=pakfire.git cli: Remove legacy distro configuration loading code Signed-off-by: Michael Tremer --- diff --git a/src/cli/lib/pakfire.c b/src/cli/lib/pakfire.c index 11f6725b7..32e824d34 100644 --- a/src/cli/lib/pakfire.c +++ b/src/cli/lib/pakfire.c @@ -28,34 +28,6 @@ #include "pakfire.h" #include "progressbar.h" -static FILE* open_distro_config(const char* distro) { - char path[PATH_MAX]; - FILE* f = NULL; - int r; - - // XXX hard-coded path - - // Make the path - r = snprintf(path, sizeof(path), "/etc/pakfire/distros/%s.conf", distro); - if (r < 0) - return NULL; - - // Open the configuration file - f = fopen(path, "r"); - if (!f) { - switch (errno) { - case ENOENT: - fprintf(stderr, "Could not find distro '%s': %m\n", distro); - break; - - default: - break; - } - } - - return f; -} - static void cli_set_repo_enabled(struct pakfire* pakfire, const char* name, int enabled) { struct pakfire_repo* repo = NULL; @@ -82,28 +54,13 @@ int cli_setup_pakfire(struct pakfire** pakfire, struct cli_config* config) { if (r < 0) goto ERROR; - // Open the distro configuration - if (config->distro) { - f = open_distro_config(config->distro); - if (!f) { - r = 1; - goto ERROR; - } - // Open the regular configuration - } else if (config->config) { - f = fopen(config->config, "r"); - if (!f) { - r = -errno; + if (config->config) { + r = pakfire_config_read_path(c, config->config); + if (r < 0) goto ERROR; - } } - // Read the configuration file - r = pakfire_config_read(c, f); - if (r < 0) - goto ERROR; - // Initialize Pakfire r = pakfire_create(&p, config->ctx, c, config->root, config->arch, config->flags); if (r < 0) {