diff options
Diffstat (limited to 'backend/modules/gentoo_portage/packages.php')
-rw-r--r-- | backend/modules/gentoo_portage/packages.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/backend/modules/gentoo_portage/packages.php b/backend/modules/gentoo_portage/packages.php index fc76026..e8be4bb 100644 --- a/backend/modules/gentoo_portage/packages.php +++ b/backend/modules/gentoo_portage/packages.php @@ -1,7 +1,13 @@ <?php -if (!is_array($pkgs)) - $pkgs=explode(' ', $pkgs); -foreach ($pkgs as $i => &$pkg) - $pkg=escapeshellarg($pkg); -execute_command_with_env('Install '.(count($pkgs) > 1?'packages':$pkgs[0]), 'emerge '.implode(' ', $pkgs), $prtg_cfgrt); +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 (!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); +} ?> |