Project

General

Profile

« Previous | Next » 

Revision bed6c19b

Added by Renato Botelho over 9 years ago

Detect binary packages installed but not registered in the system and do it during boot

View differences:

src/etc/inc/pkg-utils.inc
452 452
	return $result;
453 453
}
454 454

  
455
/*
456
 * If binary pkg is installed but post-install tasks were not
457
 * executed yet, fo it now.
458
 * This scenario can happen when a pkg is pre-installed during
459
 * build phase, and at this point, cannot find a running system
460
 * to register itself in config.xml and also execute custom
461
 * install functions
462
 */
463
function register_all_installed_packages() {
464
	global $g, $config, $pkg_interface;
465

  
466
	$pkg_info = get_pkg_info('all', 'all', true);
467

  
468
	foreach ($pkg_info as $pkg) {
469
		if (!isset($pkg['installed'])) {
470
			continue;
471
		}
472

  
473
		pkg_remove_prefix($pkg['name']);
474

  
475
		if (is_package_installed($pkg['name'])) {
476
			continue;
477
		}
478

  
479
		update_status(sprintf(gettext(
480
		    "Running last steps of %s installation.") . "\n",
481
		    $pkg['name']));
482
		install_package_xml($pkg['name']);
483
	}
484
}
485

  
455 486
/*
456 487
 * resync_all_package_configs() Force packages to setup their configuration and rc.d files.
457 488
 * This function may also print output to the terminal indicating progress.
src/etc/rc.bootup
31 31
	POSSIBILITY OF SUCH DAMAGE.
32 32
*/
33 33

  
34
require_once("pkg-utils.inc");
35

  
34 36
function rescue_detect_keypress() {
35 37
	// How long do you want the script to wait before moving on (in seconds)
36 38
	$timeout=9;
......
411 413
/* Resync / Reinstall packages if need be */
412 414
if (file_exists('/conf/needs_package_sync') &&
413 415
    ($g['platform'] == $g['product_name'] || $g['platform'] == "nanobsd")) {
414
	require_once("pkg-utils.inc");
415 416
	mark_subsystem_dirty('packagelock');
416 417
	if (package_reinstall_all()) {
417 418
		@unlink('/conf/needs_package_sync');
......
419 420
	clear_subsystem_dirty('packagelock');
420 421
}
421 422

  
423
/* Detect installed binary pkgs that are not registered in the system */
424
register_all_installed_packages();
425

  
422 426
/* Give syslogd a kick after everything else has been initialized, otherwise it can occasionally
423 427
   fail to route syslog messages properly on both IPv4 and IPv6 */
424 428
system_syslogd_start();

Also available in: Unified diff