blob: 234186c2e73a3c4e5495b868957c2b368fe9e5dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<?php
function portage_install($pkgs, $desc=null, $opts=null, $use=null) {
global $prtg_cfgrt, $conf;
$opts=$conf['emerge_default_opts'].' '.($opts === null?'-K -n --root-deps=rdeps':$opts);
if (!$pkgs) return;
if (!is_array($pkgs))
$pkgs=explode(' ', $pkgs);
if ($desc === null)
$desc='Install '.(count($pkgs) > 1?'packages':$pkgs[0]);
foreach ($pkgs as $i => &$pkg)
$pkg=escapeshellarg($pkg);
execute_command_with_env($desc, ($use?'env USE="'.(is_array($use)?implode(' ', $use):$use).'" ':'').'emerge '.($opts?$opts.' ':'').implode(' ', $pkgs), $prtg_cfgrt);
}
?>
|