Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (519fba4ba57b55bc91fd03d4e8fc8feb40854b37)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Justin Boffemmyer <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (519fba4ba57b55bc91fd03d4e8fc8feb40854b37)
  • Date: Wed, 16 Jan 2008 22:10:39 -0600

GIT changes to devel-flux cauldron by Justin Boffemmyer
<flux AT shaolin.homelinux.org>:

src/cauldron | 136 ------------------------
src/etc/cauldron/config | 11 +-
src/installers/common | 29 ++++-
src/libcauldron | 264
++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 304 insertions(+), 136 deletions(-)

New commits:
commit 519fba4ba57b55bc91fd03d4e8fc8feb40854b37
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>

Added comments and install step functions

Added comments for the purposes of using bashdoc. I also added two new
functions, cauldron_install_currstep and cauldron_install_nextstep,
though neither are implemented yet. I intended to mirror Karsten's
current and next step code in his bashrc implementation, but I may
drop these for a more elaborate depends implementation.

commit f6dc63dc9b3d4b9d0ec125136b909473549eb3e0
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>

Added several variables for use in libcauldron

I added some variables that were used in libcauldron, but not actually
implemented/defined anywhere. Also, I have some ugly hacks here for
reading from the HOST sorcery config file. This config file is meant
to be like /etc/sorcery/config, and will be used to seed a
/etc/cauldron/local/config, so hopefully these hacks (ugly as they
are) won't be too terrible (until I possibly source sorcery as a whole
eventually).

commit 56e43ff9697e02fe791f5e896e7965787d614176
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>

Removed lib code; sourced library; config function

All code meant for libcauldron was removed from cauldron itself. A
line to source the library was added. I also put in the prototype for
a function that will write to the cauldron config file (no code
implemented yet though)

commit 4c946bedf3a56553aa60bb7b0b07b5a63e0b2113
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>

Separation from cauldron into libcauldron

Created a new library file instead of cramming everything into the
cauldron executable itself. While I was at it I added a lot of
comments for the purposes of bashdoc.

diff --git a/src/cauldron b/src/cauldron
old mode 100644
new mode 100755
index fdcaabd..36cd66b
--- a/src/cauldron
+++ b/src/cauldron
@@ -16,7 +16,7 @@
##
##=head1 COPYRIGHT
##
-## Copyright 2007 The Cauldron Team
+## Copyright 2007 by the Cauldron Team
##
##=head1 FUNCTIONS
##
@@ -36,137 +36,7 @@ EOF
exit 1
}

-function cauldron_enter_chroot() {
- mount --bind ${HOST}/dev ${CAULDRON_BUILD}/dev
- mount --bind ${HOST}/dev/pts ${CAULDRON_BUILD}/dev/pts
- mount --bind ${HOST}/proc ${CAULDRON_BUILD}/proc
-}
-
-function cauldron_exit_chroot() {
- umount ${CAULDRON_BUILD}/proc
- umount ${CAULDRON_BUILD}/dev/pts
- umount ${CAULDRON_BUILD}/dev
-}
-
-function cauldron_get_host_triple() {
- local HOST_ARCH
- local ARCH_SPEC
- local HOST_TRIPLE
-
- # get the value for the HOST triplet from sorcery archspecs
- HOST_ARCH=$(grep "ARCHITECTURE=" ${HOST_SORCERY_CONFIG} | cut -d = -f 2)
- ARCH_SPEC=$(find ${} -name ${HOST_ARCH})
- HOST_TRIPLE=$(grep "HOST=" ${ARCH_SPEC} | cut -d = -f 2)
-
- return ${HOST_TRIPLE}
-}
-
-function cauldron_create_base_toolchain() {
- local SPELL
- local VERSION
- local SPELL_CACHE
- local HOST_TRIPLE
- local CACHE_EXTENSION
-
- # set the value for HOST_TRIPLE
- cauldron_get_host_triple
- HOST_TRIPLE="$?"
- CACHE_EXTENSION=$(grep "EXTENSION=" $HOST_SORCERY_CONFIG | \
- cut -d = -f 2)
-
- # grab the list of spells needed as the base tool-chain which will be
- # used to create the cross-compile tool-chain
- for SPELL in ${HOST_TOOLCHAIN}
- do
- # grab the version for the spell from sorcery's state info
- # on what's installed
- VERSION=$(grep "^${SPELL}" ${HOST_PACKAGES} | cut -d : -f 4)
-
- # set SPELL_CACHE as shorthand for SPELL-VERSION-HOST_TRIPLE.tar.bz2
- SPELL_CACHE="${SPELL}-${VERSION}-${HOST_TRIPLE}.tar${CACHE_EXTENSION}"
-
- # check to see if there is already a cache file from sorcery
- # this check could be based on spell-{names,versions} reported by
- # gaze/sorcery/dispel. Mirroring code in dispel might be the best bet,
- # since that has to find the version currently installed anyway.
- if [[ -f ${HOST_SORCERY_SPOOL}/${SPELL_CACHE} ]]
- then
- # found a cache file, copy it to the BUILD dir
- cp ${HOST_SORCERY_SPOOL}/${SPELL_CACHE} ${CAULDRON_BUILD}
- else
- # couldn't find a cache file, so we'll need to build one
- cauldron_build_cache_file ${SPELL}
- fi
- done
-
- # unpack the cache file, effectively installing
- # the spell into the BUILD dir
- # the unpacking is done against the BUILD dir as the root dir, so
- # this should not touch the HOST filesystem at all
- tar xjf ${CAULDRON_BUILD}/${SPELL_CACHE} -C ${CAULDRON_BUILD}/
-}
-
-function cauldron_configure_toolchain() {
-}
-
-function cauldron_create_target_toolchain() {
- # set sorcery options, etc. for cross-compile
- cauldron_configure_toolchain
-
- # do a sorcery rebuild inside the BUILD dir to
- # generate the cross-compile tool-chain
- chroot ${CAULDRON_BUILD} "/usr/sbin/sorcery rebuild"
-}
-
-function cauldron_build_iso_system() {
-}
-
-function cauldron_iso_init() {
-}
-
-function cauldron_add_installer() {
-}
-
-function cauldron_clean_iso_system() {
-}
-
-function cauldron_mkisofs() {
- mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
- -boot-load-size 4 -boot-info-table -o ${SMGL_ISO} ${CAULDRON_BUILD}
-}
-
-function cauldron_build_iso() {
- # set up basic tool-chain in order to cross-compile for target later
- cauldron_create_toolchain
-
- # TODO find a better way to copy resolv.conf, since it may be a symlink
- # copy the host's resolv.conf in order to dl packages from net
- cp /etc/resolv.conf ${CAULDRON_BUILD}/
-
- # set up chroot for building inside $CAULDRON_BUILD
- cauldron_enter_chroot
-
- # build the cross-compile tool-chain targeted for the target sys
- cauldron_create_target_toolchain
-
- # use the cross-compile tool-chain to cast all spells needed for
- # the iso system
- cauldron_build_iso_system
-
- # configure the iso init system, initrd/initramfs, etc.
- cauldron_iso_init
-
- # build/create/copy/whatever installer system/data into the iso
- cauldron_add_installer
-
- # remove unnecessary files from iso and free up space
- cauldron_clean_iso_system
-
- # finished with iso building, clean up from chroot setup
- cauldron_exit_chroot
-
- # create the iso fs from the build dir
- cauldron_mkisofs
+function cauldron_modify_local_config() {
}

function cauldron_menu_main() {
@@ -224,6 +94,8 @@ function cauldron_main() {
}

. /etc/cauldron/config
+. /var/lib/cauldron/libcauldron
+
if [[ $UID == 0 ]]
then
DIALOG='$DIALOG_PROG \
diff --git a/src/etc/cauldron/config b/src/etc/cauldron/config
index 1a0f37a..8a9a45c 100644
--- a/src/etc/cauldron/config
+++ b/src/etc/cauldron/config
@@ -1,7 +1,16 @@
+ SORCERY_CONFIG=/etc/sorcery/config
+ HOST_SORCERY_CONFIG=/etc/sorcery/local/config
HOST_PACKAGES=/var/state/sorcery/packages
HOST_SORCERY_SPOOL=/var/spool/sorcery
- HOST_ARCH_PATH=/var/lib/sorcery/archspecs
+ HOST_ARCH_PATH=$(grep "ARCH_SPEC=" ${SORCERY_CONFIG} | \
+ cut -d = -f 2)
+ HOST_ARCH=$(grep "ARCHITECTURE=" ${HOST_SORCERY_CONFIG} | \
+ cut -d = -f 2)
+ CACHE_EXTENSION=$(grep "EXTENSION=" ${HOST_SORCERY_CONFIG} | \
+ cut -d = -f 2)

+ CAULDRON_CAST_SPELL="/usr/sbin/cast"
+ CAULDRON_REBUILD="/usr/sbin/sorcery rebuild"
CAULDRON_BUILD=
SMGL_ISO=
HOST_TOOLCHAIN=
diff --git a/src/installers/common b/src/installers/common
old mode 100644
new mode 100755
index 21eb2b5..f7b4a8e
--- a/src/installers/common
+++ b/src/installers/common
@@ -24,13 +24,36 @@
##
#---------------------------------------------------------------------

+#---------------------------------------------------------------------
+##
+## Copies the kernel and it's associated modules from the ISO to the TARGET
+## system. Requires that / and /boot on the TARGET system are mounted.
+##
+#---------------------------------------------------------------------
function cauldron_install_copy_kernel() {
- cp ${ISO}/boot/linux ${TARGET_SYSTEM};
- cp --parents -r ${ISO}/lib/modules/${LINUX_VER}/* ${TARGET_SYSTEM};
- depmod -a -b ${TARGET_SYSTEM}/lib/modules/${LINUX_VER} ${LINUX_VER};
+ cp ${ISO}/boot/linux ${TARGET_SYSTEM}/boot/;
+ cp --parents -r ${ISO}/lib/modules/${LINUX_VER}/* ${TARGET_SYSTEM};
+ depmod -a -b ${TARGET_SYSTEM}/lib/modules/${LINUX_VER} ${LINUX_VER};
}

#---------------------------------------------------------------------
+##
+## Determines and returns the current step in the installation procedure
+##
+#---------------------------------------------------------------------
+function cauldron_install_currstep() {
+}
+
+#---------------------------------------------------------------------
+##
+## Determines and returns the next step in the installation procedure
+##
+#---------------------------------------------------------------------
+function cauldron_install_nextstep() {
+}
+
+
+#---------------------------------------------------------------------
##=back
##
##=head1 LICENSE
diff --git a/src/libcauldron b/src/libcauldron
new file mode 100755
index 0000000..cea8d59
--- /dev/null
+++ b/src/libcauldron
@@ -0,0 +1,264 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 SYNOPSIS
+##
+## libcauldron is a set of functions used internally by the cauldron script
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2007 by the Cauldron Team
+##
+##=head1 FUNCTIONS
+##
+##=over 4
+##
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+##
+## Prepares a chroot environment
+##
+#---------------------------------------------------------------------
+function cauldron_enter_chroot() {
+ mount --bind ${HOST}/dev ${CAULDRON_BUILD}/dev
+ mount --bind ${HOST}/dev/pts ${CAULDRON_BUILD}/dev/pts
+ mount --bind ${HOST}/proc ${CAULDRON_BUILD}/proc
+}
+
+#---------------------------------------------------------------------
+##
+## Cleans up the chroot environment after it is no longer needed
+##
+#---------------------------------------------------------------------
+function cauldron_exit_chroot() {
+ umount ${CAULDRON_BUILD}/proc
+ umount ${CAULDRON_BUILD}/dev/pts
+ umount ${CAULDRON_BUILD}/dev
+}
+
+#---------------------------------------------------------------------
+##
+## Scans the sorcery archspec files to find the host triplet
+## This will be used to set the value of HOST in /etc/cauldron/config
+##
+#---------------------------------------------------------------------
+function cauldron_get_host_triple() {
+ local HOST_ARCH
+ local ARCH_SPEC
+ local HOST_TRIPLE
+ local SPEC_FILE
+
+ # get the value for the HOST triplet from sorcery archspecs
+ for spec in ${HOST_ARCH_PATH[@]}
+ do
+ if [[ $(find --version|grep -q 'version 4\.1\(\.\|$\)') == 1 ]]
+ then
+ ARCH_SPEC=$(find ${spec} -perm 400 -type f -name ${HOST_ARCH} \
+ -print 2>/dev/null)
+ else
+ ARCH_SPEC=$(find -L ${spec} -perm 400 -type f -name ${HOST_ARCH} \
+ -print 2>/dev/null)
+ fi
+ [[ ARCH_SPEC ]] && break
+ done
+ HOST_TRIPLE=$(grep "HOST=" ${ARCH_SPEC} | cut -d = -f 2)
+
+ echo ${HOST_TRIPLE}
+}
+
+#---------------------------------------------------------------------
+##
+## Generates the base toolchain using the HOST information. This is
+## done by unpacking the cache file for each spell required for the
+## toolchain if it exists. If it does not exist, this may be because
+## caching is disabled on the host machine, or perhaps the cache file
+## was deleted by accident. Otherwise the spell must be cast within
+## a chroot environment in the CAULDRON_BUILD directory.
+##
+#---------------------------------------------------------------------
+function cauldron_create_base_toolchain() {
+ local SPELL
+ local VERSION
+ local SPELL_CACHE
+ local HOST_TRIPLE
+ local CACHE_EXTENSION
+
+ # set the value for HOST_TRIPLE
+ HOST_TRIPLE=$(cauldron_get_host_triple)
+
+ # grab the list of spells needed as the base tool-chain which will be
+ # used to create the cross-compile tool-chain
+ for SPELL in ${HOST_TOOLCHAIN}
+ do
+ # grab the version for the spell from sorcery's state info
+ # on what's installed
+ VERSION=$(grep "^${SPELL}" ${HOST_PACKAGES} | cut -d : -f 4)
+
+ if [[ ${VERSION} ]]
+ then
+ # set SPELL_CACHE as shorthand for SPELL-VERSION-HOST_TRIPLE.tar.bz2
+ SPELL_CACHE="${SPELL}-${VERSION}-${HOST_TRIPLE}.tar${CACHE_EXTENSION}"
+
+ # check to see if there is already a cache file from sorcery
+ # this check could be based on spell-{names,versions} reported by
+ # gaze/sorcery/dispel. Mirroring code in dispel might be the best bet,
+ # since that has to find the version currently installed anyway.
+ if [[ -f ${HOST_SORCERY_SPOOL}/${SPELL_CACHE} ]]
+ then
+ # found a cache file, copy it to the BUILD dir
+ cp ${HOST_SORCERY_SPOOL}/${SPELL_CACHE} ${CAULDRON_BUILD}
+ else
+ # couldn't find a cache file, so we'll need to build one
+ cauldron_build_cache_file ${SPELL}
+ fi
+ # unpack the cache file, effectively installing
+ # the spell into the BUILD dir
+ # the unpacking is done against the BUILD dir as the root dir, so
+ # this should not touch the HOST filesystem at all
+ tar xjf ${CAULDRON_BUILD}/${SPELL_CACHE} -C ${CAULDRON_BUILD}/
+ # the spell is not present on the HOST system, so it must be cast inside
+ # a chroot
+ else
+ cauldron_enter_chroot
+ chroot ${CAULDRON_BUILD} ${CAULDRON_CAST_SPELL} ${SPELL}
+ cauldron_exit_chroot
+ fi
+ done
+}
+
+#---------------------------------------------------------------------
+## @param XXX
+##
+## Configures the toolchain for building on the TARGET system. In other
+## words, this sets the options/variables necessary to build a
+## cross-compiler system to generate binaries for the target system.
+##
+#---------------------------------------------------------------------
+function cauldron_configure_toolchain() {
+}
+
+#---------------------------------------------------------------------
+## @param XXX
+##
+## This builds the cross-compiler to produce the TARGET binaries.
+##
+#---------------------------------------------------------------------
+function cauldron_create_target_toolchain() {
+ # set sorcery options, etc. for cross-compile
+ cauldron_configure_toolchain
+
+ # do a sorcery rebuild inside the BUILD dir to
+ # generate the cross-compile tool-chain
+ chroot ${CAULDRON_BUILD} ${CAULDRON_REBUILD}
+}
+
+#---------------------------------------------------------------------
+## @param XXX
+##
+## Generates the installation system that will be copied from the ISO to the
+## target system as a tarball
+##
+#---------------------------------------------------------------------
+function cauldron_build_iso_system() {
+}
+
+#---------------------------------------------------------------------
+## @param XXX
+##
+## Handles setting up the init process on the ISO. The ISO init is
+## responsible for detecting hardware, loading device drivers, setting
+## console fonts, etc.
+##
+#---------------------------------------------------------------------
+function cauldron_iso_init() {
+}
+
+#---------------------------------------------------------------------
+## @param INSTALLER_MODULE - one of shell or menu (future: X?)
+##
+## Adds the given installer to the ISO system. The user can then choose this
+## installer either at boot-time or run-time, depending on the installer
+##
+#---------------------------------------------------------------------
+function cauldron_add_installer() {
+}
+
+#---------------------------------------------------------------------
+##
+## Cleans out unneeded files that were used to generate the ISO, but should
+## not be present on the final ISO system
+##
+#---------------------------------------------------------------------
+function cauldron_clean_iso_system() {
+}
+
+#---------------------------------------------------------------------
+##
+## Builds the ISO filesystem using the generated ISO data and the filename
+## set in the cauldron config file.
+##
+#---------------------------------------------------------------------
+function cauldron_mkisofs() {
+ mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
+ -boot-load-size 4 -boot-info-table -o ${SMGL_ISO} ${CAULDRON_BUILD}
+}
+
+#---------------------------------------------------------------------
+##
+## Wrapper function that calls all the functions necessary to generate the
+## final ISO file in the correct order
+##
+#---------------------------------------------------------------------
+function cauldron_build_iso() {
+ # set up basic tool-chain in order to cross-compile for target later
+ cauldron_create_toolchain
+
+ # copy the host's resolv.conf in order to dl packages from net
+ cp -L /etc/resolv.conf ${CAULDRON_BUILD}/
+
+ # set up chroot for building inside $CAULDRON_BUILD
+ cauldron_enter_chroot
+
+ # build the cross-compile tool-chain targeted for the target sys
+ cauldron_create_target_toolchain
+
+ # use the cross-compile tool-chain to cast all spells needed for
+ # the iso system
+ cauldron_build_iso_system
+
+ # configure the iso init system, initrd/initramfs, etc.
+ cauldron_iso_init
+
+ # build/create/copy/whatever installer system/data into the iso
+ cauldron_add_installer
+
+ # remove unnecessary files from iso and free up space
+ cauldron_clean_iso_system
+
+ # finished with iso building, clean up from chroot setup
+ cauldron_exit_chroot
+
+ # create the iso fs from the build dir
+ cauldron_mkisofs
+}
+
+#---------------------------------------------------------------------
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
+
+# vim:ai:tw=80:tabstop=2:softtabstop=2:shiftwidth=2:expandtab




Archive powered by MHonArc 2.6.24.

Top of Page