Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (e49c8eed301bd526f9f4649770a9e4e51a4fcc4c)

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 master cauldron by Justin Boffemmyer (e49c8eed301bd526f9f4649770a9e4e51a4fcc4c)
  • Date: Fri, 5 Jun 2009 00:06:21 -0500

GIT changes to master cauldron by Justin Boffemmyer <flux AT sourcemage.org>:

libcauldron | 47 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 36 insertions(+), 11 deletions(-)

New commits:
commit e49c8eed301bd526f9f4649770a9e4e51a4fcc4c
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

libcauldron: implement some better error handling

Make better use of liberror (now that it's more properly implemented)
and also put in more checks for error conditions.

diff --git a/libcauldron b/libcauldron
index 3d0551e..39a2c2e 100755
--- a/libcauldron
+++ b/libcauldron
@@ -18,15 +18,38 @@

#-------------------------------------------------------------------------------
# Cauldron includes

#-------------------------------------------------------------------------------
-. ${CAULDRON_LIBS}/libinit
-. ${CAULDRON_LIBS}/liberror
+. ${CAULDRON_LIBS}/libinit ||
+ cauldron_fatal_error "error: cannot load cauldron libraries!"
+. ${CAULDRON_LIBS}/liberror ||
+ cauldron_fatal_error "error: cannot load cauldron libraries!"


#-------------------------------------------------------------------------------
# Sorcery includes

#-------------------------------------------------------------------------------
# Needed for modifying config files
-. ${SORCERY_LIBS}/libstate
-. ${SORCERY_LIBS}/libtrack
+if [[ -e "${SORCERY_LIBS}"/libstate ]]
+then
+ . "${SORCERY_LIBS}"/libstate
+else
+ CAULDRON_HOSTSORCERY=0
+fi
+if [[ -e "${SORCERY_LIBS}"/libtrack ]]
+then
+ . "${SORCERY_LIBS}"/libtrack
+else
+ CAULDRON_HOSTSORCERY=0
+fi
+
+#-------------------------------------------------------------------------------
+##
+## Used only when checking initialization of the library and a fatal error
+## occurs. Afterwards, functions from liberror should be used instead.
+##
+#-------------------------------------------------------------------------------
+function cauldron_fatal_error() {
+ echo $1
+ exit $CERR_FATAL
+}


#-------------------------------------------------------------------------------
##
@@ -37,9 +60,11 @@
function cauldron_source_sorcery() {
local target=$1

- source "$target/etc/sorcery/config"
- [[ -e "$target/etc/sorcery/local/config" ]] &&
- source "$target/etc/sorcery/local/config"
+ source "$target/etc/sorcery/config" || return $CERR_TARGETSORCERY
+ if [[ -e "$target/etc/sorcery/local/config" ]]
+ then
+ source "$target/etc/sorcery/local/config"
+ fi || return $CERR_TARGETSORCERY
}


#-------------------------------------------------------------------------------
@@ -52,10 +77,10 @@ function cauldron_chroot_init() {

if [[ "$CAULDRON_CHROOTINIT" -ne 1 ]]
then
- mount --bind "$HOSTPATH"/dev "$TARGET"/dev
- mount --bind "$HOSTPATH"/dev/pts "$TARGET"/dev/pts
- mount --bind "$HOSTPATH"/proc "$TARGET"/proc
- cauldron_source_sorcery "$TARGET"
+ mount --bind "$HOSTPATH"/dev "$TARGET"/dev || ret=$CERR_CHROOTINIT
+ mount --bind "$HOSTPATH"/dev/pts "$TARGET"/dev/pts ||
ret=$CERR_CHROOTINIT
+ mount --bind "$HOSTPATH"/proc "$TARGET"/proc || ret=$CERR_CHROOTINIT
+ cauldron_source_sorcery "$TARGET" || return $CERR_TARGETSORCERY
export CAULDRON_CHROOTINIT=1
export CAULDRON_CHROOT="chroot \"$TARGET\""
fi



  • [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (e49c8eed301bd526f9f4649770a9e4e51a4fcc4c), Justin Boffemmyer, 06/05/2009

Archive powered by MHonArc 2.6.24.

Top of Page