sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (1097eb5eb63b11b67a2f2f9f6c2e6ea89a13bed7)
- 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 (1097eb5eb63b11b67a2f2f9f6c2e6ea89a13bed7)
- Date: Sun, 2 Dec 2007 18:18:30 -0600
GIT changes to devel-flux cauldron by Justin Boffemmyer
<flux AT shaolin.homelinux.org>:
src/cauldron | 347
++++++++++++++++++++++++++++--------------------
src/etc/cauldron/config | 8 +
src/installers/common | 5
3 files changed, 214 insertions(+), 146 deletions(-)
New commits:
commit 1097eb5eb63b11b67a2f2f9f6c2e6ea89a13bed7
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Improved method for generating base tool-chain
The method for searching for isntalled cache files has received a
large overhaul, with borrowings from sorcery itself. The host triplet
is gathered from the sorcery archspec files corresponding to the value
of $ARCHITECTURE defined in /etc/local/sorcery/config. The version of
the spell to grab the cache tarball for is taken from the version
which is currently installed, by grabbing the last field in
/var/state/sorcery/packages. A function for generating a cache tarball
when one doesn't exist on the host for the corresponding spell still
needs to be implemented though.
commit 1065e0289ea8fa5c998a8d5ce61c1b611581de95
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Beginning of config file for cauldron
This config file only has some of the configs for cauldron. This will
continue to be fleshed out later. For now it contains the variables
explicitly referenced in the cauldron shell script (which is also
still in development)
commit a0df9bf9ae3151a74ed6488cc5809e659ed21099
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>
forgot a "function" keyword in installers/common
Forgot to include the "function" keyword for a function in
installers/common.
commit ff59d867337c547d1679a5db37de6ce121c8b610
Author: Justin Boffemmyer <flux AT shaolin.homelinux.org>
Commit: Justin Boffemmyer <flux AT shaolin.homelinux.org>
cauldron and installers/common fixes and formatting
Incorporated various fixes to proactively squash bugs (as well as to
flesh out
the implementations) of both cauldron and installers/common. Additionally,
cleaned up the formatting of both files to use 2 spaces for indentations
instead of tabs, and used the "function" keyword to define functions more
explicitly.
diff --git a/src/cauldron b/src/cauldron
index 59fd64d..adf3dec 100644
--- a/src/cauldron
+++ b/src/cauldron
@@ -24,7 +24,7 @@
##
#---------------------------------------------------------------------
-help() {
+function help() {
cat << EOF
@@ -36,155 +36,214 @@ EOF
exit 1
}
-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
-}
-
-cauldron_exit_chroot() {
- umount ${CAULDRON_BUILD}/dev
- umount ${CAULDRON_BUILD}/dev/pts
- umount ${CAULDRON_BUILD}/proc
-}
-
-cauldron_create_base_toolchain() {
- for spell in ${HOST_TOOLCHAIN}
- do
- if [[ -f
${HOST_SORCERY_SPOOL}/${spell}-*-${HOST_ARCH}-${HOST_SYSTEM}-linux-gnu.tar.bz2
]]
- then
- cp
${HOST_SORCERY_SPOOL}/${spell}-*-${HOST_ARCH}-${HOST_SYSTEM}-linux-gnu.tar.bz2
- else
- cauldron_build_cache_file ${spell}
- fi
- done
- tar xjf ${spell}-*-${HOST_ARCH}.tar.bz2 -C ${CAULDRON_BUILD}/
-}
-
-cauldron_create_target_toolchain() {
- cauldron_configure_toolchain
- chroot sorcery rebuild
-}
-
-cauldron_build_iso_system() {
-}
-
-cauldron_iso_init() {
-}
-
-cauldron_add_installer() {
-}
-
-cauldron_clean_iso_system() {
-}
-
-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}
-}
-
-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 /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
-}
-
-cauldron_menu_main() {
- local CAULDRON_B_HELP="Build directory location"
- local CAULDRON_OK="Select"
- local CAULDRON_CANCEL="Exit"
-
- while
- CAULDRON_COMMAND=$(eval ${DIALOG} ' --title "Main Menu"
\
- --item-help
\
- --ok-label "${CAULDRON_OK}"
\
- --cancel-label "${CAULDRON_CANCEL}"
\
- --menu
\
- "Cauldron Version ${CAULDRON_VERSION}"
\
- 0 0 0
\
- "B" "Build Menu" "${CAULDRON_B_HELP}"'
)
- do
- case ${CAULDRON_COMMAND} in
- B) cauldron_menu_build;;
- esac
- done
-}
-
-cauldron_menu_build() {
- local CAULDRON_OK="Commit"
- local CAULDRON_CANCEL="Cancel"
-
- if CAULDRON_BUILD=$(eval ${DIALOG} ' --ok-label ${CAULDRON_OK}
\
- --cancel-label ${CAULDRON_CANCEL}
\
- --input-menu
\
- "Enter the path to the dir where
\
- Cauldron should build your ISOs."
\
- 0 0
\
- ${CAULDRON_BUILD}'
)
- then
- cauldron_modify_local_config "CAULDRON_BUILD"
"${CAULDRON_BUILD}"
- fi
-}
-
-cauldron_main() {
- if [[ -z $1 ]]
- then
- cauldron_menu_main
- else
- case $1 in
- -h|--help|help) help ;;
- *) help ;;
- esac
- fi
+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
+
+ # set the value for HOST_TRIPLE
+ cauldron_get_host_triple
+ 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)
+
+ # set SPELL_CACHE as shorthand for SPELL-VERSION-HOST_TRIPLE.tar.bz2
+ SPELL_CACHE="${SPELL}-${VERSION}-${HOST_TRIPLE}.tar.bz2"
+
+ # 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_menu_main() {
+ local CAULDRON_B_HELP="Build directory location"
+ local CAULDRON_OK="Select"
+ local CAULDRON_CANCEL="Exit"
+
+ while
+ CAULDRON_COMMAND=$(eval ${DIALOG} ' --title "Main Menu" \
+ --item-help \
+ --ok-label \
+ "${CAULDRON_OK}" \
+ --cancel-label \
+ "${CAULDRON_CANCEL}" \
+ --menu \
+ "Cauldron Version \
+ ${CAULDRON_VERSION}" \
+ 0 0 0 \
+ "B" "Build Menu" \
+ "${CAULDRON_B_HELP}"' )
+ do
+ case ${CAULDRON_COMMAND} in
+ B) cauldron_menu_build;;
+ esac
+ done
+}
+
+function cauldron_menu_build() {
+ local CAULDRON_OK="Commit"
+ local CAULDRON_CANCEL="Cancel"
+
+ if CAULDRON_BUILD=$(eval ${DIALOG} ' --ok-label \
+ ${CAULDRON_OK} \
+ --cancel-label ${CAULDRON_CANCEL} \
+ --input-menu \
+ "Enter the path to the dir where \
+ Cauldron should build your ISOs." \
+ 0 0 \
+ ${CAULDRON_BUILD}' )
+ then
+ cauldron_modify_local_config "CAULDRON_BUILD" "${CAULDRON_BUILD}"
+ fi
+}
+
+function cauldron_main() {
+ if [[ -z $1 ]]
+ then
+ cauldron_menu_main
+ else
+ case $1 in
+ -h|--help|help) help ;;
+ *) help ;;
+ esac
+ fi
}
. /etc/cauldron/config
if [[ $UID == 0 ]]
then
- DIALOG='$DIALOG_PROG --backtitle "Cauldron ISO builder and installer
management utility" --stdout'
+ DIALOG='$DIALOG_PROG \
+ --backtitle \
+ "Cauldron ISO builder and installer management utility" \
+ --stdout'
- CAULDRON_VERSION=$(cat /etc/cauldron/version)
- cauldron_main "$@"
- CAULDRON_STATUS=$?
- exit ${CAULDRON_STATUS}
+ CAULDRON_VERSION=$(cat /etc/cauldron/version)
+ cauldron_main "$@"
+ CAULDRON_STATUS="$?"
+ exit ${CAULDRON_STATUS}
else
- if [[ $1 == -h ]] || [[ $1 == --help ]] || [[ $1 == help ]]
- then
- cauldron_help
- elif [[ $1 == -v ]] || [[ $1 == --version ]] || [[ $1 == version ]]
- then
- echo $(cat /etc/cauldron/version)
- else
- echo "Please enter the root password."
- CAULDRON_PARAMS=$@
- su -c "$0 ${CAULDRON_PARAMS}" root
- fi
+ if [[ $1 == -h ]] || [[ $1 == --help ]] || [[ $1 == help ]]
+ then
+ cauldron_help
+ elif [[ $1 == -v ]] || [[ $1 == --version ]] || [[ $1 == version ]]
+ then
+ echo $(cat /etc/cauldron/version)
+ else
+ echo "Please enter the root password."
+ CAULDRON_PARAMS=$@
+ su -c "$0 ${CAULDRON_PARAMS}" root
+ fi
fi
#---------------------------------------------------------------------
@@ -207,3 +266,5 @@ fi
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
#---------------------------------------------------------------------
+
+# vim:ai:tw=80:tabstop=2:softtabstop=2:shiftwidth=2:expandtab
diff --git a/src/etc/cauldron/config b/src/etc/cauldron/config
new file mode 100644
index 0000000..1a0f37a
--- /dev/null
+++ b/src/etc/cauldron/config
@@ -0,0 +1,8 @@
+ HOST_PACKAGES=/var/state/sorcery/packages
+ HOST_SORCERY_SPOOL=/var/spool/sorcery
+ HOST_ARCH_PATH=/var/lib/sorcery/archspecs
+
+ CAULDRON_BUILD=
+ SMGL_ISO=
+ HOST_TOOLCHAIN=
+ HOST=
diff --git a/src/installers/common b/src/installers/common
index f6a399b..12be289 100644
--- a/src/installers/common
+++ b/src/installers/common
@@ -24,11 +24,10 @@
##
#---------------------------------------------------------------------
-cauldron_install_copy_kernel() {
+function cauldron_install_copy_kernel() {
cp ${ISO}/boot/linux ${TARGET_SYSTEM};
cp --parents -r ${ISO}/lib/modules/${LINUX_VER}/* ${TARGET_SYSTEM};
- cauldron_enter_chroot(${TARGET_SYSTEM});
- depmod -a ${LINUX_VER};
+ depmod -a -b ${ISO}/lib/modules/${LINUX_VER} ${LINUX_VER};
}
#---------------------------------------------------------------------
- [SM-Commit] GIT changes to devel-flux cauldron by Justin Boffemmyer (1097eb5eb63b11b67a2f2f9f6c2e6ea89a13bed7), Justin Boffemmyer, 12/02/2007
Archive powered by MHonArc 2.6.24.