New commits:
commit 9c66ae11c4247e990dce47d5a059c5a6bac5104c
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
scripts/spellcaster.sh: fix cleanup procedure
The cleanup code wasn't referencing the TARGET directory for the kernel
config file to remove, but instead was based on $CWD. The code was
also failing to remove some files that it should have been removing.
commit 2b44e21be0f5062d5a3c78721c218e41908dd2bf
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
scripts/spellcaster.sh: remove trailing '/'
Remove the trailing '/' from directory variables if present. This may
not be essential, but is more correct.
commit 2ae80fb2b3ee94ba70f82850c8ac54e69c09ee76
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
scripts/spellcaster.sh: create missing dirs
If the ISO or SYS dirs don't exist, create them before attempting to do
anything with them. Also, exit with error if TARGET isn't a valid
directory.
diff --git a/scripts/spellcaster.sh b/scripts/spellcaster.sh
index 01cd42c..83abc96 100755
--- a/scripts/spellcaster.sh
+++ b/scripts/spellcaster.sh
@@ -40,8 +40,8 @@ function parse_options() {
while getopts ":cdh" Option
do
case $Option in
- i ) ISODIR="$OPTARG" ;;
- s ) SYSDIR="$OPTARG" ;;
+ i ) ISODIR="${OPTARG%/}" ;;
+ s ) SYSDIR="${OPTARG%/}" ;;
h ) usage ;;
* ) echo "Unrecognized option." >&2 && usage ;;
esac
@@ -70,6 +70,15 @@ function sanity_check() {
local arch=
local choice=
+ # Ensure that TARGET is a directory
+ [[ -d "$TARGET" ]] || exit 3
+
+ # If ISODIR is not a directory, create it.
+ [[ ! -d "$ISODIR" ]] && mkdir -p "$ISODIR" || exit 3
+
+ # If SYSDIR is not a directory, create it.
+ [[ ! -d "$SYSDIR" ]] && mkdir -p "$SYSDIR" || exit 3
+
if [[ -e "$config" ]]
then
arch="$(source "$config" && echo $ARCHIVE)"
@@ -171,10 +180,11 @@ OPTIONAL
}
function clean_target() {
- local config="etc/sorcery/local/kernel.config"
+ local config="$TARGET/etc/sorcery/local/kernel.config"