Skip to Content.
Sympa Menu

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

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 (6bcf47bee9b9f60093ffe9b6322f5a504896b97b)
  • Date: Tue, 28 Jun 2011 08:27:55 -0500

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

cauldron/lib/libcauldron | 17 +
enchantment/data/config/commands.conf | 294
++++++++++++++++++++++++++++++++++
enchantment/data/config/default.conf | 15 +
enchantment/data/config/display.conf | 5
enchantment/data/config/i18n.conf | 5
enchantment/data/config/kernel.conf | 11 +
enchantment/data/config/modules.conf | 5
enchantment/data/config/paths.conf | 24 ++
enchantment/data/config/potion.conf | 25 ++
enchantment/data/config/sorcery.conf | 11 +
enchantment/data/config/spells.conf | 24 ++
enchantment/data/config/target.conf | 17 +
enchantment/doc/enchantment.8 | 47 +++--
enchantment/etc/enchantment.conf | 94 ----------
enchantment/lib/errorcodes | 14 -
enchantment/lib/lib.potion | 59 +++++-
enchantment/lib/libenchantment | 29 ++-
enchantment/shell/bin/enchantment | 10 -
enchantment/shell/functions | 4
ward/functions | 2
ward/global_variables | 2
ward/libward | 12 +
ward/ward-all | 2
ward/ward-configvars | 4
ward/ward-errorcodes | 2
ward/ward-functions | 2
26 files changed, 581 insertions(+), 155 deletions(-)

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

libcolor color setting wrapper functions

Rather than always manipulating LIBCOLOR_NOCOLOR directly, implement
wrapper functions to handle the setting. This yields a cleaner
implementation, and helps proof userland front-ends against any changes
that may get implemented in libcolor in the future (only the wrapper
functions would need to be updated, rather than every possible
front-end).

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

enchantment: lib.potion: spell sources vs. caches

Split the file hashing/caching for installable spells into spell sources
and spell caches. The two are logically separate, and the installer is
now capable of handling both types individually, so splitting the
functionality in lib.potion brings it in sync with lib.install and the
installers.

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

enchantment: libenchantment: return real errorcode

When returning an error code after attempting libpotion_update, return
whatever error code is actually present rather than trying to force it
to a static one. The libpotion_update function is just a wrapper that
calls the collection of update functions, but if one of those functions
fails, libpotion_update will stop processing and immediately return an
error. Thus, if we return $? in libenchantment, we are getting the error
code of the function that really errored.

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

enchantment: libenchantment: history -> potion

There were some leftover occurrences of 'HISTORY' as global variables
and error codes. Replace such occurrences with their corresponding
'POTION' versions, as potion is now integrated into enchantment (though
still requires testing).

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

enchantment: lib.potion: missing 'then' keyword

Add a necessary 'then' keyword to complete an if block.

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

enchantment: sync/fix error codes in lib.potion

Correct/update the error codes used in the lib.potion functions to match
what is current in the errorcodes file. Largely, this involves changes
of CHK->UPDATE, which more accurately reflects what the functions do
(and would produce errors about).

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

enchantment/errorcodes: enforce wrap at 80 chars

Somehow had a few lines that went over 80 characters per line. Corrected
by splitting the lines.

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

enchantment/doc: clean up the descriptions/syntax

Several statements had seemingly overarching (and unintended) possible
implications or were just otherwise more confusing than they needed to
be.

Added more explicit argument syntax descriptions in the command
syntax overviews.

Reordered the Source and Target Kernel environment variable description
blocks to match the order of the path description blocks.

The description of the ENCHANT_TMP environment variable was apparently
missing. This description has now been added.

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

ward: pass command-line arguments to sub-scripts

When running ward-all, pass any and all command-line arguments to each
of the executed sub-scripts in turn. Since all the sub-scripts take
uniform command-line arguments, this allows for an easy way to select a
shared option across the subscripts (such as disabling color output).

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

ward: control color setting via wrapper function

Control the libcolor state via a wrapper function. This allows for a
cleaner implementation with better separation between the higher-level
ward front-ends and the libward (and libcolor, liberror, etc.) back-end
code.

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

cauldron: more verbose reporting on fatal errs

For the initial loading code, be more verbose in reporting a fatal
error. Specifically, report which library the error occurred in.

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

enchantment: more verbose reporting on fatal errs

For the initial loading code, be more verbose as to the cause of any
fatal errors. Specifically, report which library could not be loaded.

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

enchantment/shell: allow overriding config file

Allow overriding the configuration file path/name. Currently this is
only handled by way of an environment variable. A command-line switch
will be implemented in the near future as well.

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

enchantment/shell: correct placement of else block

Accidentally had an else block in the enclosing if, rather than the
embedded if where it belonged. This resulted in the corresponding file
never being printed if it actually existed. The behavior is now
corrected, with the error reporting only occurring if the file truly
doesn't exist.

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

correct variable naming (ENCHANTMENT -> ENCHANT)

Accidentally had a misnamed variable usage. This is now corrected as
ENCHANTMENT_NULL -> ENCHANT_NULL.

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

enchantment: reorganize/refactor config files

Split the enchantment configuration file into logically separated
config files, like has been done with cauldron, and pull in a default
configuration profile in the main enchantment configuration file. This
allows much greater flexibility in the configuration, as well as greater
readability.

diff --git a/cauldron/lib/libcauldron b/cauldron/lib/libcauldron
index 9011b0f..5546ddf 100755
--- a/cauldron/lib/libcauldron
+++ b/cauldron/lib/libcauldron
@@ -67,7 +67,7 @@ function cauldron_load_library() {
local lib="$1"

. "$CAULDRON_LIBS/$lib" 2>$CAULDRON_NULL
- liberror_check_fatal
+ liberror_check_fatal "cannot load library $lib"
}


#-------------------------------------------------------------------------------
@@ -79,6 +79,21 @@ cauldron_load_library "lib.init"
cauldron_load_library "lib.toolchain"


#-------------------------------------------------------------------------------
+## @param color state [yes or no] (optional)
+##
+## Wrapper function that handles setting the color state in libcolor.
Possible
+## values for the color state parameter are 'yes' or 'no' (without the
quotes).
+## If the parameter isn't supplied, then it defaults to whatever
CAULDRON_COLOR
+## is set to.
+##
+#-------------------------------------------------------------------------------
+function cauldron_color() {
+ local color="${1:-$CAULDRON_COLOR}"
+
+ [ "$1" = "no" ] && LIBCOLOR_NOCOLOR="yes"
+}
+
+#-------------------------------------------------------------------------------
## @param cleanfile
##
## Cleans out unneeded files that were used to generate the ISO, but should
diff --git a/enchantment/data/config/commands.conf
b/enchantment/data/config/commands.conf
new file mode 100644
index 0000000..b0e0532
--- /dev/null
+++ b/enchantment/data/config/commands.conf
@@ -0,0 +1,294 @@
+#!/bin/bash
+
+# command to output text strings (typically echo, output to STDOUT
+[[ -n "${ENCHANT_CMD_OUTPUT[@]}" ]] ||
+ ENCHANT_CMD_OUTPUT=(
+ echo
+ )
+
+# command to enter a chroot
+[[ -n "${ENCHANT_CMD_CHROOT[@]}" ]] ||
+ ENCHANT_CMD_CHROOT=(
+ "$ENCHANT_ISO_PATH/bin/chroot"
+ )
+
+# command to download a url from the internet
+[[ -n "${ENCHANT_CMD_URL_DL[@]}" ]] ||
+ ENCHANT_CMD_URL_DL=(
+ wget
+ )
+
+# command used to generate the final iso media
+[[ -n "${ENCHANT_CMD_MKISOFS[@]}" ]] ||
+ ENCHANT_CMD_MKISOFS=(
+ mkisofs
+ -R
+ -b isolinux/isolinux.bin
+ -c isolinux/boot.cat
+ -no-emul-boot
+ -boot-load-size 4
+ -boot-info-table
+ -o "$ENCHANT_ISO_NAME"
+ "$ENCHANT_BUILD"
+ )
+
+# command to archive the sys package (e.g., tar, cpio, etc.)
+[[ -n "${ENCHANT_CMD_ARCHIVE_SYS[@]}" ]] ||
+ ENCHANT_CMD_ARCHIVE_SYS=(
+ tar
+ cf "$ENCHANT_BUILD"/"${ENCHANT_SYS_NAME}.tar"
+ -C "$ENCHANT_SYS"
+ )
+
+# command used for compressing files
+[[ -n "${ENCHANT_CMD_COMPRESS[@]}" ]] ||
+ ENCHANT_CMD_COMPRESS=(
+ bzip2
+ )
+
+# command to unpack a baseroot archive into the cauldron build
+[[ -n "${ENCHANT_CMD_TAR[@]}" ]] ||
+ ENCHANT_CMD_TAR=(
+ tar
+ )
+
+# command to unpack a sorcery archive into the cauldron build
+[[ -n "${ENCHANT_CMD_UNPACK_SORCERY[@]}" ]] ||
+ ENCHANT_CMD_UNPACK_SORCERY=(
+ "${ENCHANT_CMD_TAR[@]}"
+ -C "$ENCHANT_BUILD/usr/src"
+ xf
+ )
+
+# command to unpack a baseroot archive into the cauldron build
+[[ -n "${ENCHANT_CMD_UNPACK_BASEROOT[@]}" ]] ||
+ ENCHANT_CMD_UNPACK_BASEROOT=(
+ "${ENCHANT_CMD_TAR[@]}"
+ -C "$ENCHANT_BUILD/baseroot"
+ xf "$ENCHANT_BASEROOT"
+ )
+
+# command to unpack a baseroot archive into the cauldron build
+[[ -n "${ENCHANT_CMD_UNPACK_BUILD[@]}" ]] ||
+ ENCHANT_CMD_UNPACK_BUILD=(
+ "${ENCHANT_CMD_TAR[@]}"
+ -C "$ENCHANT_BUILD/"
+ xf
+ )
+
+# command to chmod files
+[[ -n "${ENCHANT_CMD_CHMOD[@]}" ]] ||
+ ENCHANT_CMD_CHMOD=(
+ chmod
+ )
+
+# command to make directories
+[[ -n "${ENCHANT_CMD_MKDIR[@]}" ]] ||
+ ENCHANT_CMD_MKDIR=(
+ mkdir
+ -p
+ )
+
+# command to remove directories
+[[ -n "${ENCHANT_CMD_RMDIR[@]}" ]] ||
+ ENCHANT_CMD_RMDIR=(
+ rmdir
+ )
+
+# command to copy
+[[ -n "${ENCHANT_CMD_CP[@]}" ]] ||
+ ENCHANT_CMD_CP=(
+ cp
+ )
+
+# command to copy forcefully
+[[ -n "${ENCHANT_CMD_CP_FORCE[@]}" ]] ||
+ ENCHANT_CMD_CP_FORCE=(
+ "${ENCHANT_CMD_CP[@]}"
+ -f
+ )
+
+# command to copy recursively
+[[ -n "${ENCHANT_CMD_CP_RECURSE[@]}" ]] ||
+ ENCHANT_CMD_CP_RECURSE=(
+ "${ENCHANT_CMD_CP[@]}"
+ -r
+ )
+
+# command to copy recursively forcefully
+[[ -n "${ENCHANT_CMD_CP_RECURSE_FORCE[@]}" ]] ||
+ ENCHANT_CMD_CP_RECURSE_FORCE=(
+ "${ENCHANT_CMD_CP_RECURSE[@]}"
+ -f
+ )
+
+# command to copy recursively, preserving as much information as possible
+[[ -n "${ENCHANT_CMD_CP_EXACT[@]}" ]] ||
+ ENCHANT_CMD_CP_EXACT=(
+ "${ENCHANT_CMD_CP[@]}"
+ -a --parents
+ )
+
+# command to remove files
+[[ -n "${ENCHANT_CMD_RM[@]}" ]] ||
+ ENCHANT_CMD_RM=(
+ rm
+ )
+
+# command to remove files forcefully
+[[ -n "${ENCHANT_CMD_RM_FORCE[@]}" ]] ||
+ ENCHANT_CMD_RM_FORCE=(
+ "${ENCHANT_CMD_RM_[@]}"
+ -f
+ )
+
+# command to remove files recursively
+[[ -n "${ENCHANT_CMD_RM_RECURSE[@]}" ]] ||
+ ENCHANT_CMD_RM_RECURSE=(
+ "${ENCHANT_CMD_RM[@]}"
+ -r
+ )
+
+# command to remove files recursively forcefully
+[[ -n "${ENCHANT_CMD_RM_RECURSE_FORCE[@]}" ]] ||
+ ENCHANT_CMD_RM_RECURSE_FORCE=(
+ "${ENCHANT_CMD_RM_RECURSE[@]}"
+ -f
+ )
+
+[[ -n "${ENCHANT_CMD_SYMLINK[@]}" ]] ||
+ ENCHANT_CMD_SYMLINK=(
+ ln
+ -s
+ )
+
+[[ -n "${ENCHANT_CMD_SYMLINK_FORCE[@]}" ]] ||
+ ENCHANT_CMD_SYMLINK_FORCE=(
+ "${ENCHANT_CMD_SYMLINK[@]}"
+ -f
+ )
+
+[[ -n "${ENCHANT_CMD_HARDLINK[@]}" ]] ||
+ ENCHANT_CMD_HARDLINK=(
+ ln
+ )
+
+[[ -n "${ENCHANT_CMD_HARDLINK_FORCE[@]}" ]] ||
+ ENCHANT_CMD_HARDLINK_FORCE=(
+ "${ENCHANT_CMD_HARDLINK[@]}"
+ -f
+ )
+
+# command to mount a filesystem
+[[ -n "${ENCHANT_CMD_MOUNT[@]}" ]] ||
+ ENCHANT_CMD_MOUNT=(
+ mount
+ )
+
+# command to bind-mount a filesystem
+[[ -n "${ENCHANT_CMD_MOUNT_BIND[@]}" ]] ||
+ ENCHANT_CMD_MOUNT_BIND=(
+ "${ENCHANT_CMD_MOUNT[@]}"
+ --bind
+ )
+
+# command to loop-mount a filesystem
+[[ -n "${ENCHANT_CMD_MOUNT_LOOP[@]}" ]] ||
+ ENCHANT_CMD_MOUNT_LOOP=(
+ "${ENCHANT_CMD_MOUNT[@]}"
+ -o loop
+ )
+
+# command to unmount a filesystem
+[[ -n "${ENCHANT_CMD_UNMOUNT[@]}" ]] ||
+ ENCHANT_CMD_UNMOUNT=(
+ umount
+ )
+
+# command to create the ramdisk filesystem (typically ext2)
+[[ -n "${ENCHANT_CMD_MKRDFS[@]}" ]] ||
+ ENCHANT_CMD_MKRDFS=(
+ mke2fs
+ )
+
+# command to compress the iso ramdisk
+[[ -n "${ENCHANT_CMD_COMPRESS_RAMDISK[@]}" ]] ||
+ ENCHANT_CMD_COMPRESS_RAMDISK=(
+ gzip
+ -9
+ )
+
+# command to dump data
+[[ -n "${ENCHANT_CMD_DD[@]}" ]] ||
+ ENCHANT_CMD_DD=(
+ dd
+ )
+
+# command to concatenate a file
+[[ -n "${ENCHANT_CMD_CAT[@]}" ]] ||
+ ENCHANT_CMD_CAT=(
+ cat
+ )
+
+# command to package the iso initramfs
+[[ -n "${ENCHANT_CMD_MKRAMFS[@]}" ]] ||
+ ENCHANT_CMD_MKRAMFS=(
+ find * -depth -print \| cpio -H newc -o \| gzip -9c
+ )
+
+# command to find files
+[[ -n "${ENCHANT_CMD_FIND[@]}" ]] ||
+ ENCHANT_CMD_FIND=(
+ find
+ )
+
+# command to grep a file/stream
+[[ -n "${ENCHANT_CMD_GREP[@]}" ]] ||
+ ENCHANT_CMD_GREP=(
+ grep
+ )
+
+# command to grep a file/stream
+[[ -n "${ENCHANT_CMD_GREP_QUIET[@]}" ]] ||
+ ENCHANT_CMD_GREP_QUIET=(
+ grep
+ -q
+ )
+
+# command to split a text stream by delimiters
+[[ -n "${ENCHANT_CMD_CUT[@]}" ]] ||
+ ENCHANT_CMD_CUT=(
+ cut
+ )
+
+# command to awk a file/stream
+[[ -n "${ENCHANT_CMD_AWK[@]}" ]] ||
+ ENCHANT_CMD_AWK=(
+ gawk
+ )
+
+# command to sed a file/stream
+[[ -n "${ENCHANT_CMD_SED[@]}" ]] ||
+ ENCHANT_CMD_SED=(
+ sed
+ )
+
+# sorcery cast/dispel/rebuild commands
+[[ -n "${ENCHANT_CMD_CAST[@]}" ]] ||
+ ENCHANT_CMD_CAST=(
+ "$ENCHANT_HSORCERY_PATH/cast"
+ )
+[[ -n "${ENCHANT_CMD_DISPEL[@]}" ]] ||
+ ENCHANT_CMD_DISPEL=(
+ "$ENCHANT_HSORCERY_PATH/dispel"
+ )
+[[ -n "${ENCHANT_CMD_REBUILD[@]}" ]] ||
+ ENCHANT_CMD_REBUILD=(
+ "$ENCHANT_HSORCERY_PATH/sorcery"
+ rebuild
+ )
+[[ -n "${ENCHANT_CMD_GAZE_INSTALLED[@]}" ]] ||
+ ENCHANT_CMD_GAZE_INSTALLED=(
+ gaze -q installed
+ )
+
diff --git a/enchantment/data/config/default.conf
b/enchantment/data/config/default.conf
new file mode 100644
index 0000000..dd0a7aa
--- /dev/null
+++ b/enchantment/data/config/default.conf
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+source "$ENCHANT_CONF/paths.conf"
+source "$ENCHANT_CONF/kernel.conf"
+source "$ENCHANT_CONF/target.conf"
+
+source "$ENCHANT_CONF/display.conf"
+
+source "$ENCHANT_CONF/i18n.conf"
+source "$ENCHANT_CONF/potion.conf"
+source "$ENCHANT_CONF/spells.conf"
+source "$ENCHANT_CONF/sorcery.conf"
+
+source "$ENCHANT_CONF/commands.conf"
+
diff --git a/enchantment/data/config/display.conf
b/enchantment/data/config/display.conf
new file mode 100644
index 0000000..feef646
--- /dev/null
+++ b/enchantment/data/config/display.conf
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# whether to use color for displaying messages
+ENCHANT_COLOR="${ENCHANT_COLOR:-yes}"
+
diff --git a/enchantment/data/config/i18n.conf
b/enchantment/data/config/i18n.conf
new file mode 100644
index 0000000..411e607
--- /dev/null
+++ b/enchantment/data/config/i18n.conf
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# user-selected keymap
+ENCHANT_KEYMAP="${ENCHANT_KEYMAP:-$ENCHANT_TMP/i18n-keymap}"
+
diff --git a/enchantment/data/config/kernel.conf
b/enchantment/data/config/kernel.conf
new file mode 100644
index 0000000..e149966
--- /dev/null
+++ b/enchantment/data/config/kernel.conf
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# kernel version to use for installs
+ENCHANT_ISO_KVERS="${ENCHANT_ISO_KVERS:-$(uname -r)}"
+
+# kernel image to use for installs
+ENCHANT_ISO_KERNEL="${ENCHANT_ISO_KERNEL:-$ENCHANT_ISO_PATH/boot/vmlinux}"
+
+# path to the kernel modules to use for the install
+ENCHANT_ISO_KMODS="${ENCHANT_ISO_KMODS:-$ENCHANT_ISO_PATH/lib/modules}"
+
diff --git a/enchantment/data/config/modules.conf
b/enchantment/data/config/modules.conf
new file mode 100644
index 0000000..7362514
--- /dev/null
+++ b/enchantment/data/config/modules.conf
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# install module (step) info
+ENCHANT_STATUS="${ENCHANT_STATUS:-$ENCHANT_TMP/current_module}"
+
diff --git a/enchantment/data/config/paths.conf
b/enchantment/data/config/paths.conf
new file mode 100644
index 0000000..3a38e40
--- /dev/null
+++ b/enchantment/data/config/paths.conf
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# path to the ISO system (this should usually be null, unless
+# you are doing some tricky hacking)
+ENCHANT_ISO_PATH="${ENCHANT_ISO_PATH:-}"
+
+# path to the base library modules (libcolor, liberror, etc.)
+ENCHANT_BASE="${ENCHANT_BASE:-$ENCHANT_ISO_PATH/usr/share/smgl}"
+
+# path to the enchant library modules
+ENCHANT_LIBS="${ENCHANT_LIBS:-$ENCHANT_BASE/enchantment}"
+
+# where the installer files are located
+ENCHANT_DATA="${ENCHANT_DATA:-$ENCHANT_BASE/data}"
+
+# location of the install modules (steps)
+ENCHANT_MODULES="${ENCHANT_MODULES:-$ENCHANT_DATA/modules}"
+
+# location of installer documentation
+ENCHANT_DOCS="${ENCHANT_DOCS:-$ENCHANT_ISO_PATH/usr/share/doc/enchantment}"
+
+# temp directory used during the install
+ENCHANT_TMP="${ENCHANT_TMP:-$ENCHANT_ISO_PATH/tmp/enchantment}"
+
diff --git a/enchantment/data/config/potion.conf
b/enchantment/data/config/potion.conf
new file mode 100644
index 0000000..927853b
--- /dev/null
+++ b/enchantment/data/config/potion.conf
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# path where potion state data is stored (directory)
+ENCHANT_POTION="${ENCHANT_POTION:-$ENCHANT_TMP/potion}"
+
+# temporary files to represent the history buffers (backwards and fowards)
+ENCHANT_BACK="${ENCHANT_BACK:-$ENCHANT_POTION/back}"
+ENCHANT_FORWARD="${ENCHANT_FORWARD:-$ENCHANT_POTION/forward}"
+
+# size of each history buffer (forward, back)
+ENCHANT_POTION_BUFFER="${ENCHANT_POTION_BUFFER:-20}"
+
+# the hash function (binary) for hashing file contents to determine if a file
+# changed between installation modules
+# (defaults to sha1)
+ENCHANT_HASHFUNC="${ENCHANT_HASHFUNC:-$ENCHANT_ISO_PATH/bin/sha1sum}"
+
+# the archive utility used for archiving collections and directories into a
+# potion (defaults to tar)
+ENCHANT_ARCHIVE="${ENCHANT_ARCHIVE:-$ENCHANT_ISO_PATH/bin/tar}"
+
+# the compression function (binary) for compressing files (potion archives)
+# (defaults to gzip)
+ENCHANT_COMPRESS="${ENCHANT_COMPRESS:-$ENCHANT_ISO_PATH/bin/gzip}"
+
diff --git a/enchantment/data/config/sorcery.conf
b/enchantment/data/config/sorcery.conf
new file mode 100644
index 0000000..121b476
--- /dev/null
+++ b/enchantment/data/config/sorcery.conf
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# branch of sorcery to use in the ISO
+ENCHANT_SORCERY_BRANCH="${ENCHANT_SORCERY_BRANCH:-stable}"
+
+# ISO sorcery config path
+ENCHANT_SORCERY_CONFIG="${ENCHANT_SORCERY_CONFIG:-$ENCHANT_ISO_PATH/etc/sorcery/config}"
+
+# ISO sorcery lib/module path
+ENCHANT_SORCERY_LIBS="${ENCHANT_SORCERY_LIBS:-$ENCHANT_ISO_PATH/var/lib/sorcery/modules}"
+
diff --git a/enchantment/data/config/spells.conf
b/enchantment/data/config/spells.conf
new file mode 100644
index 0000000..42f8f6e
--- /dev/null
+++ b/enchantment/data/config/spells.conf
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# path to installable spell sources
+ENCHANT_SPELL_SOURCES="${ENCHANT_SPELL_SOURCES:-$ENCHANT_ISO_PATH/var/spool/sorcery}"
+
+# path to installable spell caches (pre-built binaries)
+ENCHANT_SPELL_CACHES="${ENCHANT_SPELL_CACHES:-$ENCHANT_ISO_PATH/var/cache/sorcery}"
+
+# file to hold sources selected for install
+ENCHANT_SOURCES_LIST="${ENCHANT_SOURCES_LIST:-$ENCHANT_TMP/spell-sources}"
+
+# file to hold caches selected for install
+ENCHANT_CACHES_LIST="${ENCHANT_CACHES_LIST:-$ENCHANT_TMP/spell-caches}"
+
+# ISO architecture/machine/host information (used to select caches when more
+# than one architecture is available for caches)
+ENCHANT_HOST_ARCH_PATH="${ENCHANT_HOST_ARCH_PATH:-$ENCHANT_ISO_PATH/usr/share/archspecs}"
+
+# list of archs available for install on this ISO, if undefined set to
+# the first entry in the archs file written by cauldron at generation
+ENCHANT_ARCH="${ENCHANT_ARCH:-$(head -n1 $ENCHANT_DATA/archs)}"
+ENCHANT_MACHTYPE="${ENCHANT_MACHTYPE:-$MACHTYPE}"
+ENCHANT_CACHE_EXT="${ENCHANT_CACHE_EXT:-tar.bz2}"
+
diff --git a/enchantment/data/config/target.conf
b/enchantment/data/config/target.conf
new file mode 100644
index 0000000..6b5281c
--- /dev/null
+++ b/enchantment/data/config/target.conf
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# where the target system is mounted
+ENCHANT_TARGET="${ENCHANT_TARGET:-$ENCHANT_ISO_PATH/mnt/root}"
+
+# absolute path to the file which the kernel should be installed as
+ENCHANT_TARGET_KERNEL="${ENCHANT_TARGET_KERNEL:-$ENCHANT_TARGET/boot/vmlinuz}"
+
+# path where kernel modules should be installed
+ENCHANT_TARGET_KMODS="${ENCHANT_TARGET_KMODS:-$ENCHANT_TARGET/lib/modules}"
+
+# path where spell sources will be installed
+ENCHANT_TARGET_SOURCES="${ENCHANT_TARGET_SOURCES:-$ENCHANT_TARGET/var/spool/sorcery}"
+
+# path where spell caches will be installed
+ENCHANT_TARGET_CACHES="${ENCHANT_TARGET_CACHES:-$ENCHANT_TARGET/var/cache/sorcery}"
+
diff --git a/enchantment/doc/enchantment.8 b/enchantment/doc/enchantment.8
index a70f9c9..5c9dc23 100644
--- a/enchantment/doc/enchantment.8
+++ b/enchantment/doc/enchantment.8
@@ -1,11 +1,11 @@
'\" t
.\" Title: enchantment
.\" Author: [see the "Authors" section]
-.\" Date: 07/06/2010
+.\" Date: 06/26/2011
.\" Manual: Enchantment Manual
.\" Language: English
.\"
-.\" Copyright 2010 by the Cauldron Team, Source Mage GNU/Linux
+.\" Copyright 2011 by the Cauldron Team, Source Mage GNU/Linux
.\" 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
@@ -20,7 +20,7 @@
.\" along with this software; if not, write to the Free Software
.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
.\"
-.TH "ENCHANTMENT" "8" "07/05/2010" "Source Mage GNU/Linux" "enchantment
manual"
+.TH "ENCHANTMENT" "8" "06/26/2011" "Source Mage GNU/Linux" "enchantment
manual"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -41,7 +41,7 @@

.SH "DESCRIPTION"

-Enchantment is a command-line front-end to the enchantment library (which
serves as a backend for all the Source Mage GNU/Linux front-ends, including
the menu system). All of the installation functions are accessible through
this single command-line frontend by passing the desired command as the first
parameter to the program, followed by any arguments that command needs.
+Enchantment is a command-line front-end to the enchantment library (which
serves as a backend for all the Source Mage GNU/Linux installer front-ends,
including the menu system). All of the installation functions are accessible
through this single command-line frontend by passing the desired command as
the first parameter to the program, followed by any arguments that command
needs.
.SH "ENCHANTMENT COMMANDS"
A list of acceptable commands is given below. For each command, if it can
accept any arguements, they are described in that command's section. Optional
arguments are enclosed in square brackets ('[' and ']'), while required
arguments are bare (not surrounded by brackets or anything else). The
commands are organized by logical function.
.SS General
@@ -54,7 +54,7 @@ Displays help for a given topic. If no topic is provided,
it will display a list
.PP
\fBtodo\fR [MODULE]
.RS 4
-If called without an argument, it displays the necessary procedures to
complete the current installation module. If the name of an installation
module, as listed by the \fBlist\fR command below, is provided as the only
argument, then it displays the necessary procedures for that given module,
rather than the current one.
+If called without an argument, it displays the necessary procedures to
complete the current installation module. If the name of an installation
module, as listed by the \fBlist\fR command below, is provided as an
argument, then it displays the necessary procedures for that given module,
rather than the current one.
.RE
.PP
\fBlist\fR
@@ -94,10 +94,10 @@ Performs a given installation, according to the supplied
SUBCOMMAND, which can b
.RE

.RS 4
-\fBkernel\fR KERNEL_IMAGE KERNEL_MODULES KERNEL_VERSION
+\fBkernel\fR IMAGE MODULES_PATH VERSION
.RE
.RS 8
-Installs the given kernel to the target as specified in \fIENCHANT_TARGET\fR
(see the section on \fBENVIRONMENT VARIABLES\fR below). The first argument,
KERNEL_IMAGE, must be an absolute path the to kernel image itself (i.e.
/boot/vmlinuz), which will be installed to \fIENCHANT_TARGET_KERNEL\fR (see
the section on \fBENVIRONMENT VARIABLES\fR below). The second argument,
KERNEL_MODULES, must be an aboslute path to the directory where the kernel
modules matching the image supplied in KERNEL_IMAGE are to be taken from
(e.g. /lib/modules/2.6.32.8). The kernel modules will be installed to
\fIENCHANT_TARGET_KMODS\fR (see the section on \fBENVIRONMENT VARIABLES\fR
below). Finally, KERNEL_VERSION, the third and last argument, must supply the
numbered kernel version associated with the kernel image and modules (e.g.
2.6.32.8).
+Installs the given kernel to the target as specified in \fIENCHANT_TARGET\fR
(see the section on \fBENVIRONMENT VARIABLES\fR below). The first argument,
IMAGE, must be an absolute path the to kernel image itself (i.e.
/boot/vmlinuz), which will be installed to \fIENCHANT_TARGET_KERNEL\fR (see
the section on \fBENVIRONMENT VARIABLES\fR below). The second argument,
MODULES_PATH, must be an aboslute path to the directory where the kernel
modules matching the image supplied in IMAGE are to be taken from (e.g.
/lib/modules/2.6.32.8). The kernel modules will be installed to
\fIENCHANT_TARGET_KMODS\fR (see the section on \fBENVIRONMENT VARIABLES\fR
below). Finally, VERSION, the third and last argument, must supply the
numbered kernel version associated with the kernel image and modules (e.g.
2.6.32.8).
.RE
.RS 4
\fBisokernel\fR
@@ -118,13 +118,13 @@ Installs the minimal base system (system.tar.bz2) to
the target specified in \fI
Installs the currently selected spells to the target specified in
\fIENCHANT_TARGET\fR (see the section on \fBENVIRONMENT VARIABLES\fR below).
.RE
.RS 4
-\fBsources\fR
+\fBsources\fR [SPELL1 [SPELL2] .. ]
.RE
.RS 8
Installs spell sources from \fIENCHANT_SPELL_SOURCES\fR to the target
location specified in \fIENCHANT_TARGET_SOURCES\fR (see the section on
\fBENVIRONMENT VARIABLES\fR below). If called with no arguments, it installs
the currently selected spell sources as given in \fIENCHANT_SOURCES_LIST\fR
(see the section on \fBENVIRONMENT VARIABLES\fR below). If called with
arguments, each argument is taken as the name of a spell whose sources are to
be installed.
.RE
.RS 4
-\fBcaches\fR
+\fBcaches\fR [SPELL1 [SPELL2] .. ]
.RE
.RS 8
Installs spell caches from \fIENCHANT_SPELL_CACHES\fR to the target location
specified in \fIENCHANT_TARGET_CACHES\fR (see the section on \fBENVIRONMENT
VARIABLES\fR below). If called with no arguments, it installs the currently
selected spell caches as given in \fIENCHANT_CACHES_LIST\fR (see the section
on \fBENVIRONMENT VARIABLES\fR below). If called with arguments, each
argument is taken as the name of a spell whose cache is to be installed.
@@ -152,7 +152,7 @@ Package the present installation state into a restorable
potion. This can then b
.PP
\fBkeymap\fR [/path/to/keymap.file]
.RS 4
-If called without an argument, presents a menu by which you can select an
appropriate keymap to use for the current installation session. If supplied a
keymap file (with path) as the only argument, it will directly select that
keymap to use for the installation session.
+If called without an argument, presents a menu by which you can select an
appropriate keymap to use for the current installation session. If supplied a
keymap file (with path) as an argument, it will directly select that keymap
to use for the installation session.
.RE
.SS "Setup"
.PP
@@ -221,6 +221,11 @@ Various enchantment commands use the following
user-level environment variables.
This represents where the iso is running from. Unless you know what you are
doing and you want to do some really tricky hacking with the installation, it
is highly recommended that you leave this at the default setting.
.RE
.PP
+\fIENCHANT_TMP\fR [$\fIENCHANT_ISO_PATH\fR/tmp/enchantment]
+.RS 4
+Path to where all the in-process enchantment processing is contained. This
is essentially the top-level temp directory enchantment will use to store all
the state-tracking information generated during the course of the
installation.
+.RE
+.PP
\fIENCHANT_SPELL_SOURCES\fR [$\fIENCHANT_ISO_PATH\fR/var/spool/sorcery]
.RS 4
Path where spell sources should be taken from to install into the target.
@@ -246,17 +251,6 @@ Path where spell sources should be installed to within
the target. Normally you
.RS 4
Path where spell caches should be installed to within the target. Normally
you should not change this.
.RE
-.SS "Target Kernel"
-.PP
-\fIENCHANT_TARGET_KERNEL\fR [$\fIENCHANT_TARGET\fR/boot/vmlinuz]
-.RS 4
-Absolute path (including file name) of where the kernel image will be
installed to in the target.
-.RE
-.PP
-\fIENCHANT_TARGET_KMODS\fR [$\fIENCHANT_TARGET\fR/lib/modules]
-.RS 4
-Absolute path to the base directory of where the kernel modules will be
installed to in the target. You normally shouldn't change this setting unless
you have a good reason to and you know what you are doing.
-.RE
.SS "Source Kernel"
.PP
\fIENCHANT_ISO_KVERS\fR [$(uname -r)]
@@ -273,6 +267,17 @@ The kernel image which the installation (not the target)
is running.
.RS 4
The kernel modules which the installation (not the target) is running,
corresponding to the kernel image and version given in
\fIENCHANT_ISO_KVERS\fR and \fIENCHANT_ISO_KERNEL\fR.
.RE
+.SS "Target Kernel"
+.PP
+\fIENCHANT_TARGET_KERNEL\fR [$\fIENCHANT_TARGET\fR/boot/vmlinuz]
+.RS 4
+Absolute path (including file name) of where the kernel image will be
installed to in the target.
+.RE
+.PP
+\fIENCHANT_TARGET_KMODS\fR [$\fIENCHANT_TARGET\fR/lib/modules]
+.RS 4
+Absolute path to the base directory of where the kernel modules will be
installed to in the target. You normally shouldn't change this setting unless
you have a good reason to and you know what you are doing.
+.RE
.SS "Chroot Command"
.PP
\fIENCHANT_CHROOT\fR [$\fIENCHANT_ISO_PATH\fR/bin/chroot]
diff --git a/enchantment/etc/enchantment.conf
b/enchantment/etc/enchantment.conf
index 108a3fd..3a046e7 100644
--- a/enchantment/etc/enchantment.conf
+++ b/enchantment/etc/enchantment.conf
@@ -1,97 +1,7 @@
#!/bin/bash

- # path to the ISO system (this should usually be null, unless
- # you are doing some tricky hacking)
- ENCHANT_ISO_PATH="${ENCHANT_ISO_PATH:-}"
-
- # path to the enchant library modules
- ENCHANT_BASE="${ENCHANT_BASE:-$ENCHANT_ISO_PATH/var/lib/cauldron}"
- ENCHANT_LIBS="${ENCHANT_LIBS:-$ENCHANT_BASE/enchantment}"
-
- # where the installer files are located
-
ENCHANT_DATA="${ENCHANT_DATA:-$ENCHANT_ISO_PATH/usr/share/enchantment}"
- # location of the install modules (steps)
- ENCHANT_MODULES="${ENCHANT_MODULES:-$ENCHANT_DATA/modules}"
- # location of installer documentation
-
ENCHANT_DOCS="${ENCHANT_DOCS:-$ENCHANT_ISO_PATH/usr/share/doc/enchantment}"
-
- # temp directory used during the install
- ENCHANT_TMP="${ENCHANT_TMP:-$ENCHANT_ISO_PATH/tmp/enchantment}"
-
- # path where potion state data is stored
- ENCHANT_POTION="${ENCHANT_POTION:-$ENCHANT_TMP/potion}"
-
- # where the target system is mounted
- ENCHANT_TARGET="${ENCHANT_TARGET:-$ENCHANT_ISO_PATH/mnt/root}"
-
- # absolute path to the file which the kernel should be installed as
-
ENCHANT_TARGET_KERNEL="${ENCHANT_TARGET_KERNEL:-$ENCHANT_TARGET/boot/vmlinuz}"
- # path where kernel modules should be installed
- ENCHANT_TARGET_KMODS="${ENCHANT_TARGET_KMODS:-$ENCHANT_TARGET/lib/modules}"
-
-# path where spell sources will be installed
-ENCHANT_TARGET_SOURCES="${ENCHANT_TARGET_SOURCES:-$ENCHANT_TARGET/var/spool/sorcery}"
- # path where spell caches will be installed
-
ENCHANT_TARGET_CACHES="${ENCHANT_TARGET_CACHES:-$ENCHANT_TARGET/var/cache/sorcery}"
-
- # command to chroot to ENCHANT_TARGET
- ENCHANT_CHROOT="${ENCHANT_CHROOT:-$ENCHANT_ISO_PATH/bin/chroot}"
-
- # path to installable spell sources
-
ENCHANT_SPELL_SOURCES="${ENCHANT_SPELL_SOURCES:-$ENCHANT_ISO_PATH/var/spool/sorcery}"
- # path to installable spell caches (pre-built binaries)
-
ENCHANT_SPELL_CACHES="${ENCHANT_SPELL_CACHES:-$ENCHANT_ISO_PATH/var/cache/sorcery}"
- # file to hold sources selected for install
- ENCHANT_SOURCES_LIST="${ENCHANT_SOURCES_LIST:-$ENCHANT_TMP/spell-sources}"
- # file to hold caches selected for install
- ENCHANT_CACHES_LIST="${ENCHANT_CACHES_LIST:-$ENCHANT_TMP/spell-caches}"
-
- # install module (step) info
- ENCHANT_STATUS="${ENCHANT_STATUS:-$ENCHANT_TMP/current_module}"
-
- # user-selected keymap
- ENCHANT_KEYMAP="${ENCHANT_KEYMAP:-$ENCHANT_TMP/i18n-keymap}"
-
- # install module history settings
- ENCHANT_HISTORY="${ENCHANT_HISTORY:-$ENCHANT_TMP/history}"
- ENCHANT_BACK="${ENCHANT_BACK:-$ENCHANT_HISTORY/back}"
- ENCHANT_FORWARD="${ENCHANT_FORWARD:-$ENCHANT_HISTORY/forward}"
- # size of history buffers, total size = $ENCHANT_HISTORY * 2 = (back +
forward)
- ENCHANT_HISTORY_SIZE="${ENCHANT_HISTORY_SIZE:-20}"
-
- # path where potion state data is stored
- ENCHANT_HASHFUNC="${ENCHANT_HASHFUNC:-$ENCHANT_ISO_PATH/bin/sha1sum}"
-
- # path where potion state data is stored
- ENCHANT_ARCHIVE="${ENCHANT_ARCHIVE:-$ENCHANT_ISO_PATH/bin/tar}"
- # path where potion state data is stored
- ENCHANT_COMPRESS="${ENCHANT_COMPRESS:-$ENCHANT_ISO_PATH/bin/gzip}"
-
- # whether to use color for displaying messages
- ENCHANT_COLOR="${ENCHANT_COLOR:-yes}"
-
- # kernel version to use for installs
- ENCHANT_ISO_KVERS="${ENCHANT_ISO_KVERS:-$(uname -r)}"
- # kernel image to use for installs
-
ENCHANT_ISO_KERNEL="${ENCHANT_ISO_KERNEL:-$ENCHANT_ISO_PATH/boot/vmlinux}"
- # path to the kernel modules to use for the install
- ENCHANT_ISO_KMODS="${ENCHANT_ISO_KMODS:-$ENCHANT_ISO_PATH/lib/modules}"
-
-# branch of sorcery to use in the ISO
-ENCHANT_SORCERY_BRANCH="${ENCHANT_SORCERY_BRANCH:-stable}"
-
-# ISO sorcery config paths
-ENCHANT_SORCERY_CONFIG="${ENCHANT_SORCERY_CONFIG:-$ENCHANT_ISO_PATH/etc/sorcery/config}"
-
ENCHANT_SORCERY_LIBS="${ENCHANT_SORCERY_LIBS:-$ENCHANT_ISO_PATH/var/lib/sorcery/modules}"
-
-# ISO architecture/machine/host information (used to select caches when more
-# than one architecture is available for caches)
-ENCHANT_HOST_ARCH_PATH="${ENCHANT_HOST_ARCH_PATH:-$ENCHANT_ISO_PATH/usr/share/archspecs}"
- # list of archs available for install on this ISO, if undefined
set to
- # the first entry in the archs file written by cauldron at
generation
- ENCHANT_ARCH="${ENCHANT_ARCH:-$(head -n1 $ENCHANT_DATA/archs)}"
- ENCHANT_MACHTYPE="${ENCHANT_HOST_ARCH:-$MACHTYPE}"
- ENCHANT_CACHE_EXT="${ENCHANT_CACHE_EXT:-tar.bz2}"
+ENCHANT_CONF="/usr/share/smgl/enchantment/config"

+source "$ENCHANT_CONF/default.conf"

# vim:ai:tw=80:tabstop=2:softtabstop=2:shiftwidth=2:expandtab
diff --git a/enchantment/lib/errorcodes b/enchantment/lib/errorcodes
index 1ab9dd5..eb5b0aa 100644
--- a/enchantment/lib/errorcodes
+++ b/enchantment/lib/errorcodes
@@ -37,10 +37,6 @@ liberror_add_error ERR_SET_CURRENT "could not set current
module"
liberror_add_error ERR_SET_NEXT "could not set next module"
liberror_add_error ERR_SET_PREV "could not set previous module"

-# history
-liberror_add_error ERR_HISTORY_BACK "could not go back in install history"
-liberror_add_error ERR_HISTORY_FORWARD "could not go forward in install
history"
-
# lib.chroot
liberror_add_error ERR_CHROOT_INIT "could not initialized chroot"
liberror_add_error ERR_CHROOT_NOT_INIT "chroot not initialized"
@@ -74,6 +70,10 @@ liberror_add_error ERR_MODULE_ENTER "could not process
module entry"
liberror_add_error ERR_MODULE_EXIT "could not process module exit"
liberror_add_error ERR_MODULE_GET_NUM "could not get number of current
module"

+# history
+liberror_add_error ERR_HISTORY_BACK "could not go back in install history"
+liberror_add_error ERR_HISTORY_FORWARD "could not go forward in install
history"
+
# lib.potion
liberror_add_error ERR_POTION_DIR "potion directory not found"
liberror_add_error ERR_POTION_GET_HASHSUM "could not read hashsum of file"
@@ -102,7 +102,8 @@ liberror_add_error ERR_POTION_UPDATE_CONFS \
"could not update target system configs"
liberror_add_error ERR_POTION_UPDATE_FILESYSTEMS "could not update
filesystems"
liberror_add_error ERR_POTION_UPDATE_KERNEL "could not update kernel config"
-liberror_add_error ERR_POTION_UPDATE_MOUNT_POINTS "could not update mount
points"
+liberror_add_error ERR_POTION_UPDATE_MOUNT_POINTS \
+ "could not update mount points"
liberror_add_error ERR_POTION_UPDATE_SOURCES \
"could not update spell sources selection"
liberror_add_error ERR_POTION_UPDATE_CACHES \
@@ -111,7 +112,8 @@ liberror_add_error ERR_POTION_UPDATE_PARTITIONS "could
not update partitions"
liberror_add_error ERR_POTION_UPDATE_USERS "could not update user/group
config"

# installer
-liberror_add_error ERR_INSTALLER_FUNCS "could not load \$ENCHANT_INSTALLER
functions file"
+liberror_add_error ERR_INSTALLER_FUNCS \
+ "could not load \$ENCHANT_INSTALLER functions file"
liberror_add_error ERR_INSTALLER_CMD "incorrect usage or unrecognized
command"
liberror_add_error ERR_INSTALLER_KEYMAP "could not process keymap list"
liberror_add_error ERR_INSTALLER_MODULES "could not process module list"
diff --git a/enchantment/lib/lib.potion b/enchantment/lib/lib.potion
index 11f365b..ca28045 100644
--- a/enchantment/lib/lib.potion
+++ b/enchantment/lib/lib.potion
@@ -216,7 +216,7 @@ function enchant_potion_update_partitions() {
# differs from what we currently have, then store the current set
if [[ ! -f "$potion_parts" || "$(cat $potion_parts)" != "$(cat $parts)" ]]
then
- cp -f "$parts" > "$potion_parts" || return $ERR_POTION_CHK_PARTITIONS
+ cp -f "$parts" > "$potion_parts" || return $ERR_POTION_UPDATE_PARTITIONS
fi

return $ERR_OK
@@ -265,7 +265,7 @@ function enchant_potion_update_filesystems() {
# differs from what we currently have, then store the current set
if [[ ! -f "$potion_fs" || "$(cat $potion_fs)" != "$(cat $fs)" ]]
then
- cp -f "$fs" > "$potion_fs" || return $ERR_POTION_CHK_FILESYSTEMS
+ cp -f "$fs" > "$potion_fs" || return $ERR_POTION_UPDATE_FILESYSTEMS
fi

return $ERR_OK
@@ -315,7 +315,7 @@ function enchant_potion_update_mount_points() {
# differs from what we currently have, then store the current set
if [[ ! -f "$potion_mounts" || "$(cat $potion_mounts)" != "$(cat $mounts)"
]]
then
- cp -f "$mounts" > "$potion_mounts" || return $ERR_POTION_CHK_MOUNT_POINTS
+ cp -f "$mounts" > "$potion_mounts" || return
$ERR_POTION_UPDATE_MOUNT_POINTS
fi

return $ERR_OK
@@ -334,7 +334,8 @@ function enchant_potion_update_kernel_config() {

[[ -f "$kernel_config" ]] || return $ERR_FILE_NOT_FOUND

- enchant_potion_cache_file "$kernel_config" "$potion" || return
$ERR_POTION_CACHE_FILE
+ enchant_potion_cache_file "$kernel_config" "$potion" ||
+ return $ERR_POTION_CACHE_FILE

return $ERR_OK
}
@@ -366,7 +367,25 @@ function enchant_potion_update_kernel() {

#-------------------------------------------------------------------------------
function enchant_potion_update_spell_sources() {
local potion="${1:-$ENCHANT_POTION_CURRENT}"
- local spells="$ENCHANT_TMP/spells"
+ local spells="$ENCHANT_TMP/sources"
+
+ [[ -f "$spells" ]] || return $ERR_FILE_NOT_FOUND
+
+ enchant_potion_cache_file "$spells" "$potion" || return
$ERR_POTION_CACHE_FILE
+
+ return $ERR_OK
+}
+
+#-------------------------------------------------------------------------------
+## @param potion directory name (relative to $ENCHANT_POTION/) [optional]
+##
+## Checks which optional spell caches the user has chosen to install, and
+## updates the state cache if the list changed.
+##
+#-------------------------------------------------------------------------------
+function enchant_potion_update_spell_caches() {
+ local potion="${1:-$ENCHANT_POTION_CURRENT}"
+ local spells="$ENCHANT_TMP/caches"

[[ -f "$spells" ]] || return $ERR_FILE_NOT_FOUND

@@ -388,7 +407,8 @@ function enchant_potion_update_bootloader() {

[[ -f "$bootloaders" ]] || return $ERR_FILE_NOT_FOUND

- enchant_potion_cache_file "$bootloaders" "$potion" || return
$ERR_POTION_CACHE_FILE
+ enchant_potion_cache_file "$bootloaders" "$potion" ||
+ return $ERR_POTION_CACHE_FILE

return $ERR_OK
}
@@ -446,14 +466,24 @@ function enchant_potion_update_users() {
function enchant_potion_update() {
local potion="${1:-$ENCHANT_POTION_CURRENT}"

- enchant_potion_update_partitions "$potion" || return
$ERR_POTION_CHK_PARTITIONS
- enchant_potion_update_filesystems "$potion" || return
$ERR_POTION_CHK_FILESYSTEMS
- enchant_potion_update_mount_points "$potion" || return
$ERR_POTION_CHK_MOUNT_POINTS
- enchant_potion_update_opt_spells "$potion" || return
$ERR_POTION_CHK_OPT_SPELLS
- enchant_potion_update_kernel "$potion" || return $ERR_POTION_CHK_KERNEL
- enchant_potion_update_bootloader "$potion" || return
$ERR_POTION_CHK_BOOTLOADER
- enchant_potion_update_confs "$potion" || return $ERR_POTION_CHK_CONFS
- enchant_potion_update_users "$potion" || return $ERR_POTION_CHK_USERS
+ enchant_potion_update_partitions "$potion" ||
+ return $ERR_POTION_UPDATE_PARTITIONS
+ enchant_potion_update_filesystems "$potion" ||
+ return $ERR_POTION_UPDATE_FILESYSTEMS
+ enchant_potion_update_mount_points "$potion" ||
+ return $ERR_POTION_UPDATE_MOUNT_POINTS
+ enchant_potion_update_spell_sources "$potion" ||
+ return $ERR_POTION_UPDATE_SOURCES
+ enchant_potion_update_spell_caches "$potion" ||
+ return $ERR_POTION_UPDATE_CACHES
+ enchant_potion_update_kernel "$potion" ||
+ return $ERR_POTION_UPDATE_KERNEL
+ enchant_potion_update_bootloader "$potion" ||
+ return $ERR_POTION_UPDATE_BOOTLOADER
+ enchant_potion_update_confs "$potion" ||
+ return $ERR_POTION_UPDATE_CONFS
+ enchant_potion_update_users "$potion" ||
+ return $ERR_POTION_UPDATE_USERS

return $ERR_OK
}
@@ -553,6 +583,7 @@ function enchant_potion_quaff() {
then
current="0"
elif [[ "$current" = [a-z]* ]]
+ then
current="$(grep -n $current $ENCHANT_DATA/modules | cut -d: -f1)"
fi

diff --git a/enchantment/lib/libenchantment b/enchantment/lib/libenchantment
index f6e6d5c..7f0ae4c 100755
--- a/enchantment/lib/libenchantment
+++ b/enchantment/lib/libenchantment
@@ -29,7 +29,7 @@
export LC_COLLATE="C"

# shorthand and non-hardcoded /dev/null for output dumping
-ENCHANT_NULL="${ENCHANTMENT_NULL:-/dev/null}"
+ENCHANT_NULL="${ENCHANT_NULL:-/dev/null}"


#-------------------------------------------------------------------------------
##
@@ -75,7 +75,7 @@ function enchant_load_library() {
local lib="$1"

. "$ENCHANT_LIBS/$lib" 2>$ENCHANT_NULL
- liberror_check_fatal
+ liberror_check_fatal "cannot load library $lib"
}


#-------------------------------------------------------------------------------
@@ -102,7 +102,7 @@ function enchant_prepare() {
echo 'init' > "$ENCHANT_STATUS" || return $ERR_PREPARE

# the next lines are to init the history files
- mkdir -p "$ENCHANT_TMP/history" || return $ERR_PREPARE
+ mkdir -p "$ENCHANT_POTION" || return $ERR_PREPARE
cat < $ENCHANT_NULL > "$ENCHANT_BACK" || return $ERR_PREPARE
cat < $ENCHANT_NULL > "$ENCHANT_FORWARD" || return $ERR_PREPARE

@@ -121,6 +121,21 @@ function enchant_cleanup() {
}


#-------------------------------------------------------------------------------
+## @param color state [yes or no] (optional)
+##
+## Wrapper function that handles setting the color state in libcolor.
Possible
+## values for the color state parameter are 'yes' or 'no' (without the
quotes).
+## If the parameter isn't supplied, then it defaults to whatever
ENCHANT_COLOR
+## is set to.
+##
+#-------------------------------------------------------------------------------
+function enchant_color() {
+ local color="${1:-$ENCHANT_COLOR}"
+
+ [ "$1" = "no" ] && LIBCOLOR_NOCOLOR="yes"
+}
+
+#-------------------------------------------------------------------------------
##
## Determines and returns the current module in the installation procedure.
##
@@ -153,7 +168,7 @@ function enchant_set_current() {
enchant_modules_exit || return $ERR_MODULE_EXIT

# if the max history size has been reached, then we drop the oldest item
- if [[ "$(wc -l < $ENCHANT_BACK)" -ge "$ENCHANT_HISTORY_SIZE" ]]
+ if [[ "$(wc -l < $ENCHANT_BACK)" -ge "$ENCHANT_POTION_BUFFER" ]]
then
sed -i '1d' "$ENCHANT_BACK" || return $ERR_SET_CURRENT
fi
@@ -162,7 +177,7 @@ function enchant_set_current() {
echo "$module" >> "$ENCHANT_BACK" || return $ERR_SET_CURRENT

# check the installation state
- enchant_potion_update || return $ERR_POTION_UPDATE
+ enchant_potion_update || return $?

# set the current module
echo "$module" > "$ENCHANT_STATUS" || return $ERR_SET_CURRENT
@@ -267,7 +282,7 @@ function enchant_back() {
[[ "$(wc -l < $ENCHANT_BACK)" -eq 0 ]] && return $ERR_HISTORY_BACK

# if the max forward history size has been reached
- if [[ "$(wc -l < $ENCHANT_FORWARD)" -ge "$ENCHANT_HISTORY_SIZE" ]]
+ if [[ "$(wc -l < $ENCHANT_FORWARD)" -ge "$ENCHANT_POTION_BUFFER" ]]
then
# then we drop the oldest item from the forward history
sed -i '1d' "$ENCHANT_FORWARD" || return $ERR_HISTORY_BACK
@@ -299,7 +314,7 @@ function enchant_forward() {
[[ "$(wc -l < $ENCHANT_FORWARD)" -eq 0 ]] && return $ERR_HISTORY_FORWARD

# if the max back history size has been reached
- if [[ "$(wc -l < $ENCHANT_BACK)" -ge "$ENCHANT_HISTORY_SIZE" ]]
+ if [[ "$(wc -l < $ENCHANT_BACK)" -ge "$ENCHANT_POTION_BUFFER" ]]
then
# then we drop the oldest item from the back history
sed -i '1d' "$ENCHANT_BACK" || return $ERR_HISTORY_FORWARD
diff --git a/enchantment/shell/bin/enchantment
b/enchantment/shell/bin/enchantment
index 2cd9b17..b269821 100755
--- a/enchantment/shell/bin/enchantment
+++ b/enchantment/shell/bin/enchantment
@@ -21,8 +21,10 @@
# let libenchantment know which installer this is
ENCHANT_INSTALLER="shell"

+CONFIG="${CONFIG:-/etc/enchantment/enchantment.conf}"
+
# source configs and libenchantment
-. "/etc/enchantment/enchantment.config"
+. "$CONFIG"

# load the main library (which in turn loads sub-libraries)
if ! . "$ENCHANT_LIBS/libenchantment"
@@ -32,8 +34,10 @@ then
fi

# source installer-specific functions
-[[ -f "$ENCHANT_DATA/$ENCHANT_INSTALLER/functions" ]] ||
- liberror_die $ERR_INSTALLER_FUNCS
+source "$ENCHANT_DATA/$ENCHANT_INSTALLER/functions" ||
+ liberror_die \
+ $ERR_INSTALLER_FUNCS \
+ "cannot load $ENCHANT_INSTALLER functions file"



#------------------------------------------------------------------------------
diff --git a/enchantment/shell/functions b/enchantment/shell/functions
index 12d3d82..5ff703a 100644
--- a/enchantment/shell/functions
+++ b/enchantment/shell/functions
@@ -186,9 +186,9 @@ function enchant_shell_perform_help() {
then
libcolor_warn "No installer help for '$1'"
echo ""
+ else
+ return $ERR_FILE_NOT_FOUND
fi
- else
- return $ERR_FILE_NOT_FOUND
fi

enchant_shell_header || return $ERR_FILE_NOT_FOUND
diff --git a/ward/functions b/ward/functions
index d5348d2..3aea906 100755
--- a/ward/functions
+++ b/ward/functions
@@ -46,7 +46,7 @@ if [[ "$1" == "-n" ]]
then
if [[ "$#" -gt 1 ]]
then
- LIBCOLOR_NOCOLOR="yes"
+ ward_color "no"
shift
else
ward_usage
diff --git a/ward/global_variables b/ward/global_variables
index f40ba97..92d2538 100755
--- a/ward/global_variables
+++ b/ward/global_variables
@@ -45,7 +45,7 @@ if [[ "$1" == "-n" ]]
then
if [[ "$#" -gt 1 ]]
then
- LIBCOLOR_NOCOLOR="yes"
+ ward_color "no"
shift
else
ward_usage
diff --git a/ward/libward b/ward/libward
index 0d6036a..0c24d3c 100644
--- a/ward/libward
+++ b/ward/libward
@@ -48,8 +48,16 @@ function ward_fatal_error() {

unset ward_fatal_error

-# test/set whether color output should be enabled
-[[ $WARD_COLOR != "yes" ]] && LIBCOLOR_NOCOLOR="yes"
+#-------------------------------------------------------------------------------
+## @param color state (yes or no)
+##
+## Wrapper function that handles setting the color state in libcolor.
Possible
+## values for the color state parameter are 'yes' or 'no' (without the
quotes).
+##
+#-------------------------------------------------------------------------------
+function ward_color() {
+ [ "$1" = "no" ] && LIBCOLOR_NOCOLOR="yes"
+}


#-------------------------------------------------------------------------------
## @param library name to load (no path, just basename)
diff --git a/ward/ward-all b/ward/ward-all
index 4ae1fc7..69d0991 100755
--- a/ward/ward-all
+++ b/ward/ward-all
@@ -29,7 +29,7 @@ for tester in "${TESTERS[@]}"
do
echo ""
echo "RUNNING: $tester"
- $tester
+ $tester "$@"
done | $PAGER


#-------------------------------------------------------------------------------
diff --git a/ward/ward-configvars b/ward/ward-configvars
index cd6a4fa..bee762b 100755
--- a/ward/ward-configvars
+++ b/ward/ward-configvars
@@ -47,7 +47,7 @@ do
case "$1" in
# check if color should be disabled
"-n")
- LIBCOLOR_NOCOLOR="yes"
+ ward_color "no"
;;
# check if the user only wants to process cauldron
"cauldron")
@@ -87,7 +87,7 @@ then
ward_get_sources "enchantment_sources"
enchantment="$WARD_PATH/../enchantment"
e_conf="$enchantment/etc/enchantment.conf"
- ENCHANTMENT_CONF="$enchantment/config"
+ ENCHANT_CONF="$enchantment/data/config"

# check enchantment files
libcolor_notice "Checking enchantment config variables"
diff --git a/ward/ward-errorcodes b/ward/ward-errorcodes
index 9eff32f..11c0c2a 100755
--- a/ward/ward-errorcodes
+++ b/ward/ward-errorcodes
@@ -45,7 +45,7 @@ do
case "$1" in
# check if color should be disabled
"-n")
- LIBCOLOR_NOCOLOR="yes"
+ ward_color "no"
;;
# check if the user only wants to process cauldron
"cauldron")
diff --git a/ward/ward-functions b/ward/ward-functions
index 34563f8..f3dd185 100755
--- a/ward/ward-functions
+++ b/ward/ward-functions
@@ -60,7 +60,7 @@ do
case "$1" in
# check if color should be disabled
"-n")
- LIBCOLOR_NOCOLOR="yes"
+ ward_color "no"
;;
# check if the user only wants to process cauldron
"cauldron")



  • [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (6bcf47bee9b9f60093ffe9b6322f5a504896b97b), Justin Boffemmyer, 06/28/2011

Archive powered by MHonArc 2.6.24.

Top of Page