Project

General

Profile

« Previous | Next » 

Revision f5b1c660

Added by Renato Botelho over 9 years ago

Stop forcing pkg_prefix on is_pkg_installed() and pkg_install()

View differences:

src/etc/inc/pkg-utils.inc
294 294
function is_pkg_installed($pkg_name) {
295 295
	global $g;
296 296

  
297
	pkg_remove_prefix($pkg_name);
297
	if (empty($pkg_name)) {
298
		return false;
299
	}
298 300

  
299
	return pkg_call("info -e " . $g['pkg_prefix'] . $pkg_name, true);
301
	return pkg_call("info -e " . $pkg_name, true);
300 302
}
301 303

  
302 304
/* Install package, $pkg_name should not contain prefix */
......
304 306
	global $g;
305 307
	$result = false;
306 308

  
307
	pkg_remove_prefix($pkg_name);
309
	$shortname = $pkg_name;
310
	pkg_remove_prefix($shortname);
308 311

  
309 312
	$pkg_force = "";
310 313
	if ($force) {
311 314
		$pkg_force = "-f ";
312 315
	}
313 316

  
314
	pkg_debug("Installing package {$pkg_name}\n");
317
	pkg_debug("Installing package {$shortname}\n");
315 318
	if ($force || !is_pkg_installed($pkg_name)) {
316
		$result = pkg_call("install -y " . $pkg_force . $g['pkg_prefix'] . $pkg_name);
319
		$result = pkg_call("install -y " . $pkg_force . $pkg_name);
317 320
		/* Cleanup cacke to free disk space */
318 321
		pkg_call("clean -y");
319 322
	}
......
325 328
function pkg_delete($pkg_name) {
326 329
	global $g;
327 330

  
328
	pkg_remove_prefix($pkg_name);
331
	$shortname = $pkg_name;
332
	pkg_remove_prefix($shortname);
329 333

  
330
	pkg_debug("Removing package {$pkg_name}\n");
334
	pkg_debug("Removing package {$shortname}\n");
331 335
	if (is_pkg_installed($pkg_name)) {
332
		pkg_call("delete -y " . $g['pkg_prefix'] . $pkg_name);
336
		pkg_call("delete -y " . $pkg_name);
333 337
		/* Cleanup unecessary dependencies */
334 338
		pkg_call("autoremove -y");
335 339
	}
......
516 520
		$internal_name = get_package_internal_name($config['installedpackages']['package'][$id]);
517 521
		stop_service($internal_name);
518 522
	}
523
	$pkg_name = $g['pkg_prefix'] . $internal_name;
519 524

  
520
	if (is_pkg_installed($internal_name)) {
525
	if (is_pkg_installed($pkg_name)) {
521 526
		$static_output .= "Removing package...\n";
522 527
		update_output_window($static_output);
523
		pkg_delete($internal_name);
528
		pkg_delete($pkg_name);
524 529
	} else {
525 530
		delete_package_xml($package_name);
526 531
	}
......
1057 1062
	/* Obsoleted packages were removed, lets reinstall all remaining */
1058 1063
	foreach ($config['installedpackages']['package'] as $package) {
1059 1064
		$internal_name = get_package_internal_name($package);
1060
		pkg_install($internal_name, true);
1065
		pkg_install($g['pkg_prefix'] . $internal_name, true);
1061 1066
	}
1062 1067

  
1063 1068
	return true;

Also available in: Unified diff