summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Conder <jonno.conder@gmail.com>2011-10-26 19:51:31 +1300
committerJonathan Conder <jonno.conder@gmail.com>2012-01-17 12:54:09 +1300
commitfcfe0fb1e51187df0f770601a2318af0303654f2 (patch)
tree1067af91b02eb8e5c86af4f82541d27099888713
parentf2db7e1a74beb3738257ccac2f80b4a62f84fd4a (diff)
alpm: add GPGDir config option
-rw-r--r--backends/alpm/Makefile.am2
-rw-r--r--backends/alpm/pk-backend-alpm.c1
-rw-r--r--backends/alpm/pk-backend-config.c27
3 files changed, 29 insertions, 1 deletions
diff --git a/backends/alpm/Makefile.am b/backends/alpm/Makefile.am
index 5a5468abf..d8c3dfcbc 100644
--- a/backends/alpm/Makefile.am
+++ b/backends/alpm/Makefile.am
@@ -5,6 +5,7 @@ PK_BACKEND_REPO_FILE = $(confdir)/repos.list
PK_BACKEND_DEFAULT_PATH = "/bin:/usr/bin:/sbin:/usr/sbin"
PK_BACKEND_DEFAULT_ROOT = "/"
PK_BACKEND_DEFAULT_DBPATH = $(localstatedir)/lib/pacman/
+PK_BACKEND_DEFAULT_GPGDIR = $(sysconfdir)/pacman.d/gnupg/
PK_BACKEND_DEFAULT_CACHEDIR = $(localstatedir)/cache/pacman/pkg/
PK_BACKEND_DEFAULT_LOGFILE = $(localstatedir)/log/pacman.log
@@ -17,6 +18,7 @@ DEFS = -DPK_BACKEND_CONFIG_FILE=\"$(PK_BACKEND_CONFIG_FILE)\" \
-DPK_BACKEND_DEFAULT_PATH=\"$(PK_BACKEND_DEFAULT_PATH)\" \
-DPK_BACKEND_DEFAULT_ROOT=\"$(PK_BACKEND_DEFAULT_ROOT)\" \
-DPK_BACKEND_DEFAULT_DBPATH=\"$(PK_BACKEND_DEFAULT_DBPATH)\" \
+ -DPK_BACKEND_DEFAULT_GPGDIR=\"$(PK_BACKEND_DEFAULT_GPGDIR)\" \
-DPK_BACKEND_DEFAULT_CACHEDIR=\"$(PK_BACKEND_DEFAULT_CACHEDIR)\" \
-DPK_BACKEND_DEFAULT_LOGFILE=\"$(PK_BACKEND_DEFAULT_LOGFILE)\" \
-DALPM_CACHE_PATH=\"$(ALPM_CACHE_PATH)\" \
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index ba993f079..c3591b96a 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -230,6 +230,7 @@ pk_backend_initialize_alpm (PkBackend *self, GError **error)
alpm_option_set_logcb (pk_backend_logcb);
alpm_option_set_root (PK_BACKEND_DEFAULT_ROOT);
alpm_option_set_dbpath (PK_BACKEND_DEFAULT_DBPATH);
+ alpm_option_set_signaturedir (PK_BACKEND_DEFAULT_GPGDIR);
alpm_option_set_logfile (PK_BACKEND_DEFAULT_LOGFILE);
return TRUE;
diff --git a/backends/alpm/pk-backend-config.c b/backends/alpm/pk-backend-config.c
index 21a4c541c..a7d9efd80 100644
--- a/backends/alpm/pk-backend-config.c
+++ b/backends/alpm/pk-backend-config.c
@@ -33,7 +33,7 @@
typedef struct {
gboolean checkspace, ilovecandy, showsize, totaldl, usedelta, usesyslog;
- gchar *arch, *cleanmethod, *dbpath, *logfile, *root, *xfercmd;
+ gchar *arch, *cleanmethod, *dbpath, *gpgdir, *logfile, *root, *xfercmd;
alpm_list_t *cachedirs, *holdpkgs, *ignoregrps, *ignorepkgs,
*noextracts, *noupgrades, *syncfirsts;
@@ -76,6 +76,7 @@ pk_backend_config_free (PkBackendConfig *config)
g_free (config->arch);
g_free (config->cleanmethod);
g_free (config->dbpath);
+ g_free (config->gpgdir);
g_free (config->logfile);
g_free (config->root);
g_free (config->xfercmd);
@@ -234,6 +235,17 @@ pk_backend_config_set_dbpath (PkBackendConfig *config, const gchar *path)
}
static void
+pk_backend_config_set_gpgdir (PkBackendConfig *config, const gchar *path)
+{
+ g_return_if_fail (config != NULL);
+ g_return_if_fail (path != NULL);
+
+ g_free (config->gpgdir);
+ config->gpgdir = g_strdup (path);
+}
+
+
+static void
pk_backend_config_set_logfile (PkBackendConfig *config, const gchar *filename)
{
g_return_if_fail (config != NULL);
@@ -274,6 +286,7 @@ static const PkBackendConfigString pk_backend_config_string_options[] = {
{ "CacheDir", pk_backend_config_add_cachedir },
{ "CleanMethod", pk_backend_config_set_cleanmethod },
{ "DBPath", pk_backend_config_set_dbpath },
+ { "GPGDir", pk_backend_config_set_gpgdir },
{ "LogFile", pk_backend_config_set_logfile },
{ "RootDir", pk_backend_config_set_root },
{ "XferCommand", pk_backend_config_set_xfercmd },
@@ -638,6 +651,18 @@ pk_backend_config_configure_paths (PkBackendConfig *config, GError **error)
return FALSE;
}
+ if (config->gpgdir == NULL) {
+ config->gpgdir = g_strconcat (alpm_option_get_root (),
+ PK_BACKEND_DEFAULT_GPGDIR + 1,
+ NULL);
+ }
+
+ if (alpm_option_set_signaturedir (config->gpgdir) < 0) {
+ g_set_error (error, ALPM_ERROR, pm_errno, "GPGDir: %s",
+ alpm_strerrorlast ());
+ return FALSE;
+ }
+
if (config->logfile == NULL) {
config->logfile = g_strconcat (alpm_option_get_root (),
PK_BACKEND_DEFAULT_LOGFILE + 1,