summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-07-28 17:59:33 -0400
committerEudyptula <eitan@mosenkis.net>2009-07-28 17:59:33 -0400
commit1111ed6cfea640c6d014676d3568256636c6527d (patch)
tree1734911b23e454283cef21f0d3eb2ea547783c35
parentAdd package and init script pruning to frontend (diff)
downloadingenue-1111ed6cfea640c6d014676d3568256636c6527d.tar.gz
ingenue-1111ed6cfea640c6d014676d3568256636c6527d.tar.bz2
ingenue-1111ed6cfea640c6d014676d3568256636c6527d.zip
Implement init script and package pruning in backend
-rw-r--r--backend/modules/gentoo_portage/base-system.php16
-rw-r--r--backend/modules/gentoo_portage/build.php2
-rw-r--r--backend/modules/gentoo_portage/init.d.php8
-rw-r--r--backend/modules/gentoo_portage/packages.php1
-rw-r--r--todo7
5 files changed, 30 insertions, 4 deletions
diff --git a/backend/modules/gentoo_portage/base-system.php b/backend/modules/gentoo_portage/base-system.php
index df1eb26..35dc91e 100644
--- a/backend/modules/gentoo_portage/base-system.php
+++ b/backend/modules/gentoo_portage/base-system.php
@@ -2,4 +2,20 @@
$file=CACHE.'/stage3/'.$profile->stage3;
$opt='-xv'.(substr($file, -3) == 'bz2'?'j':'z').'f';
execute_command('Unpack base system', "tar $opt '$file' -C '$I'");
+if ($opts['basesystem'] == 'manual' && $opts['prunepkgs']) {
+ portage_install($opts['prunepkgs'], 'Prune base system packages', '-C');
+} elseif ($opts['basesystem'] == 'autoprune') {
+ throw_exception('Base system autoprune not implemented - need package list');
+ $keep=explode(' ', $keep_pkgs);
+ $remove=array();
+ $r=$S['pdo']->query('SELECT * FROM `gentoo_basepkgs` WHERE `profile`='.$profile->id);
+ while ($pkg=$r->fetch(PDO::FETCH_ASSOC)) {
+ $pkg=$pkg['pkg'];
+ if (($i=array_search($pkg, $keep)) === false)
+ $remove[]=$pkg;
+ else
+ unset($keep[$i]);
+ }
+ portage_install($remove, 'Automatically prune base system packages', '-C');
+}
?>
diff --git a/backend/modules/gentoo_portage/build.php b/backend/modules/gentoo_portage/build.php
index ad84a98..aef8bde 100644
--- a/backend/modules/gentoo_portage/build.php
+++ b/backend/modules/gentoo_portage/build.php
@@ -11,6 +11,8 @@ function gentoo_portage_build(&$build, &$opts, &$W) {
if ($conf['debug'])
execute_command_with_env('Log portage setup', 'emerge --info', $prtg_cfgrt);
require(dirname(__FILE__).'/base-system.php'); // __DIR__ 5.3.0
+ if (in_array('pruneinit', $extra))
+ require(dirname(__FILE__).'/init.d.php'); // __DIR__ 5.3.0
if (in_array('timezone', $extra))
require(dirname(__FILE__).'/timezone.php'); // __DIR__ 5.3.0
if (in_array('dev-manager', $extra))
diff --git a/backend/modules/gentoo_portage/init.d.php b/backend/modules/gentoo_portage/init.d.php
new file mode 100644
index 0000000..deef101
--- /dev/null
+++ b/backend/modules/gentoo_portage/init.d.php
@@ -0,0 +1,8 @@
+<?php
+start_internal_task('Remove unwanted init scripts');
+foreach (explode(' ', $opts['pruneinit']) as $init) {
+ list($name, $runlevel)=explode(':', $init, 2);
+ log_status("$name ($runlevel)", unlink("$I/etc/runlevels/$runlevel/$name"));
+}
+end_internal_task(0);
+?>
diff --git a/backend/modules/gentoo_portage/packages.php b/backend/modules/gentoo_portage/packages.php
index e8be4bb..234186c 100644
--- a/backend/modules/gentoo_portage/packages.php
+++ b/backend/modules/gentoo_portage/packages.php
@@ -2,6 +2,7 @@
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)
diff --git a/todo b/todo
index b55aeac..b7bfde0 100644
--- a/todo
+++ b/todo
@@ -1,16 +1,15 @@
Write a live git ebuild
Add a profiles management page/backend utility
Add cleanup functions to the frontend and backend (tasks dir in backend containing scripts that can be launched through frontend)
-Move bundler selection out of gentoo module and generalize it
+Move bundler selection out of gentoo module
+ Only offer bundlers that will work - profiles without CD in map file can't make livecd, installcd, etc.
Allow config viewing for builds, not just configurations
Add `flags` column to configurations, builds, use it to implement public and private things
Add 'cancel', option to builds, allow deletion of currently running builds
Add build->configuration and configuration duplication
Add map file for liveCD, load it into DB, etc.
Write script for fetching latest stage3's from the desired FTP dirs
-Add ability to trim the stage3 to a minimum set of packages automatically (cached) or manually (present db-cached list of packages present in stage3 and allow user to select which to remove)
-Only offer bundlers that will work - profiles without CD in map file can't make livecd, installcd, etc.
-Add option to remove default runscripts
+Add ability to trim the stage3 to a minimum set of packages automatically (cached)
Add option to add arbitrary runscripts
Add option to upload a kernel
Add option to upload an arbitrary tar.gz/bz2 to be unzipped over the finished image