]> git.ipfire.org Git - pakfire.git/commitdiff
cli: Remove legacy distro configuration loading code
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 5 Jan 2025 14:43:36 +0000 (14:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 5 Jan 2025 14:43:36 +0000 (14:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/cli/lib/pakfire.c

index 11f6725b7bcc7d25ca171b659d4c7de73cc37c3b..32e824d34d58335dcb0f33c6afb1c07c8eef7d9d 100644 (file)
 #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) {