summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/Makefile.am2
-rw-r--r--libopkg/args.c4
-rw-r--r--libopkg/args.h2
-rw-r--r--libopkg/opkg_conf.c11
4 files changed, 11 insertions, 8 deletions
diff --git a/libopkg/Makefile.am b/libopkg/Makefile.am
index 8783f15..0e9d3a9 100644
--- a/libopkg/Makefile.am
+++ b/libopkg/Makefile.am
@@ -1,5 +1,5 @@
-AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS)
+AM_CFLAGS=-Wall -Werror -DHOST_CPU_STR=\"@host_cpu@\" -DBUILD_CPU=@build_cpu@ -DLIBDIR=\"@libdir@\" -DOPKGLIBDIR=\"@opkglibdir@\" -DOPKGETCDIR=\"@opkgetcdir@\" -DDATADIR=\"@datadir@\" -I$(top_srcdir) $(BIGENDIAN_CFLAGS) $(CURL_CFLAGS) $(GPGME_CFLAGS)
libopkg_includedir=$(includedir)/libopkg
libopkg_include_HEADERS= opkg.h
diff --git a/libopkg/args.c b/libopkg/args.c
index 71692f0..ef2b496 100644
--- a/libopkg/args.c
+++ b/libopkg/args.c
@@ -47,10 +47,10 @@ enum long_args_opt
ARGS_OPT_CACHE,
};
+char *conf_file_dir;
+
int args_init(args_t *args)
{
- char *conf_file_dir;
-
if (!args) {
return EFAULT;
}
diff --git a/libopkg/args.h b/libopkg/args.h
index b05bab1..e8bb78b 100644
--- a/libopkg/args.h
+++ b/libopkg/args.h
@@ -48,7 +48,7 @@ struct args
};
typedef struct args args_t;
-#define ARGS_DEFAULT_CONF_FILE_DIR "/etc/opkg"
+#define ARGS_DEFAULT_CONF_FILE_DIR OPKGETCDIR"/opkg"
#define ARGS_DEFAULT_CONF_FILE_NAME "opkg.conf"
#define ARGS_DEFAULT_DEST NULL
#define ARGS_DEFAULT_FORCE_DEFAULTS 0
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 0479b8a..fbbd2b2 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -21,7 +21,7 @@
#include "xregex.h"
#include "sprintf_alloc.h"
-#include "opkg_conf.h"
+#include "args.h"
#include "opkg_message.h"
#include "file_util.h"
#include "str_util.h"
@@ -33,6 +33,8 @@
#include <sys/stat.h>
#include <fcntl.h>
+extern char *conf_file_dir;
+
static int opkg_conf_parse_file(opkg_conf_t *conf, const char *filename,
pkg_src_list_t *pkg_src_list,
nv_pair_list_t *tmp_dest_nv_pair_list,
@@ -110,7 +112,7 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
nv_pair_list_t tmp_dest_nv_pair_list;
char *lists_dir = NULL, *lock_file = NULL;
glob_t globbuf;
- char *etc_opkg_conf_pattern = "/etc/opkg/*.conf";
+ char *etc_opkg_conf_pattern;
char *pending_dir = NULL;
memset(conf, 0, sizeof(opkg_conf_t));
@@ -192,10 +194,11 @@ int opkg_conf_init(opkg_conf_t *conf, const args_t *args)
if (args->offline_root)
sprintf_alloc(&etc_opkg_conf_pattern, "%s/etc/opkg/*.conf", args->offline_root);
+ else
+ sprintf_alloc(&etc_opkg_conf_pattern, "%s/*.conf", conf_file_dir);
memset(&globbuf, 0, sizeof(globbuf));
err = glob(etc_opkg_conf_pattern, 0, NULL, &globbuf);
- if (args->offline_root)
- free (etc_opkg_conf_pattern);
+ free (etc_opkg_conf_pattern);
if (!err) {
int i;
for (i = 0; i < globbuf.gl_pathc; i++) {