diff options
author | Eudyptula <eitan@mosenkis.net> | 2009-06-30 17:34:30 -0400 |
---|---|---|
committer | Eudyptula <eitan@mosenkis.net> | 2009-06-30 17:34:30 -0400 |
commit | a45898a7f4d4ed4b4ac7fc95c7d711888a21e85a (patch) | |
tree | 54f4db12a5f3c3d507f3c7a10f834306597e532e /backend | |
parent | Fix small mistakes in build function (diff) | |
download | ingenue-a45898a7f4d4ed4b4ac7fc95c7d711888a21e85a.tar.gz ingenue-a45898a7f4d4ed4b4ac7fc95c7d711888a21e85a.tar.bz2 ingenue-a45898a7f4d4ed4b4ac7fc95c7d711888a21e85a.zip |
Many fixes to CD building and some to command execution/logging
Diffstat (limited to 'backend')
-rw-r--r-- | backend/functions/build.php | 29 | ||||
-rw-r--r-- | backend/functions/signals.php | 4 |
2 files changed, 17 insertions, 16 deletions
diff --git a/backend/functions/build.php b/backend/functions/build.php index 1c4f457..a5e2058 100644 --- a/backend/functions/build.php +++ b/backend/functions/build.php @@ -58,28 +58,29 @@ function build(&$build) { } elseif ($imgtype == 'tgz') { sql_task::execute_command('Compress finished image to tar/gz', "tar -p --same-owner -czvf '$W/image.tar.gz' -C '$W/image' .", $build, true, null, $env); rename($W.'/image.tar.gz', COMPLETED.'/build-'.$build->id.'.tar.gz') || throw_exception('rename failed'); - } elseif ($imgtype == 'livecd') { - sql_task::execute_command('Compress finished image to squashfs', "mksquashfs '$W/image' '$W/image.squashfs' -info ", $build, true, null, $env); - } elseif ($imgtype !== 'installcd') { - throw_exception('invalid image type: '.$imgtype); - } - if ($imgtype == 'livecd' || $imgtype == 'installcd') { - $minimaliso='/home/eitan/soc/install-amd64-minimal-20090625.iso'; + } elseif ($imgtype == 'livecd' || $imgtype == 'installcd') { + if (strpos($headers['chost'], 'x86_64') === false) + $minimaliso='/home/eitan/soc/install-x86-minimal-20090623.iso'; + else + $minimaliso='/home/eitan/soc/install-amd64-minimal-20090625.iso'; sql_task::execute_command('Mount minimal CD image', "mount -o loop -t iso9660 '$minimaliso' '$W/tmp'", $build, true, null, $env); sql_task::execute_command('Copy CD image to writable temp directory', "cp -va '$W/tmp' '$W/cd'", $build, true, null, $env); sql_task::execute_command('Unmount CD image', "umount '$W/tmp'", $build, true, null, $env); + sql_task::execute_command('Copy kernel and initrd from CD to image', "cp -va '$W/cd/isolinux/gentoo' '$W/cd/isolinux/gentoo.igz' '$W/image/boot/'", $build, true, null, $env); + file_put_contents("$W/unsquashfs-files", "/lib64/modules\n\lib\modules\n"); + sql_task::execute_command('Copy kernel modules from SquashFS to image', "unsquashfs -i -d '$W/image' -e '$W/unsquashfs-files' '$W/cd/image.squashfs'", $build, true, null, $env); if ($imgtype == 'livecd') { - rename($W.'/image.squashfs', $W.'/cd/image.squashfs') || throw_exception('rename failed'); - } else { - sql_task::execute_command('Copy kernel modules to image', "cp -va '$W/cd/lib/modules' '$W/image/lib/'", $build, true, null, $env); - sql_task::execute_command('Compress finished image to tar/bzip2', "tar -p --same-owner -cjvf '$W/image.tar.bz2' -C '$W/image' .", $build, true, null, $env); - rename($W.'/image.tar.bz2', $W.'/cd/image.tar.bz2') || throw_exception('rename failed'); - } - // TODO port the rest of /usr/lib/catalyst/targets/support/create-iso.sh + rename("$W/cd/image.squashfs", "$W/image.squashfs.old") || debug('Failed to move old SquashFS'); + sql_task::execute_command('Compress finished image to squashfs', "mksquashfs '$W/image' '$W/cd/image.squashfs' -noappend -info", $build, true, null, $env); + } else // Install CD + sql_task::execute_command('Compress finished image to tar/bzip2', "tar -p --same-owner -cjvf '$W/cd/image.tar.bz2' -C '$W/image' .", $build, true, null, $env); + // TODO port the rest of /usr/lib/catalyst/targets/support/create-iso.sh to support other bootloaders // ISOLINUX bootloader // mkisofs -J -R -l ${mkisofs_zisofs_opts} -V "${clst_iso_volume_id}" -o ${1} -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${clst_target_path} sql_task::execute_command('Create ISO image', "mkisofs -J -R -l -V 'Ingenue Build $build->id' -o '$W/image.iso' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table '$W/cd'", $build, true, null, $env); rename("$W/image.iso", COMPLETED.'/build-'.$build->id.'.iso') || throw_exception('rename failed'); + } else { + throw_exception('invalid image type: '.$imgtype); } if (!$conf['debug']) { sql_task::execute_command('Delete work directory', 'rm -rf "'.$W.'"', $build, true, null, $env); diff --git a/backend/functions/signals.php b/backend/functions/signals.php index bb3d44d..effea2f 100644 --- a/backend/functions/signals.php +++ b/backend/functions/signals.php @@ -8,14 +8,14 @@ function handle_signal($sig=null) { $task->finish=time(); $task->exit=-$sig; $task->write(); - debug('task '.$task->id.' given exit status '.-$sig); + debug("build $build->id task $task->order given exit status -$sig"); } else { debug('$task not set'); } $build->finish=time(); $build->status='finished/failed: got signal '.$sig; $build->write(); - debug('build '.$build->id.' given status '.$build->status); + debug("build $build->id given status $build->status"); } debug("\nGot signal $sig - exiting"); exit; |