summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-03-03 15:02:39 -0300
committerRenato Botelho <renato@netgate.com>2016-03-03 15:02:39 -0300
commitbed6c19b3c78bf1841f360a076ee10a457716d2d (patch)
treee6c13315d64c7dc9e6437dd89f253fcaea40a81f
parentc86db913df4c996020d73e0016e76fba49e2cfbe (diff)
downloadpfsense-bed6c19b3c78bf1841f360a076ee10a457716d2d.zip
pfsense-bed6c19b3c78bf1841f360a076ee10a457716d2d.tar.gz
Detect binary packages installed but not registered in the system and do it during boot
-rw-r--r--src/etc/inc/pkg-utils.inc31
-rwxr-xr-xsrc/etc/rc.bootup6
2 files changed, 36 insertions, 1 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index 3977ce8..cae55bf 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -453,6 +453,37 @@ function get_pkg_info($pkgs = 'all', $info = 'all', $only_local = false) {
}
/*
+ * If binary pkg is installed but post-install tasks were not
+ * executed yet, fo it now.
+ * This scenario can happen when a pkg is pre-installed during
+ * build phase, and at this point, cannot find a running system
+ * to register itself in config.xml and also execute custom
+ * install functions
+ */
+function register_all_installed_packages() {
+ global $g, $config, $pkg_interface;
+
+ $pkg_info = get_pkg_info('all', 'all', true);
+
+ foreach ($pkg_info as $pkg) {
+ if (!isset($pkg['installed'])) {
+ continue;
+ }
+
+ pkg_remove_prefix($pkg['name']);
+
+ if (is_package_installed($pkg['name'])) {
+ continue;
+ }
+
+ update_status(sprintf(gettext(
+ "Running last steps of %s installation.") . "\n",
+ $pkg['name']));
+ install_package_xml($pkg['name']);
+ }
+}
+
+/*
* resync_all_package_configs() Force packages to setup their configuration and rc.d files.
* This function may also print output to the terminal indicating progress.
*/
diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup
index b7c3afb..54cd831 100755
--- a/src/etc/rc.bootup
+++ b/src/etc/rc.bootup
@@ -31,6 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+require_once("pkg-utils.inc");
+
function rescue_detect_keypress() {
// How long do you want the script to wait before moving on (in seconds)
$timeout=9;
@@ -411,7 +413,6 @@ if (file_exists("/sbin/shutdown.old")) {
/* Resync / Reinstall packages if need be */
if (file_exists('/conf/needs_package_sync') &&
($g['platform'] == $g['product_name'] || $g['platform'] == "nanobsd")) {
- require_once("pkg-utils.inc");
mark_subsystem_dirty('packagelock');
if (package_reinstall_all()) {
@unlink('/conf/needs_package_sync');
@@ -419,6 +420,9 @@ if (file_exists('/conf/needs_package_sync') &&
clear_subsystem_dirty('packagelock');
}
+/* Detect installed binary pkgs that are not registered in the system */
+register_all_installed_packages();
+
/* Give syslogd a kick after everything else has been initialized, otherwise it can occasionally
fail to route syslog messages properly on both IPv4 and IPv6 */
system_syslogd_start();
OpenPOWER on IntegriCloud