diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-02-14 11:19:59 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-02-14 11:19:59 -0200 |
commit | fe640345b6e7cdf83ce0512088b630aeff5d9589 (patch) | |
tree | efc4ac23a34f14f635d05b4e2da1885da3264785 /etc/inc/pkg-utils.inc | |
parent | d210dddff39462019bc9b349cb3322a92d88feca (diff) | |
download | pfsense-fe640345b6e7cdf83ce0512088b630aeff5d9589.zip pfsense-fe640345b6e7cdf83ce0512088b630aeff5d9589.tar.gz |
Abort installation when pbi_add fails
Diffstat (limited to 'etc/inc/pkg-utils.inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 4f4f5ef..c4e3ef4 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -567,21 +567,32 @@ function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = $pkgaddout = ""; - exec("/usr/local/sbin/pbi_add " . $pkgstaging . " -f -v --no-checksig " . escapeshellarg($fetchto) . " 2>&1", $pkgaddout); - pkg_debug($pkgname . " " . print_r($pkgaddout, true) . "\npbi_add successfully completed.\n"); - setup_library_paths(); - exec("/usr/local/sbin/pbi_info " . escapeshellarg(preg_replace('/\.pbi$/','',$filename)) . " | /usr/bin/awk '/Prefix/ {print $2}'",$pbidir); - $pbidir = $pbidir[0]; - $linkdirs = array('bin','sbin'); - foreach($linkdirs as $dir) { - if(is_dir("{$pbidir}/{$dir}")) { - $files = scandir("{$pbidir}/{$dir}"); - foreach($files as $f) { - if(!file_exists("/usr/local/{$dir}/{$f}")) { - symlink("{$pbidir}/{$dir}/{$f}","/usr/local/{$dir}/{$f}"); + 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) { + setup_library_paths(); + exec("/usr/local/sbin/pbi_info " . escapeshellarg(preg_replace('/\.pbi$/','',$filename)) . " | /usr/bin/awk '/Prefix/ {print $2}'",$pbidir); + $pbidir = $pbidir[0]; + $linkdirs = array('bin','sbin'); + foreach($linkdirs as $dir) { + if(is_dir("{$pbidir}/{$dir}")) { + $files = scandir("{$pbidir}/{$dir}"); + foreach($files as $f) { + if(!file_exists("/usr/local/{$dir}/{$f}")) { + @symlink("{$pbidir}/{$dir}/{$f}","/usr/local/{$dir}/{$f}"); + } } } } + pkg_debug("pbi_add successfully completed.\n"); + } else { + if (is_array($pkgaddout)) + foreach ($pkgaddout as $line) + $static_output .= " " . $line .= "\n"; + + update_output_window($static_output); + pkg_debug("pbi_add failed.\n"); + return false; } } return true; |