Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Enabling of plugins is done via the configuration file
Marin Atanasov Nikolov committed 13 years ago
commit 9dbddb984b895187dc660b9e6c9f3996031cb713
parent c3ffe33
3 files changed +15 -4
modified libpkg/pkg.h
@@ -262,7 +262,8 @@ typedef enum _pkg_config_key {
	PKG_CONFIG_PORTAUDIT_SITE,
	PKG_CONFIG_SRV_MIRROR,
	PKG_CONFIG_FETCH_RETRY,
-
	PKG_CONFIG_PLUGINS_DIR
+
	PKG_CONFIG_PLUGINS_DIR,
+
	PKG_CONFIG_ENABLE_PLUGINS
} pkg_config_key;

typedef enum {
modified libpkg/pkg_config.c
@@ -179,6 +179,12 @@ static struct config_entry c[] = {
		"/usr/local/etc/pkg/plugins",
		{ NULL }
	},
+
	[PKG_CONFIG_ENABLE_PLUGINS] = {
+
		BOOL,
+
		"PKG_ENABLE_PLUGINS",
+
		"NO",
+
		{ NULL }
+
	},
};

static bool parsed = false;
modified pkg/main.c
@@ -174,7 +174,7 @@ main(int argc, char **argv)
	int version = 0;
	int ret = EX_OK;
	const char *buf = NULL;
-
	bool b;
+
	bool b, plugins_enabled;
	struct pkg_config_kv *kv = NULL;
	
	/* Set stdout unbuffered */
@@ -243,8 +243,12 @@ main(int argc, char **argv)
	if (pkg_init(NULL) != EPKG_OK)
		errx(EX_SOFTWARE, "Cannot parse configuration file!");

-
	if (pkg_plugins_init() != EPKG_OK)
-
		errx(EX_SOFTWARE, "Plugins cannot be loaded");
+
	pkg_config_bool(PKG_CONFIG_ENABLE_PLUGINS, &plugins_enabled);
+

+
	if (plugins_enabled) {
+
		if (pkg_plugins_init() != EPKG_OK)
+
			errx(EX_SOFTWARE, "Plugins cannot be loaded");
+
	}

	pkg_plugins_display_loaded();