diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-06-16 15:09:59 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-06-16 15:10:20 -0300 |
commit | 7860191a10545a809673d4c8203c925156609da3 (patch) | |
tree | 72d9f18671457377334264dafac994bfaa0aae91 /etc/inc | |
parent | ef462f2580c8e936b9b86c219ab1222498871f1b (diff) | |
download | pfsense-7860191a10545a809673d4c8203c925156609da3.zip pfsense-7860191a10545a809673d4c8203c925156609da3.tar.gz |
Create some symlinks inside pbi dir to reduce differences between 2.1 and 2.2 and avoid the need to change a lot of PBI scripts
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index fd662eb..9d521ed 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -524,11 +524,32 @@ function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = $result = exec("/usr/local/sbin/pbi_add " . $pkgstaging . " -f -v {$no_checksig} " . escapeshellarg($fetchto) . " 2>&1", $pkgaddout, $rc); pkg_debug($pkgname . " " . print_r($pkgaddout, true) . "\n"); if ($rc == 0) { - $links = get_pbi_binaries(escapeshellarg(preg_replace('/\.pbi$/','',$filename))); + $pbi_name = preg_replace('/\.pbi$/','',$filename); + + $gb = exec("/usr/local/sbin/pbi_info {$pbi_name} | /usr/bin/awk '/Prefix/ {print $2}'", $pbi_prefix); + $pbi_prefix = $pbi_prefix[0]; + + $links = get_pbi_binaries(escapeshellarg($pbi_name)); foreach($links as $link) { @unlink("/usr/local/{$link['link_name']}"); @symlink("{$link['target']}","/usr/local/{$link['link_name']}"); } + + $extra_links = array( + array("target" => "bin", "link_name" => "sbin"), + array("target" => "local/lib", "link_name" => "lib"), + array("target" => "local/libexec", "link_name" => "libexec"), + array("target" => "local/share", "link_name" => "share"), + array("target" => "local/etc", "link_name" => "etc") + ); + + foreach ($extra_links as $link) { + if (!file_exists($pbi_prefix . "/" . $link['target'])) + continue; + @rmdir("{$pbi_prefix}/{$link['link_name']}"); + unlink_if_exists("{$pbi_prefix}/{$link['link_name']}"); + @symlink("{$pbi_prefix}/{$link['target']}", "{$pbi_prefix}/{$link['link_name']}"); + } pkg_debug("pbi_add successfully completed.\n"); } else { if (is_array($pkgaddout)) |