Skip to Content.
Sympa Menu

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

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 (947f64f7b763a1fd3a706e2bf6dcdd1556796770)
  • Date: Tue, 16 Mar 2010 01:04:57 -0500

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

API | 30 +++++++
HACKING | 16 ++++
cauldron/cauldron | 2
cauldron/errorcodes | 42 ++++++++++-
cauldron/etc/config | 146 +++++++++++++++++++++-----------------
cauldron/lib.chroot | 9 +-
cauldron/lib.hostcache | 44 ++++++-----
cauldron/lib.init | 76 ++++++++++----------
cauldron/lib.sorcerous | 40 +++++-----
cauldron/libcauldron | 170
+++++++++++++++++++++++++++++----------------
delint/global_variables | 56 ++++++++++++++
enchantment/lib.potion | 8 +-
enchantment/libenchantment | 17 ++--
lib/liberror | 8 +-
14 files changed, 438 insertions(+), 226 deletions(-)

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

enchantment: variable cleanup

Ensured that variable names are in compliance with the API specification
as well as making sure all global variables used in the libraries were
defined in etc/config (or elsewhere for the few that don't get
configured by the user). Mismatches were found using the
global_variables delinter.

commit c44b9d2de1c7e88b5e4a146580c9c41b652ea040
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

cauldron: HUGE variable cleanup

Renamed quite a few variables to make them more consistent as well as
for compliance with the API specification. Added many new definitions of
variables that were already being used in the libraries. Ensured that
all variables matched with etc/config and all return codes matched with
errorcodes, using the new global_variables delinter script.

commit 54da66faa59b9578784d869c404a083eb8c3bf2e
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

liberror: don't unconditionally rely on libcolor

Don't force usage of libcolor (using the variables is fine because if
libcolor isn't loaded they won't harm anything). Also fixed a few typos.

commit 2fba6a41828a3c64ed104a112a3057fbb6ed7819
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

delint: new delinting script global_variables

We now have a script for detecting all global variables that are used in
given files and testing to see if they were defined in a given
definitions file (etc/config, errorcodes). This will help to ensure that
all global variables are properly defined before we get to run-time
testing, which will cut down on the time needed for debugging.

commit e36d65fe247234ceb7e28b7554ea06e1c0e741ed
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

API: clarify the API, especially naming rules

Made the API specification much more explicit, and included a clause on
how the API can be amended/updated. Naming rules are now given
explicitly both as descriptive text as well as example regular
expressions. Acceptable locations of different types of variables are
also explicitly mentioned.

commit 9f39c139fb2377624e0185b9793c0f60821b40f2
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

cauldron: clean up quoting, error, and var usage

Cleaned up variable usage to ensure proper quoting. Added a few error
returns that were missing in the code. Also fixed wrongful usage of some
variables.

commit 3b51b375d7716279d49fe3893205b508b57f541f
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

remove '||' before liberror_check_fatal_error

liberror_check_fatal_error always checks the return code from the
previous call before it does anything, and it only calls liberror_die if
the previous return code was greater than 0. Therefore, the '||' after
the command preceding the call to liberror_check_fatal_error was
unnecessary, and it's better practice to just call liberror
unconditionally.

diff --git a/API b/API
index 0af48c8..61d13df 100644
--- a/API
+++ b/API
@@ -22,10 +22,34 @@ API because I consider the OpenGL API to be an excellent
example of a clean and
efficient API. Familiarity with the OpenGL API is however not required to
code
or understand the Cauldron API.

+This API specification may be updated or altered at any time under the
+discretion of Cauldron Lead or by vote of the Cauldron Team. The voting may
be
+informal, until formal voting is required, in which case this statement would
+be amended.
+
In the context of the API, "cauldron" refers to the cauldron suite itself.
Anything pertaining to installers is referred to collectively as
"enchantment"
(the enchantment suite).

+ * Global variables (including those sourced from the config files) are to be
+ in all UPPERCASE, must start with a letter, and can contain only letters,
+ underscores, and trailing numbers
+ - in regexp, [A-Z][A-Z_]*[0-9]*
+ * Global variables should be defined in the relevant config file
+ (etc/cauldron/config for cauldron and etc/enchantment/config for
+ enchantment)
+
+ * Local variables are to be in all lowercase, must begin with a letter, and
+ can contain only letters, underscores, and trailing numbers
+ - in regexp, [a-z][a-z_]*[0-9]*
+ * Local variables should be defined at the top of the function which scopes
+ them, and MUST be defined before being used.
+
+ * Functions are to be in all lowercase, unless there is a very good reason
to
+ uppercase (initial portions must still be lowercased, i.e. initial_LATER
or
+ initial_Later), and any uppercasing needs to be approved
+ - in regexp, [a-z][a-z_]*
+
* All cauldron API functions are to be prefixed with cauldron_
* All cauldron API variables are to be prefixed with CAULDRON_

@@ -41,8 +65,10 @@ Anything pertaining to installers is referred to
collectively as "enchantment"
liberror_.

* Functions which logically group together (i.e., functions that operate
- specifically on modules themselves) should share a common prefix (i.e.,
- enchant_module_enter and enchant_module_exit)
+ specifically on modules themselves) should share a common prefix in
addition
+ to the library prefix (i.e., enchant_module_enter and enchant_module_exit
+ have the common prefix module_)
+ - in regexp terms: libprefix_(commonprefix_)*name

* Functions should be preceded by verbose comments to describe the use of
the
function, formatted for use with bashdoc
diff --git a/HACKING b/HACKING
index 18f08c8..5f4d140 100644
--- a/HACKING
+++ b/HACKING
@@ -288,3 +288,19 @@ overrides what is in etc/cauldron/config.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+delint/
+
+ A collection of scripts for performing quality assurance on the
+Cauldron codebase.
+
+***************************
+* delint/global_variables *
+***************************
+ Performs a static analysis of global variables (the uppercased ones)
in
+files passed on the command line against a "definition" file (typically this
+would either be one of the etc/config files, or one of the errorcodes files).
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
diff --git a/cauldron/cauldron b/cauldron/cauldron
index 71f638a..71ac19e 100755
--- a/cauldron/cauldron
+++ b/cauldron/cauldron
@@ -52,7 +52,7 @@ function cauldron_brew () {
liberror_check_fatal_error

# build the cross-compile tool-chain targeted for the target sys
- if [ "$CAULDRON_ARCH" != "$HOST_ARCH" ]
+ if [ "$CAULDRON_ARCH" != "$CAULDRON_HOST_ARCH" ]
then
cauldron_chroot cauldron_cross_toolchain
liberror_check_fatal_error
diff --git a/cauldron/errorcodes b/cauldron/errorcodes
index 4c8fefb..f7a2d27 100644
--- a/cauldron/errorcodes
+++ b/cauldron/errorcodes
@@ -40,6 +40,25 @@ ERR_RM_CACHE=17 # couldn't remove spell cache
after unpacking in build
ERR_HOST_TRIPLE=18 # couldn't get host triple for builds
ERR_ISO_SORCERY_CONFIG=19 # couldn't create the ISO local sorcery config dir
ERR_INSTALLER_DIR=20 # couldn't create the ISO installer dir
+ERR_BUILD_SPOOL=21 # build directory sorcery spool does not exist
+ERR_DOWNLOAD_SORCERY=22 # could not download sorcery
+ERR_CHROOT_CAST=23 # chroot cast failed
+ERR_CHROOT_DISPEL=24 # chroot dispel failed
+ERR_CHROOT_REBUILD=25 # chroot rebuild failed
+ERR_CLEANUP_BUILD=26 # could not clean up build dir
+ERR_CLEANUP_TMP=27 # could not clean up tmp dir
+ERR_CLEAN_DIR=28 # failed to clean dir from ISO
+ERR_CLEAN_FILE=29 # failed to clean file from ISO
+ERR_COMPRESS_ISO=30 # could not compress final ISO file
+ERR_COPY_INSTALLER=31 # could not copy installer to ISO
+ERR_LINK_INSTALLER=32 # could not link installer programs to ISO
usr/sbin/
+ERR_ENCHANT_CONFIG=33 # could not source enchant config
+ERR_MK_ISOFS=34 # could not create the final ISO file
+ERR_RESOLV=35 # resolv missing in the build dir
+ERR_SORCERY_INSTALL=36 # could not install sorcery into the build dir
+ERR_TOOLCHAIN_STAGE1=37 # cross-toolchain failed at stage 1
+ERR_TOOLCHAIN_STAGE2=38 # cross-toolchain failed at stage 2
+ERR_TOOLCHAIN_STAGE3=39 # cross-toolchain failed at stage 3

# error messages
ERR_MSGS=(
@@ -48,8 +67,8 @@ ERR_MSGS=(
"sorcery not set to archive" # ERR_ARCHIVE
"could not perform chroot command" # ERR_CHROOT
"cleanfile not found" # ERR_CLEANFILE
- "could not load target sorcery" # ERR_TARGETSORCERY
- "could not load host sorcery" # ERR_HOSTSORCERY
+ "could not load target sorcery" # ERR_TARGET_SORCERY
+ "could not load host sorcery" # ERR_HOST_SORCERY
"could not load cauldron library" # ERR_LOAD_LIBRARY
"target chroot dir undefined" # ERR_CHROOT_UNDEF
"could not init chroot" # ERR_CHROOT_INIT
@@ -64,6 +83,25 @@ ERR_MSGS=(
"could not get host triple needed for builds" # ERR_HOST_TRIPLE
"couldn't create the ISO local sorcery config dir" #
ERR_ISO_SORCERY_CONFIG
"couldn't create the installer dir" # ERR_INSTALLER_DIR
+ "build directory sorcery spool does not exist" # ERR_BUILD_SPOOL
+ "could not download sorcery" # ERR_DOWNLOAD_SORCERY
+ "chroot cast failed" # ERR_CHROOT_CAST
+ "chroot dispel failed" # ERR_CHROOT_DISPEL
+ "chroot rebuild failed" # ERR_CHROOT_REBUILD
+ "could not clean up build dir" # ERR_CLEANUP_BUILD
+ "could not clean up tmp dir" # ERR_CLEANUP_TMP
+ "failed to clean dir from ISO" # ERR_CLEAN_DIR
+ "failed to clean file from ISO" # ERR_CLEAN_FILE
+ "could not compress final ISO file" # ERR_COMPRESS_ISO
+ "could not copy installer to ISO" # ERR_COPY_INSTALLER
+ "could not link installer programs to usr/sbin/" # ERR_LINK_INSTALLER
+ "could not source enchant config" # ERR_ENCHANT_CONFIG
+ "could not create the final ISO file" # ERR_MK_ISOFS
+ "resolv missing in the build dir" # ERR_RESOLV
+ "could not install sorcery into the build dir" # ERR_SORCERY_INSTALL
+ "cross-toolchain failed at stage 1" # ERR_TOOLCHAIN_STAGE1
+ "cross-toolchain failed at stage 2" # ERR_TOOLCHAIN_STAGE2
+ "cross-toolchain failed at stage 3" # ERR_TOOLCHAIN_STAGE3
)


#-------------------------------------------------------------------------------
diff --git a/cauldron/etc/config b/cauldron/etc/config
index 474bff2..f9e18ed 100644
--- a/cauldron/etc/config
+++ b/cauldron/etc/config
@@ -1,65 +1,83 @@
-# path to the host system (null for normal use)
- HOST_PATH="${HOST_PATH:-}"
-# path to the ISO system (this should usually be null, unless
-# you are doing some tricky hacking)
- ISO_PATH="${ISO_PATH:-}"
-# path to the base library modules
- CAULDRON_BASE="${CAULDRON_BASE:-$HOST_PATH/var/lib/cauldron}"
-# path to the cauldron library modules
- CAULDRON_LIBS="${CAULDRON_LIBS:-$CAULDRON_BASE/cauldron}"
-# path to the cauldron configs
- CAULDRON_DATA="{$CAULDRON_DATA:-$HOST_PATH/etc/cauldron}"
-# path to where the ISO build chroot is/will go
- CAULDRON_BUILD="${CAULDRON_BUILD:-$HOST_PATH/tmp/cauldron}"
-# temporary files generated while cauldron does its work
- CAULDRON_TMP="${CAULDRON_TMP:-$CAULDRON_BUILD/tmp}"
-# should point to a file listing all the spells needed for the toolchain
-
CAULDRON_TOOLCHAIN="${CAULDRON_TOOLCHAIN:-$CAULDRON_DATA/$CAULDRON_ARCH/toolchain}"
-# should point to a file listing all the spells needed for the ISO runtime
-
CAULDRON_SPELLS="${CAULDRON_SPELLS:-$CAULDRON_DATA/$CAULDRON_ARCH/spells}"
-# should point to a file listing all the spells needed for the ISO runtime
-
CAULDRON_SOURCES="${CAULDRON_SPELLS:-$CAULDRON_DATA/$CAULDRON_ARCH/sources}"
-# should point to a file listing all the spells needed for the ISO runtime
-
CAULDRON_CACHES="${CAULDRON_SPELLS:-$CAULDRON_DATA/$CAULDRON_ARCH/caches}"
-# the arch to generate the ISO for
- CAULDRON_ARCH="${CAULDRON_ARCH:-x86}"
-# what the ISO will be called (should follow the ISO naming conventions)
- SMGL_ISO="${SMGL_ISO:-smgl-devel-$(date
+%Y%m%d).$CAULDRON_ARCH}"
-# the name of the kernel to be used in the ISO
- CAULDRON_KVERS="${CAULDRON_KVERS:-}"
-# contains the arch info for the HOST
- HOST_TRIPLE="${HOST_TRIPLE:-}"
-# whether CAULDRON_BUILD should be rm'ed after cauldron has finished
- CAULDRON_CLEAN="${CAULDRON_CLEAN:-no}"
-# do we keep the uncompressed .iso file in addition to the compressed one?
- CAULDRON_KEEPISO="${CAULDRON_KEEPISO:-yes}"
-# branch of sorcery to use in the ISO
- ISO_SORCERY_BRANCH="${ISO_SORCERY_BRANCH:-stable}"
-# sorcery local config location in the ISO
-
ISO_SORCERY_CONFIG="${ISO_SORCERY_CONFIG:-$CAULDRON_BUILD/etc/sorcer/local/config}"
-
- CAULDRON_SORCERY_PATH="${CAULDRON_SORCERY_PATH:-$HOST_PATH/usr/sbin}"
- CAULDRON_CAST="${CAULDRON_CAST:-$CAULDRON_SORCERY_PATH/cast}"
- CAULDRON_DISPEL="${CAULDRON_DISPEL:-$CAULDRON_SORCERY_PATH/dispel}"
- CAULDRON_REBUILD="${CAULDRON_REBUILD:-$CAULDRON_SORCERY_PATH/sorcery
rebuild}"
-
- CAULDRON_CHROOT_CMD="${CAULDRON_CHROOT_CMD:-chroot}"
-
-# whether to use color for displaying messages
- CAULDRON_COLOR="${CAULDRON_COLOR:-yes}"
-
-
CAULDRON_SORCERY_LIBS="${CAULDRON_SORCERY_LIBS:-$CAULDRON_BUILD/var/lib/sorcery/modules}"
- SORCERY_CONFIG="${SORCERY_CONFIG:-$HOST_PATH/etc/sorcery/config}"
-
HOST_SORCERY_CONFIG="${HOST_SORCERY_CONFIG:-$HOST_PATH/etc/sorcery/config}"
-
HOST_SORCERY_LCONFIG="${HOST_SORCERY_LCONFIG:-$HOST_PATH/etc/sorcery/local/config}"
- HOST_SORCERY_LIBS="${SORCERY_LIBS:-$HOST_PATH/var/lib/sorcery/modules}"
-
HOST_SORCERY_PACKAGES="${HOST_SORCERY_PACKAGES:-$HOST_PATH/var/state/sorcery/packages}"
- HOST_SORCERY_SPOOL="${HOST_SORCERY_SPOOL:-$HOST_PATH/var/spool/sorcery}"
-
- 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)
+#!/bin/bash
+ # the arch to generate the .iso for
+ CAULDRON_ARCH="${CAULDRON_ARCH:-x86}"

+ # filename of the produced .iso (should follow Cauldron naming
conventions)
+ CAULDRON_ISO_NAME="${CAULDRON_ISO_NAME:-smgl-devel-$(date
+%Y%m%d).$CAULDRON_ARCH}"
+
+ # the version of the kernel to be used in the .iso
+ # if empty, then it will default to the version in cauldron
+ CAULDRON_KVERS="${CAULDRON_KVERS:-}"
+
+ # whether CAULDRON_BUILD should be rm'ed after cauldron has
finished
+ CAULDRON_CLEAN="${CAULDRON_CLEAN:-no}"
+
+ # do we keep the uncompressed .iso file in addition to the
compressed one?
+ CAULDRON_KEEPISO="${CAULDRON_KEEPISO:-yes}"
+
+ # whether to use color for displaying messages
+ CAULDRON_COLOR="${CAULDRON_COLOR:-yes}"
+
+ # branch of sorcery to use in the ISO
+ CAULDRON_SORCERY_BRANCH="${CAULDRON_SORCERY_BRANCH:-stable}"
+
+ # list of installers to include in the ISO
+ CAULDRON_INSTALLERS=(
+ "shell"
+ "menu"
+ )
+
+
+ # path to the host system (null for normal use)
+ CAULDRON_HOST="${CAULDRON_HOST:-}"
+ # path to the host base library modules
+
CAULDRON_BASE="${CAULDRON_BASE:-$CAULDRON_HOST/var/lib/cauldron}"
+ # path to the host cauldron library modules
+ CAULDRON_LIBS="${CAULDRON_LIBS:-$CAULDRON_BASE/cauldron}"
+ # path to the host cauldron configs
+ CAULDRON_DATA="{$CAULDRON_DATA:-$CAULDRON_HOST/etc/cauldron}"
+
+ # path to the ISO build chroot
+ CAULDRON_BUILD="${CAULDRON_BUILD:-$CAULDRON_HOST/tmp/cauldron}"
+ # temporary files generated while cauldron does its work
+ CAULDRON_TMP="${CAULDRON_TMP:-$CAULDRON_BUILD/tmp}"
+
+ # file listing all the spells needed for the build toolchain
+
CAULDRON_TOOLCHAIN="${CAULDRON_TOOLCHAIN:-$CAULDRON_DATA/$CAULDRON_ARCH/toolchain}"
+ # file listing all the spells needed for the ISO runtime
+
CAULDRON_SPELLS="${CAULDRON_SPELLS:-$CAULDRON_DATA/$CAULDRON_ARCH/spells}"
+ # file listing all the sources needed on the ISO runtime
+
CAULDRON_SOURCES="${CAULDRON_SOURCES:-$CAULDRON_DATA/$CAULDRON_ARCH/sources}"
+ # file listing all the spell caches needed on the ISO runtime
+
CAULDRON_CACHES="${CAULDRON_CACHES:-$CAULDRON_DATA/$CAULDRON_ARCH/caches}"
+
+ # command to enter a chroot
+ CAULDRON_CHROOT_CMD="${CAULDRON_CHROOT_CMD:-chroot}"
+
+ # sorcery cast/dispel/rebuild commands
+
CAULDRON_SORCERY_PATH="${CAULDRON_SORCERY_PATH:-$CAULDRON_HOST/usr/sbin}"
+ CAULDRON_CAST="${CAULDRON_CAST:-$CAULDRON_SORCERY_PATH/cast}"
+
CAULDRON_DISPEL="${CAULDRON_DISPEL:-$CAULDRON_SORCERY_PATH/dispel}"
+
CAULDRON_REBUILD="${CAULDRON_REBUILD:-$CAULDRON_SORCERY_PATH/sorcery rebuild}"
+
+ # sorcery modules location in the ISO
+
CAULDRON_ISORCERY_LIBS="${CAULDRON_ISORCERY_LIBS:-$CAULDRON_BUILD/var/lib/sorcery/modules}"
+ # sorcery config location in the ISO
+
CAULDRON_ISORCERY_CONFIG="${CAULDRON_ISORCERY_CONFIG:-$CAULDRON_BUILD/etc/sorcery/config}"
+ # sorcery local config location in the ISO
+
CAULDRON_ISORCERY_LCONFIG="${CAULDRON_ISORCERY_LCONFIG:-$CAULDRON_BUILD/etc/sorcery/local/config}"
+
+
CAULDRON_HSORCERY_CONFIG="${CAULDRON_HSORCERY_CONFIG:-$CAULDRON_HOST/etc/sorcery/config}"
+
CAULDRON_HSORCERY_LCONFIG="${CAULDRON_HSORCERY_LCONFIG:-$CAULDRON_HOST/etc/sorcery/local/config}"
+
CAULDRON_HSORCERY_LIBS="${CAULDRON_HSORCERY_LIBS:-$CAULDRON_HOST/var/lib/sorcery/modules}"
+CAULDRON_HSORCERY_PACKAGES="${CAULDRON_HSORCERY_PACKAGES:-$CAULDRON_HOST/var/state/sorcery/packages}"
+
CAULDRON_HSORCERY_SPOOL="${CAULDRON_HSORCERY_SPOOL:-$CAULDRON_HOST/var/spool/sorcery}"
+
+ # contains the arch info for the HOST
+ CAULDRON_HOST_TRIPLE="${CAULDRON_HOST_TRIPLE:-}"
+ CAULDRON_HOST_ARCH_PATH="$(grep 'ARCH_SPECS=' $CAULDORN_HSORCERY_CONFIG |
cut -d= -f2)"
+ CAULDRON_HOST_ARCH="$(grep 'ARCHITECTURE=' $CAULDORN_HSORCERY_CONFIG
| cut -d= -f2)"
+ CAULDRON_CACHE_EXTENSION="$(grep 'EXTENSION=' $CAULDORN_HSORCERY_CONFIG |
cut -d= -f2)"
+
+
+# vim:ai:tw=80:tabstop=2:softtabstop=2:shiftwidth=2:expandtab
diff --git a/cauldron/lib.chroot b/cauldron/lib.chroot
index f65c41e..443ec47 100644
--- a/cauldron/lib.chroot
+++ b/cauldron/lib.chroot
@@ -35,9 +35,12 @@ function cauldron_chroot_init() {
fi

# bind the needed mounts
- mount --bind "$HOST_PATH"/dev "$target"/dev || return $ERR_CHROOT_INIT
- mount --bind "$HOST_PATH"/dev/pts "$target"/dev/pts || return
$ERR_CHROOT_INIT
- mount --bind "$HOST_PATH"/proc "$target"/proc || return $ERR_CHROOT_INIT
+ mount --bind "$CAULDRON_HOST/dev" "$target/dev" ||
+ return $ERR_CHROOT_INIT
+ mount --bind "$CAULDRON_HOST/dev/pts" "$target/dev/pts" ||
+ return $ERR_CHROOT_INIT
+ mount --bind "$CAULDRON_HOST/proc" "$target/proc" ||
+ return $ERR_CHROOT_INIT

# make sure the sorcerous library is loaded
# which provides cauldron_source_sorcery
diff --git a/cauldron/lib.hostcache b/cauldron/lib.hostcache
index 224507e..2343e47 100644
--- a/cauldron/lib.hostcache
+++ b/cauldron/lib.hostcache
@@ -26,16 +26,17 @@
##

#-------------------------------------------------------------------------------
function cauldron_create_host_cache() {
- local spell=$1
- local install_log="${HOST_PATH}/var/log/sorcery/install/${spell}"
- local cache=${CAULDRON_CACHE}/${spell}.tar
+ local spell="$1"
+ local install_log="$CAULDRON_HOST/var/log/sorcery/install/$spell"
+ local cache="$CAULDRON_CACHES/$spell.tar"

if [[ -z create_cache_archive ]]
then
- . "${HOST_SORCERY_LIBS}"/libstate 2> $NULL || liberror_die
$ERR_HOST_SORCERY
+ . "$CAULDRON_HSORCERY_LIBS/libstate" 2>$CAULDRON_NULL ||
+ liberror_die $ERR_HOST_SORCERY
fi

- create_cache_archive "$install_log" "${cache}" "${cache}${EXTENSION}" ||
+ create_cache_archive "$install_log" "$cache" "${cache}${EXTENSION}" ||
return $ERR_CREATE_CACHE
}

@@ -51,20 +52,21 @@ function cauldron_create_host_cache() {
##

#-------------------------------------------------------------------------------
function cauldron_build_host_cache_file() {
- local spell=$1
- local aggressive=$2
- local version=
+ local spell="$1"
+ local aggressive="$2"
+ local install_logs="$CAULDRON_HOST/var/log/sorcery/install"
+ local version=""

# First check to see if the spell was installed, but no cache exists.
- if gaze -q installed $spell
+ if gaze -q installed "$spell"
then
# Spell is installed, generate a cache file using the install log?
- version=$(grep "^${spell}" ${HOST_PACKAGES} | cut -d : -f 4)
- cauldron_create_host_cache ${spell}-${version}
+ version="$(grep ^$spell $CAULDRON_HSORCERY_PACKAGES | cut -d: -f4)"
+ cauldron_create_host_cache "${spell}-${version}"
else
# Only do this part if the caller wants us to be aggressive in building
the
# cache.
- if $aggressive
+ if [[ "$aggressive" == yes || "$aggressive" == 1 ]]
then
# Do some trickery to get a cache file. Make sure that sorcery is set
to
# generate a cache file, and if not then either set sorcery to do so or
@@ -72,25 +74,25 @@ function cauldron_build_host_cache_file() {
# in a build chroot so that the user's host filesystem is not polluted.
local aggr_build="$CAULDRON_BUILD/tmp/cauldron_aggressive_cache"

- if [[ -e "$HOST_PATH/var/log/sorcery/install/${spell}-${version}" ]]
+ if [[ -e "$install_logs/${spell}-${version}" ]]
then
- # make sure the $AGGR_BUILD path is clean
+ # make sure the $aggr_build path is clean
# completely wipe it out and recreate it
rm -fr "$aggr_build"
mkdir -p "$aggr_build"

# find all the files installed by the given spell
- for file in
"$HOST_PATH/var/log/sorcery/install/${spell}-${version}/"*
+ for file in "$install_logs/${spell}-${version}"/*
do
- # copy all files from the sorcery install log into $AGGR_BUILD
- cp -a --parents "$file" "$aggr_build"/
+ # copy all files from the sorcery install log into $aggr_build
+ cp -a --parents "$file" "$aggr_build/"
done

# package the collection of files from the install log as a cache
file
tar jcf "${spell}-${version}.tar.bz2" \
- --transform "s#$aggr_build/##" $aggr_build/*
+ --transform "s#$aggr_build/##" "$aggr_build"/*

- # if the packaging was successful, wipe out the $AGGR_BUILD dir
+ # if the packaging was successful, wipe out the $aggr_build dir
[[ $? -eq 0 ]] && rm -fr "$aggr_build"
else
if [[ -e "$CAULDRON_BUILD/etc/sorcery/local/config" ]]
@@ -100,8 +102,8 @@ function cauldron_build_host_cache_file() {
[[ $archive != "on" ]] &&
sed -i 's/ARCHIVE=.*/ARCHIVE="on"/' "$config"
fi
- cauldron_chroot $CAULDRON_CAST $spell
- cauldron_chroot $CAULDRON_DISPEL $spell
+ cauldron_chroot "$CAULDRON_CAST" "$spell"
+ cauldron_chroot "$CAULDRON_DISPEL" "$spell"
fi
fi
fi
diff --git a/cauldron/lib.init b/cauldron/lib.init
index e124b62..8d45ae4 100755
--- a/cauldron/lib.init
+++ b/cauldron/lib.init
@@ -26,7 +26,7 @@
##

#-------------------------------------------------------------------------------
function cauldron_iso_init() {
- cp ${CAULDRON_DATA}/inittab ${CAULDRON_BUILD}/etc/inittab
+ cp "$CAULDRON_DATA/inittab" "$CAULDRON_BUILD/etc/inittab"
}


#-------------------------------------------------------------------------------
@@ -36,16 +36,16 @@ function cauldron_iso_init() {
##

#-------------------------------------------------------------------------------
function cauldron_ramdisk() {
- local initrd="${CAULDRON_TEMP}/initrd"
- local initmnt="${CAULDRON_TEMP}/initrd_mount"
-
- mkdir -p ${initmnt}
- dd -if /dev/null -of ${initrd}
- mke2fs ${initrd}
- mount -o loop ${initrd} ${initmnt}
- cauldron_initfs ${initmnt}
- umount ${initmnt}
- gzip -9 ${initrd}
+ local initrd="$CAULDRON_TMP/initrd"
+ local initmnt="$CAULDRON_TMP/initrd_mount"
+
+ mkdir -p "$initmnt"
+ dd '-if' /dev/null '-of' "$initrd"
+ mke2fs "$initrd"
+ mount -o loop "$initrd" "$initmnt"
+ cauldron_initfs "$initmnt"
+ umount "$initmnt"
+ gzip -9 "$initrd"
}


#-------------------------------------------------------------------------------
@@ -55,15 +55,15 @@ function cauldron_ramdisk() {
##

#-------------------------------------------------------------------------------
function cauldron_ramfs() {
- local ramdir="${CAULDRON_TEMP}/initram"
- local ramfs="${CAULDRON_TEMP}/initram.cpio"
+ local ramdir="$CAULDRON_TMP/initram"
+ local ramfs="$CAULDRON_TMP/initram.cpio"

- mkdir -p ${ramdir}
- cauldron_initfs ${ramdir}
+ mkdir -p "$ramdir"
+ cauldron_initfs "$ramdir"
(
- cd ${ramdir}
- find . -print -depth | cpio -o > ${ramfs}
- gzip -9 ${ramfs}
+ cd "$ramdir"
+ find . -print -depth | cpio -o > "$ramfs"
+ gzip -9 "$ramfs"
)
}

@@ -74,11 +74,11 @@ function cauldron_ramfs() {
##

#-------------------------------------------------------------------------------
function cauldron_initfs_dirs() {
- local initfs=$1
+ local initfs="$1"

- for dir in $(cat ${CAULDRON_DATA}/initfs.dirs)
+ for dir in $(cat "$CAULDRON_DATA/initfs.dirs")
do
- mkdir -p ${initfs}/${dir}
+ mkdir -p "$initfs/$dir"
done
}

@@ -89,11 +89,11 @@ function cauldron_initfs_dirs() {
##

#-------------------------------------------------------------------------------
function cauldron_initfs_bins() {
- local initfs=$1
+ local initfs="$1"

- for bin in $(cat ${CAULDRON_DATA}/initfs.binaries)
+ for bin in $(cat "$CAULDRON_DATA/initfs.binaries")
do
- cp $bin ${initfs}/bin
+ cp "$bin" "$initfs/bin"
done
}

@@ -104,11 +104,11 @@ function cauldron_initfs_bins() {
##

#-------------------------------------------------------------------------------
function cauldron_initfs_libs() {
- local initfs=$1
+ local initfs="$1"

- for lib in $(cat ${CAULDRON_DATA}/initfs.libs)
+ for lib in $(cat "$CAULDRON_DATA/initfs.libs")
do
- cp $lib ${initfs}/lib/
+ cp "$lib" "$initfs/lib/"
done
}

@@ -119,11 +119,11 @@ function cauldron_initfs_libs() {
##

#-------------------------------------------------------------------------------
function cauldron_initfs_mods() {
- local initfs=$1
+ local initfs="$1"

- for module in $(cat ${CAULDRON_DATA}/initfs.modules)
+ for module in $(cat "$CAULDRON_DATA/initfs.modules")
do
- cp $module ${initfs}/lib/modules/$CAULDRON_KVERS
+ cp "$module" "$initfs/lib/modules/$CAULDRON_KVERS"
done
}

@@ -134,9 +134,9 @@ function cauldron_initfs_mods() {
##

#-------------------------------------------------------------------------------
function cauldron_initfs_init() {
- local initfs=$1
+ local initfs="$1"

- cp ${CAULDRON_DATA}/initfs.init ${initfs}/linuxrc
+ cp "$CAULDRON_DATA/initfs.init" "$initfs/linuxrc"
}


#-------------------------------------------------------------------------------
@@ -146,13 +146,13 @@ function cauldron_initfs_init() {
##

#-------------------------------------------------------------------------------
function cauldron_initfs() {
- local initfs=$1
+ local initfs="$1"

- cauldron_initfs_dirs $initfs
- cauldron_initfs_bins $initfs
- cauldron_initfs_libs $initfs
- cauldron_initfs_mods $initfs
- cauldron_initfs_init $initfs
+ cauldron_initfs_dirs "$initfs"
+ cauldron_initfs_bins "$initfs"
+ cauldron_initfs_libs "$initfs"
+ cauldron_initfs_mods "$initfs"
+ cauldron_initfs_init "$initfs"
}


#-------------------------------------------------------------------------------
diff --git a/cauldron/lib.sorcerous b/cauldron/lib.sorcerous
index 53572b3..8cfaef6 100644
--- a/cauldron/lib.sorcerous
+++ b/cauldron/lib.sorcerous
@@ -17,8 +17,7 @@


#-------------------------------------------------------------------------------
##
-## Sources the sorcery config files. Should only be called by
-## cauldron_chroot_init.
+## Sources the sorcery config files. Mainly called by cauldron_chroot_init.
##
## TODO:
## this needs to be fixed, since sorcery uses some absolute paths and has
some
@@ -30,15 +29,16 @@
##

#-------------------------------------------------------------------------------
function cauldron_source_sorcery() {
- local target="${1:-$ISO_SORCERY_CONFIG}"
+ local config="${1:-$CAULDRON_ISORCERY_CONFIG}"
+ local local_config="${2:-$CAULDRON_ISORCERY_LCONFIG}"

# source the main config file
- source "$target" || return $ERR_TARGET_SORCERY
+ source "$config" || return $ERR_TARGET_SORCERY

# if the local config exists, source it
- if [[ -e "$target" ]]
+ if [[ -f "$local_config" ]]
then
- source "$target" || return $ERR_TARGET_SORCERY
+ source "$local_config" || return $ERR_TARGET_SORCERY
fi

return $ERR_OK
@@ -58,29 +58,31 @@ function cauldron_source_sorcery() {
##

#-------------------------------------------------------------------------------
function cauldron_configure_toolchain() {
- local stage=$1
+ local stage="$1"
+ local hostarch="$CAULDRON_HOST_ARCH"
+ local arch="$CAULDRON_ARCH"

if [[ -z modify_config ]]
then
- . "${HOST_SORCERY_LIBS}"/libtrack 2> $CAULDRON_NULL ||
+ . "$CAULDRON_HSORCERY_LIBS/libtrack" 2> $CAULDRON_NULL ||
liberror_die $ERR_HOST_SORCERY
fi

# make sure the sorcery local config dir exists on the ISO
- mkdir -p "$ISO_SORCERY_CONFIG" || return $ERR_ISO_SORCERY_CONFIG
+ mkdir -p "$CAULDRON_ISORCERY_LCONFIG" || return $ERR_ISO_SORCERY_CONFIG

- case ${stage} in
+ case "$stage" in
1)
- modify_config "$ISO_SORCERY_CONFIG" CUSTOM_CFLAGS \
- "--host=${HOST_ARCH} --target=${CAULDRON_ARCH}"
+ modify_config "$CAULDRON_ISORCERY_LCONFIG" CUSTOM_CFLAGS \
+ "--host=$hostarch --target=$arch"
;;
2)
- modify_config "$ISO_SORCERY_CONFIG" CUSTOM_CFLAGS \
- "--build=${HOST_ARCH} --host=${CAULDRON_ARCH}"
+ modify_config "$CAULDRON_ISORCERY_LCONFIG" CUSTOM_CFLAGS \
+ "--build=$hostarch --host=$arch"
;;
3)
- modify_config "$ISO_SORCERY_CONFIG" CUSTOM_CFLAGS \
- "--build=${HOST_ARCH} --host=${CAULDRON_ARCH}
--target=${CAULDRON_ARCH}"
+ modify_config "$CAULDRON_ISORCERY_LCONFIG" CUSTOM_CFLAGS \
+ "--build=$hostarch --host=$arch --target=$arch"
;;
esac
}
@@ -123,7 +125,7 @@ function cauldron_download_sorcery() {

#-------------------------------------------------------------------------------
function cauldron_sorcery_install() {
local force_download=$1
- local branch="$ISO_SORCERY_BRANCH"
+ local branch="$CAULDRON_SORCERY_BRANCH"
local spool="$CAULDRON_BUILD/var/spool/sorcery"

# ensure the spool dir exists for getting spell sources
@@ -131,13 +133,13 @@ function cauldron_sorcery_install() {

# check to see if we will copy or download the sorcery source tarball
# then get the source tarball and place it in CAULDRON_BUILD
- if [[ -e "$HOST_SORCERY_SPOOL"/sorcery-${branch}.tar.bz2 ]]
+ if [[ -e "$CAULDRON_HSORCERY_SPOOL"/sorcery-${branch}.tar.bz2 ]]
then
if [[ "$force_download" == "yes" ]]
then
cauldron_download_sorcery $branch "$spool"
else
- cp "$HOST_SORCERY_SPOOL"/sorcery-${branch}.tar.bz2 "$spool"
+ cp "$CAULDRON_HSORCERY_SPOOL"/sorcery-${branch}.tar.bz2 "$spool"
fi
else
cauldron_download_sorcery ${branch} "$spool"
diff --git a/cauldron/libcauldron b/cauldron/libcauldron
index 176de76..b33f312 100755
--- a/cauldron/libcauldron
+++ b/cauldron/libcauldron
@@ -25,7 +25,7 @@ CAULDRON_NULL="/dev/null"
##

#-------------------------------------------------------------------------------
function cauldron_fatal_error() {
- echo $1
+ echo "$1"
exit 1
}

@@ -34,11 +34,11 @@ function cauldron_fatal_error() {
## liberror includes - load these first!
##

#-------------------------------------------------------------------------------
-. ${CAULDRON_BASE}/liberror 2>$CAULDRON_NULL ||
+. "$CAULDRON_BASE/liberror" 2>$CAULDRON_NULL ||
cauldron_fatal_error "error: cannot load base libraries!"

# load cauldron error code and message defines
-. ${CAULDRON_LIBS}/errorcodes 2>$CAULDRON_NULL ||
+. "$CAULDRON_LIBS/errorcodes" 2>$CAULDRON_NULL ||
cauldron_fatal_error "error: cannot load cauldron libraries!"

# drop cauldron_fatal_error if liberror was successfully loaded
@@ -54,22 +54,22 @@ unset cauldron_fatal_error
##

#-------------------------------------------------------------------------------
function cauldron_load_library() {
- local lib=$1
+ local lib="$1"

- . "$CAULDRON_LIBS/$lib" 2>$CAULDRON_NULL ||
+ . "$CAULDRON_LIBS/$lib" 2>$CAULDRON_NULL
liberror_check_fatal_error
}


#-------------------------------------------------------------------------------
# cauldron includes

#-------------------------------------------------------------------------------
-#cauldron_load_library lib.sorcerous
+#cauldron_load_library "lib.sorcerous"

-cauldron_load_library lib.chroot
+cauldron_load_library "lib.chroot"

-cauldron_load_library lib.init
+cauldron_load_library "lib.init"

-#cauldron_load_library lib.hostcache
+#cauldron_load_library "lib.hostcache"

if [[ $CAULDRON_COLOR == "yes" ]]
then
@@ -87,23 +87,25 @@ fi
##

#-------------------------------------------------------------------------------
function cauldron_get_host_triple() {
- local arch_spec
- local host_triple
- local spec
+ local arch_spec=""
+ local host_triple=""
+ local spec=""

# get the value for the HOST triplet from sorcery archspecs
- for spec in ${HOST_ARCH_PATH[@]}
+ for spec in ${CAULDRON_HOST_ARCH_PATH[@]}
do
- if [[ $(find --version|grep -q 'version 4\.1\(\.\|$\)') == 1 ]]
+ local search="-perm 400 -type f -name $CAULDRON_HOST_ARCH"
+
+ if [[ "$(find --version | grep -q 'version 4\.1\(\.\|$\)')" == 1 ]]
then
- arch_spec="$(find $spec -perm 400 -type f -name $HOST_ARCH \
- -print 2>$CAULDRON_NULL)"
+ arch_spec="$(find $spec $search -print 2>$CAULDRON_NULL)"
else
- arch_spec="$(find -L $spec -perm 400 -type f -name $HOST_ARCH \
- -print 2>$CAULDRON_NULL)"
+ arch_spec="$(find -L $spec $search -print 2>$CAULDRON_NULL)"
fi
+
[[ -n $arch_spec ]] && break
done
+
host_triple="$(grep 'HOST=' $arch_spec | cut -d = -f 2)"

echo "$host_triple"
@@ -120,15 +122,16 @@ function cauldron_get_host_triple() {
##

#-------------------------------------------------------------------------------
function cauldron_base_toolchain() {
- local spell
- local version
- local spell_cache
- local host_triple
+ local spell=""
+ local version=""
+ local spell_cache=""
+ local host_triple=""
+ local ext="$CAULDRON_CACHE_EXTENSION"

# get the value for HOST_TRIPLE
- host_triple=$(cauldron_get_host_triple)
+ host_triple="$(cauldron_get_host_triple)"

- [[ -z host_triple ]] && return $ERR_HOST_TRIPLE
+ [[ -z $host_triple ]] && return $ERR_HOST_TRIPLE

# grab the list of spells needed as the base tool-chain which will be
# used to create the cross-compile tool-chain
@@ -136,28 +139,28 @@ function cauldron_base_toolchain() {
do
# grab the version for the spell from sorcery's state info
# on what's installed
- version=$(grep "^$spell" "$HOST_SORCERY_PACKAGES" | cut -d : -f 4)
+ version="$(grep ^$spell $CAULDRON_HSORCERY_PACKAGES | cut -d: -f4)"

# check if spell found on the system
if [[ -n $version ]]
then
# set SPELL_CACHE as shorthand for SPELL-VERSION-HOST_TRIPLE.tar.bz2
- spell_cache="${spell}-${version}-${host_triple}.tar${CACHE_EXTENSION}"
+ spell_cache="${spell}-${version}-${host_triple}.tar${ext}"

# 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" ]]
+ if [[ -f "$CAULDRON_HSORCERY_SPOOL/$spell_cache" ]]
then
# found a cache file, copy it to the BUILD dir
- cp "$HOST_SORCERY_SPOOL/$spell_cache" "$CAULDRON_BUILD" ||
+ cp "$CAULDRON_HSORCERY_SPOOL/$spell_cache" "$CAULDRON_BUILD" ||
return $ERR_CP_CACHE
else
# couldn't find a cache file, so we'll need to build one
if [[ -z cauldron_build_host_cache_file ]]
then
- cauldron_load_library lib.hostcache
+ cauldron_load_library "lib.hostcache"
fi
cauldron_build_host_cache_file "$spell" ||
return $ERR_BUILD_CACHE
@@ -190,23 +193,23 @@ function cauldron_base_toolchain() {

#-------------------------------------------------------------------------------
function cauldron_cross_toolchain() {
# build the stage 1 tools
- cauldron_configure_toolchain 1
- cauldron_chroot ${CAULDRON_CAST} binutils
- cauldron_chroot ${CAULDRON_CAST} gcc
+ cauldron_configure_toolchain 1 || return $ERR_TOOLCHAIN_STAGE1
+ cauldron_chroot "$CAULDRON_CAST" "binutils" || return $ERR_CHROOT_CAST
+ cauldron_chroot "$CAULDRON_CAST" "gcc" || return $ERR_CHROOT_CAST

# build glibc (stage 2)
- cauldron_configure_toolchain 2
- cauldron_chroot ${CAULDRON_CAST} glibc
+ cauldron_configure_toolchain 2 || return $ERR_TOOLCHAIN_STAGE2
+ cauldron_chroot "$CAULDRON_CAST" "glibc" || return $ERR_CHROOT_CAST

# rebuild gcc (still stage 1, but this time linked against the
# cross-glibc
- cauldron_configure_toolchain 1
- cauldron_chroot ${CAULDRON_CAST} gcc
+ cauldron_configure_toolchain 1 || return $ERR_TOOLCHAIN_STAGE1
+ cauldron_chroot "$CAULDRON_CAST" "gcc" || return $ERR_CHROOT_CAST

# do a sorcery rebuild inside the BUILD dir to
# generate the cross-compile tool-chain (stage 3)
- cauldron_configure_toolchain 3
- cauldron_chroot ${CAULDRON_REBUILD}
+ cauldron_configure_toolchain 3 || return $ERR_TOOLCHAIN_STAGE3
+ cauldron_chroot "$CAULDRON_REBUILD" || return $ERR_CHROOT_REBUILD
}


#-------------------------------------------------------------------------------
@@ -218,13 +221,17 @@ function cauldron_cross_toolchain() {
##

#-------------------------------------------------------------------------------
function cauldron_build_target_system() {
- local target_spells=$1
- local spell
+ local target_spells="$1"
+ local spell=""

# Since we will be installing from the running ISO system instead of a
giant
# tarball, for each spell we only need to make sure that the cache file is
# available. This will require that the ISO sorcery has caching enabled.
The
# caching should really be turned on from the very beginning though...
+ if [[ -z $ARCHIVE ]]
+ then
+ cauldron_source_sorcery || return $ERR_TARGET_SORCERY
+ fi
[[ "$ARCHIVE" == "off" ]] && return $ERR_ARCHIVE

for spell in $target_spells
@@ -234,8 +241,8 @@ function cauldron_build_target_system() {
# on the ISO filesystem (any spells cast here should be those not
required
# for the functioning of the ISO itself, only to be installed to the
target
# system).
- cauldron_chroot ${CAULDRON_CAST} $spell
- cauldron_chroot ${CAULDRON_DISPEL} $spell
+ cauldron_chroot "$CAULDRON_CAST" "$spell" || return $ERR_CHROOT_CAST
+ cauldron_chroot "$CAULDRON_DISPEL" "$spell" || return $ERR_CHROOT_DISPEL
done

return $ERR_OK
@@ -251,19 +258,19 @@ function cauldron_build_target_system() {
##

#-------------------------------------------------------------------------------
function cauldron_clean_iso_system() {
- local cleanfile=$1
+ local cleanfile="$1"

[[ -z "$cleanfile" ]] && return $ERR_CLEANFILE

for i in $(sort -r $cleanfile)
do
- if [[ -d $i ]]
+ if [[ -d "$i" ]]
then
echo "Attempting to remove directory $i..."
- rmdir $i || return $ERR_CLEAN_DIR
+ rmdir "$i" || return $ERR_CLEAN_DIR
else
echo "Deleting $i"
- rm $i || return $ERR_CLEAN_FILE
+ rm "$i" || return $ERR_CLEAN_FILE
fi
done

@@ -277,15 +284,56 @@ 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}
+ mkisofs -R \
+ -b isolinux/isolinux.bin \
+ -c isolinux/boot.cat \
+ -no-emul-boot \
+ -boot-load-size 4 \
+ -boot-info-table \
+ -o "$CAULDRON_ISO_NAME" \
+ "$CAULDRON_BUILD" ||
+ return $ERR_MKISOFS

if [[ "$CAULDRON_KEEPISO" == "yes" ]] ;
then
- bzip2 -k ${SMGL_ISO}
+ bzip2 -k "$CAULDRON_ISO_NAME" || return $ERR_COMPRESS_ISO
else
- bzip2 ${SMGL_ISO}
+ bzip2 "$CAULDRON_ISO_NAME" || return $ERR_COMPRESS_ISO
fi
+
+ return $ERR_OK
+}
+
+#-------------------------------------------------------------------------------
+##
+## Sources the enchantment config files in the build chroot so that we can
+## obtain (and modify if the user so wishes) the paths where we will store
the
+## enchantment files (libraries, installers, install modules, etc.) on the
ISO.
+##
+#-------------------------------------------------------------------------------
+function cauldron_source_enchantment() {
+ local host_enchant_config="$CAULDRON_HOST/etc/cauldron/enchantment/config"
+ local enchant_config="$CAULDRON_BUILD/etc/enchantment/config"
+ local enchant_lconfig="$CAULDRON_BUILD/etc/enchantment/local/config"
+
+ # make sure the ISO has the enchantment configs first
+ # if, we need to copy them (they are required for the ISO)
+ if [[ ! -f "$enchant_config" ]]
+ then
+ cp -f "$host_enchant_config" "$enchant_config" ||
+ liberror_die $ERR_ENCHANT_CONFIG
+ fi
+
+ # set ENCHANT_ISO_PATH before sourcing the enchantment configs so all the
+ # enchantment variables used by cauldron will be relative to the cauldron
+ # build chroot
+ ENCHANT_ISO_PATH="$CAULDRON_BUILD"
+
+ # source the enchantment config to make sure we get the paths correct
+ . "$enchant_config" 2>$CAULDRON_NULL ||
+ liberror_die $ERR_ENCHANT_CONFIG
+ # try to source the local config, but don't die if it doesn't exist
+ . "$enchant_lconfig" 2>$CAULDRON_NULL
}


#-------------------------------------------------------------------------------
@@ -299,18 +347,20 @@ function cauldron_mkisofs() {
## future though.
##

#-------------------------------------------------------------------------------
-function cauldron_add_installer() {
- local installer=$1
+function cauldron_add_installers() {
+ local installer=""

# make sure CAULDRON_BUILD/ENCHANT_DATA exists
- mkdir -p "$CAULDRON_BUILD/$ENCHANT_DATA/" || return $ERR_INSTALLER_DIR
+ mkdir -p "$ENCHANT_DATA" || return $ERR_INSTALLER_DIR

- cp -r "$CAULDRON_LIBS/$installer" "$CAULDRON_BUILD/$ENCHANT_DATA/" ||
- return $ERR_COPY_INSTALLER
+ for installer in $CAULDRON_INSTALLERS
+ do
+ cp -r "$CAULDRON_LIBS/enchantment/$installer" "$ENCHANT_DATA/" ||
+ return $ERR_COPY_INSTALLER

- ln -sf "$CAULDRON_BUILD/$ENCHANT_DATA/$installer"/bin/* \
- "$CAULDRON_BUILD"/usr/sbin/ ||
- return $ERR_LINK_INSTALLER
+ ln -sf "$ENCHANT_DATA/$installer"/bin/* "$CAULDRON_BUILD/usr/sbin/" ||
+ return $ERR_LINK_INSTALLER
+ done

return $ERR_OK
}
@@ -354,11 +404,11 @@ function cauldron_cleanup() {
# if the user wants everything cleaned, kill the build directory
if [[ "$CAULDRON_CLEAN" == "yes" ]]
then
- rm -fr "$CAULDRON_BUILD" || return $ERR_CLEANUP
+ rm -fr "$CAULDRON_BUILD" || return $ERR_CLEANUP_BUILD
fi

# kill the temp directory
- rm -fr "$CAULDRON_TMP" || return $ERR_CLEANUP
+ rm -fr "$CAULDRON_TMP" || return $ERR_CLEANUP_TMP

return $ERR_OK
}
diff --git a/delint/global_variables b/delint/global_variables
new file mode 100755
index 0000000..540e915
--- /dev/null
+++ b/delint/global_variables
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+myself="$(dirname $0)"
+
+# load liberror (this is not optional)
+if ! . "${CAULDRON_LIBS:-$myself/../lib}/liberror"
+then
+ echo "error: could not load ${CAULDRON_LIBS:-$myself/../lib}/liberror"
+ exit 1
+fi
+
+# load libcolor (there should be an option for this later)
+if ! . "${CAULDRON_LIBS:-$myself/../lib}/libcolor"
+then
+ echo "error: could not load ${CAULDRON_LIBS:-$myself/../lib}/libcolor"
+ exit 1
+fi
+
+function print_usage() {
+ cat << EndUsage
+Usage: $(basename $0) definition_file file_to_check1 [file_to_check2 ...]
+
+Checks whether global variables in FILE_TO_CHECK1 [FILE_TO_CHECK2 ...] were
+defined in DEFINITION_FILE. For any global variables not so defined, they are
+printed on stdout along with the file in which they were used.
+EndUsage
+}
+
+function usage() {
+ print_usage
+ exit $ERR_FATAL
+}
+
+defines="$1"
+shift
+
+if [[ $# -eq 0 ]]
+then
+ echo "$(print_usage)"
+ liberror_die $ERR_FATAL
+fi
+
+while [[ $# -gt 0 ]]
+do
+ file="$1"
+ shift
+
+ # as per the API specification, all global variables are required to be
+ # uppercase, and must begin with a letter, containing only letters,
+ # underscores, and trailing numbers
+ for search in $(grep -o '${\?[A-Z][A-Z_]*[0-9]*' "$file" | sort -u | sed
's/^\${\?//')
+ do
+ grep -q "$search=" "$defines" || echo "$file: $search"
+ done
+done
+
diff --git a/enchantment/lib.potion b/enchantment/lib.potion
index cec0c4b..b9d8547 100644
--- a/enchantment/lib.potion
+++ b/enchantment/lib.potion
@@ -42,7 +42,7 @@ ENCHANT_POTION_CONFS=(

# list of ISO mounts to exclude from partition/filesystem/mount_point
listings
# each match is exact, so subdirectories need to be explicitly listed
separately
-POTION_MOUNT_EXCLUDES=(
+ENCHANT_POTION_MOUNT_EXCLUDES=(
/
/dev
/dev/pts
@@ -186,7 +186,7 @@ function enchant_potion_get_partitions() {

# list of ISO mounts to exclude
# each match is exact
- local excl="$POTION_MOUNT_EXCLUDES"
+ local excl="$ENCHANT_POTION_MOUNT_EXCLUDES"

[[ -d $ENCHANT_POTION ]] || return $ERR_POTION_DIR

@@ -235,7 +235,7 @@ function enchant_potion_get_filesystems() {

# list of ISO mounts to exclude
# each match is exact
- local excl="$POTION_MOUNT_EXCLUDES"
+ local excl="$ENCHANT_POTION_MOUNT_EXCLUDES"

[[ -d $ENCHANT_POTION ]] || return $ERR_POTION_DIR

@@ -284,7 +284,7 @@ function enchant_potion_get_mount_points() {

# list of ISO mounts to exclude
# each match is exact
- local excl="$POTION_MOUNT_EXCLUDES"
+ local excl="$ENCHANT_POTION_MOUNT_EXCLUDES"

[[ -d $ENCHANT_POTION ]] || return $ERR_POTION_DIR

diff --git a/enchantment/libenchantment b/enchantment/libenchantment
index ddd4af4..1a0e11d 100755
--- a/enchantment/libenchantment
+++ b/enchantment/libenchantment
@@ -62,8 +62,8 @@ unset enchant_fatal_error
function enchant_load_library() {
local lib="$1"

- . "$ENCHANT_LIBS/$lib" 2>$ENCHANT_NULL ||
- liberror_check_fatal_error
+ . "$ENCHANT_LIBS/$lib" 2>$ENCHANT_NULL
+ liberror_check_fatal_error
}


#-------------------------------------------------------------------------------
@@ -114,19 +114,20 @@ function enchant_color() {
##

#-------------------------------------------------------------------------------
function enchant_copy_kernel() {
- local KERNEL="$1"
- local LINUX_VER="$2"
+ local iso="$ENCHANT_ISO_PATH"
+ local kernel="$1"
+ local linux_ver="$2"

# copy the kernel over
- cp "$ENCHANT_ISO/boot/$KERNEL" "$ENCHANT_TARGET/boot/" ||
+ cp "$iso/boot/$kernel" "$ENCHANT_TARGET/boot/" ||
return $ERR_KERNEL

# copy the modules over
- cp --parents -r "$ENCHANT_ISO/lib/modules/$LINUX_VER"/* "$ENCHANT_TARGET/"
||
- return $ERR_KERNEL_MODULES
+ cp --parents -r "$iso/lib/modules/$linux_ver"/* "$ENCHANT_TARGET/" ||
+ return $ERR_KERNEL_MODULES

# make sure that the proper dep info is generated on the target system
- depmod -a -b "$ENCHANT_TARGET/lib/modules/$LINUX_VER" "$LINUX_VER" ||
+ depmod -a -b "$ENCHANT_TARGET/lib/modules/$linux_ver" "$linux_ver" ||
return $ERR_KERNEL_DEPMOD

return $ERR_OK
diff --git a/lib/liberror b/lib/liberror
index 151159b..ba535d6 100755
--- a/lib/liberror
+++ b/lib/liberror
@@ -61,13 +61,13 @@ function liberror_print_error() {
# exit if $errmsg not defined
[[ -z $errmsg ]] && return 1

- if [[ ${error} -eq 0 ]]
+ if [[ "$error" == 0 ]]
then
# print an OK message
- echo $(libcolor_message "$errmsg") >$output
+ echo -e "${LIBCOLOR_MESSAGE_COLOR}${errmsg}${LIBCOLOR_NORMAL_COLOR}"
>&$output
else
# print the error message
- echo $(libcolor_error "$errmsg") >$output
+ echo -e "${LIBCOLOR_ERROR_COLOR}${errmsg}${LIBCOLOR_NORMAL_COLOR}"
>&$output
fi || return 1

return 0
@@ -85,7 +85,7 @@ function liberror_die() {
local error=$1

# exit if $errmsg not defined
- [[ -z $errmsg ]] && return 1
+ [[ -z $error ]] && return 1

# print the corresponding error message on STDERR
liberror_print_error $error $LIBERR_STDERR



  • [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (947f64f7b763a1fd3a706e2bf6dcdd1556796770), Justin Boffemmyer, 03/16/2010

Archive powered by MHonArc 2.6.24.

Top of Page