Project

General

Profile

« Previous | Next » 

Revision 3cc28680

Added by Renato Botelho about 11 years ago

Fix PBI installation when target lies on different directorie

View differences:

etc/inc/pkg-utils.inc
102 102
	// The packagestring passed in must be the full PBI package name, 
103 103
	// as displayed by the pbi_info utility. e.g. "package-1.2.3_4-i386" 
104 104
	// It must NOT have ".pbi" on the end.
105
	$files = get_pbi_binaries(escapeshellarg($packagestring));
106
	foreach($files as $target)
107
		if (is_link("/usr/local/{$target}"))
108
			@unlink("/usr/local/{$target}");
105
	$links = get_pbi_binaries(escapeshellarg($packagestring));
106
	foreach($links as $link)
107
		if (is_link("/usr/local/{$link['link_name']}"))
108
			@unlink("/usr/local/{$link['link_name']}");
109 109
	exec("/usr/local/sbin/pbi_delete " . escapeshellarg($packagestring) . " 2>>/tmp/pbi_delete_errors.txt");
110 110
}
111 111

  
......
525 525
		$result = exec("/usr/local/sbin/pbi_add " . $pkgstaging . " -f -v {$no_checksig} " . escapeshellarg($fetchto) . " 2>&1", $pkgaddout, $rc);
526 526
		pkg_debug($pkgname . " " . print_r($pkgaddout, true) . "\n");
527 527
		if ($rc == 0) {
528
			$files = get_pbi_binaries(escapeshellarg(preg_replace('/\.pbi$/','',$filename)));
529
			$gb = exec("/usr/local/sbin/pbi_info " .  escapeshellarg(preg_replace('/\.pbi$/','',$filename)) . " | /usr/bin/awk '/Prefix/ {print $2}'", $pbi_prefix);
530
			$pbi_prefix = $pbi_prefix[0];
531
			foreach($files as $target) {
532
				@unlink("/usr/local/{$target}");
533
				@symlink("{$pbi_prefix}/{$target}","/usr/local/{$target}");
528
			$links = get_pbi_binaries(escapeshellarg(preg_replace('/\.pbi$/','',$filename)));
529
			foreach($links as $link) {
530
				@unlink("/usr/local/{$link['link_name']}");
531
				@symlink("{$link['target']}","/usr/local/{$link['link_name']}");
534 532
			}
535 533
			pkg_debug("pbi_add successfully completed.\n");
536 534
		} else {
......
569 567
				if (!preg_match('/^TARGET:\s+(.*)$/', $pbiopt, $matches))
570 568
					continue;
571 569

  
572
				$result[] = $matches[1];
570
				$result[] = array(
571
					'target' => preg_replace('/\.pbiopt$/', '', $f),
572
					'link_name' => $matches[1]);
573 573
			}
574 574
		}
575 575
	}

Also available in: Unified diff