Project

General

Profile

« Previous | Next » 

Revision 5f18c7fe

Added by Colin Smith over 20 years ago

Fix logic for checking for package reinstallation.

XXX: Some logic is still a bit shaky.

View differences:

usr/local/www/pkg_mgr_install.php
311 311

  
312 312
    $pkgid = get_pkg_id($pkgent['name']);
313 313

  
314
    if($pkgid == -1) {
315
        $config['installedpackages']['package'][] = $pkgent;
316
    } else {
317
	$static_output .= "Package already registered in config.xml!\n";
318
	$config['installedpackages']['package'][$pkgid] = $pkgent; 
319
    }
320

  
321 314
    if(!$_GET['mode'] == "reinstallall") {
322 315
	$static_output .= "Saving updated package information... ";
323
        update_output_window($static_output);
324
        fwrite($fd_log, "Saving updated package information ...\n");
325
        /*
326
         * Make sure that this package isn't already installed.
327
         */
328
        if(!is_package_installed($pkgent['name']))        
329
            write_config("Installed package {$pkgent['name']}");
330
        /* remount rw after write_config() since it will mount ro. */
316
	update_output_window($static_output);
317
	if($pkgid == -1) {
318
		$config['installedpackages']['package'][] = $pkgent;
319
		$changedesc = "Installed {$pkgent['name']} package.";
320
		$to_output = "done.\n";
321
	} else {
322
		$config['installedpackages']['package'][$pkgid] = $pkgent;
323
		$changedesc = "Overwrote previous installation of {$pkgent['name']}.";
324
		$to_output = "overwrite!\n";
325
	}
326
        write_config($changedesc);
331 327
        conf_mount_rw();
332
	$static_output .= "done.\n";
328
	$static_output .= $to_output;
333 329
	update_output_window($static_output);
334 330
    }
335 331

  

Also available in: Unified diff