summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/pkg-utils.inc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-11-18 08:50:06 -0200
committerRenato Botelho <renato@netgate.com>2015-11-18 08:50:06 -0200
commitad3c976343c3bae77a548d654d159173c0ad72ef (patch)
treee3800b09423c03e73449c17b697e6e6c8013a243 /src/etc/inc/pkg-utils.inc
parent2feadae14ff31e31f7eefb7a5197e9cc03213b2d (diff)
downloadpfsense-ad3c976343c3bae77a548d654d159173c0ad72ef.zip
pfsense-ad3c976343c3bae77a548d654d159173c0ad72ef.tar.gz
Add a new function pkg_switch_repo() to change between stable and devel pkg repo
Diffstat (limited to 'src/etc/inc/pkg-utils.inc')
-rw-r--r--src/etc/inc/pkg-utils.inc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index c7fd47e..821f610 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -1137,4 +1137,30 @@ function get_system_pkg_version() {
);
}
+/* Switch between stable and devel repos */
+function pkg_switch_repo($devel = false) {
+ global $g;
+
+ $repo_stable = $g['product_name'] . '-repo';
+ $repo_devel = $g['product_name'] . '-repo-devel';
+
+ if ($devel) {
+ $repo_target = $repo_devel;
+ } else {
+ $repo_target = $repo_stable;
+ }
+
+ if (is_pkg_installed($repo_target)) {
+ /* It's already installed */
+ return true;
+ }
+
+ /*
+ * Since both install files in the same place, just
+ * call pkg_install for target and current one will
+ * be replaced
+ */
+ return pkg_install($repo_target, true);
+}
+
?>
OpenPOWER on IntegriCloud