summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/inc/pkg-utils.inc22
-rwxr-xr-xetc/rc.bootup12
2 files changed, 33 insertions, 1 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 708b897..8dc8ae4 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -1096,4 +1096,26 @@ function squash_from_bytes($size, $round = "") {
return;
}
+function pkg_reinstall_all() {
+ global $g, $config;
+ $pkg_id = 0;
+ $todo = array();
+ if ($config['installedpackages']['package'])
+ exec("rm -rf /var/db/pkg/*");
+ if (is_array($config['installedpackages']['package']))
+ foreach($config['installedpackages']['package'] as $package)
+ $todo[] = array('name' => $package['name'], 'version' => $package['version']);
+ echo "One moment please, reinstalling packages...\n";
+ if(is_array($todo)) {
+ foreach($todo as $pkgtodo) {
+ $static_output = "";
+ if($pkgtodo['name']) {
+ uninstall_package($pkgtodo['name']);
+ install_package($pkgtodo['name']);
+ $pkg_id++;
+ }
+ }
+ }
+}
+
?> \ No newline at end of file
diff --git a/etc/rc.bootup b/etc/rc.bootup
index fe1faa3..047f4ef 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -381,6 +381,16 @@ activate_powerd();
if (file_exists("/sbin/shutdown.old"))
@unlink("/sbin/shutdown.old");
+/* Resync / Reinstall packages if need be */
+if(file_exists('/conf/needs_package_sync')) {
+ if($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
+ if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
+ pkg_reinstall_all();
+ unlink('/conf/needs_package_sync');
+ }
+ }
+}
+
/* done */
unset($g['booting']);
@@ -388,4 +398,4 @@ led_normalize();
conf_mount_ro();
-?>
+?> \ No newline at end of file
OpenPOWER on IntegriCloud