Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (065d93d3de59362ba0643d22d8cc59ae09843af7)

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 test cauldron by Justin Boffemmyer (065d93d3de59362ba0643d22d8cc59ae09843af7)
  • Date: Sun, 19 Oct 2008 20:47:34 -0500

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

data/ospells.x86 | 36 ++++
data/rspells.x86 | 63 +++++++
iso/usr/share/doc/smgl.install/steps/extra-spells | 14 +
iso/usr/share/doc/smgl.install/steps/install-opt-spells | 5
iso/usr/share/smgl.install/smgl-spellcaster | 141
++++++++++++++++
scripts/spellcaster.sh | 96 ++++++++++
6 files changed, 350 insertions(+), 5 deletions(-)

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

data/[or]spells.x86: spellcaster.sh data files

These files list the optional and required spells to be put onto an
ISO, respectively.

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

scripts/spellcaster.sh: cast spells into chroot

Casts the required and optional ISO spells into the chroot of your
choice (arg 1).

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

implemented optional spell installation

Optional spells can now be installed in the install by calling
smgl-spellcaster. This script uses sorcery caches to install spells.
It presents a menu of all the caches it finds on the ISO, and the user
can toggle caches to be installed. Then it installs from the selected
list. It also remembers what spells were selected during the install
session (via the /tmp/spells file). This same mechanism allows us to
ship an ISO with a default selection of spells. Currently the script
makes a lot of assumptions and isn't that clever, but it will be
improved on in later versions.

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

steps/install-opt-spells: renamed to extra-spells

diff --git a/data/ospells.x86 b/data/ospells.x86
new file mode 100644
index 0000000..bfd74d2
--- /dev/null
+++ b/data/ospells.x86
@@ -0,0 +1,36 @@
+device-mapper
+dhcpcd
+e2fsprogs
+ed
+eject
+elvis
+g++
+gpm
+grub
+hdparm
+ifupdown
+jed
+jfsutils
+libaal
+lilo
+lvm
+lynx
+madwifi
+mdadm
+memtest86+
+ndiswrapper
+nfs-utils
+openssl
+parted
+pciutils
+pcmciautils
+ppp
+reiser4progs
+reiserfsprogs
+rp-pppoe
+rpmunpack
+sysfsutils
+tcp_wrappers
+udev
+wireless_tools
+xfsprogs
diff --git a/data/rspells.x86 b/data/rspells.x86
new file mode 100644
index 0000000..f39987d
--- /dev/null
+++ b/data/rspells.x86
@@ -0,0 +1,63 @@
+autoconf
+automake
+basesystem
+bash
+bin86
+binutils
+bison
+bzip2
+coreutils
+cpio
+dialog
+diffutils
+file
+findutils
+flex
+gawk
+gcc
+gettext
+glibc
+gnupg
+grep
+groff
+gzip
+iana-etc
+init.d
+installwatch
+kbd
+less
+libidn
+libpcap
+libtool
+locale
+m4
+make
+man
+module-init-tools
+nano
+ncurses
+net-tools
+netkit-base
+netkit-ping
+patch
+perl
+popt
+portmap
+procps
+readline
+run-parts
+sed
+shadow
+simpleinit-msb
+slang
+smgl-archspecs
+smgl-fhs
+sorcery-pubkeys
+tar
+texinfo
+unzip
+util-linux
+uudeview
+wget
+which
+zlib
diff --git a/iso/usr/share/doc/smgl.install/steps/extra-spells
b/iso/usr/share/doc/smgl.install/steps/extra-spells
new file mode 100644
index 0000000..a7579ba
--- /dev/null
+++ b/iso/usr/share/doc/smgl.install/steps/extra-spells
@@ -0,0 +1,14 @@
+extra-spells step
+At this point, you may install any extra spells you desire. These
+exist as bzip2-compressed tarballs (sorcery caches). You can either
+install these manually, or run the following script to do it for you.
+If you mounted your harddisk to a location other than /mnt/root, then
+you can specify that location as an argument to the script.
+
+Using default location:
+ smgl-spellcaster
+
+Example for some other location:
+ smgl-spellcaster /mnt/some-dir
+
+When you are finished, type next to go to the next step.
diff --git a/iso/usr/share/doc/smgl.install/steps/install-opt-spells
b/iso/usr/share/doc/smgl.install/steps/install-opt-spells
deleted file mode 100644
index d095955..0000000
--- a/iso/usr/share/doc/smgl.install/steps/install-opt-spells
+++ /dev/null
@@ -1,5 +0,0 @@
-install-opt-spells step
-At this point, you would be installing other spells that might come in handy.
-
-Except that this version of the iso doesn't actually ship with any yet,
-so just hit that next.
diff --git a/iso/usr/share/smgl.install/smgl-spellcaster
b/iso/usr/share/smgl.install/smgl-spellcaster
new file mode 100755
index 0000000..dc8ac8f
--- /dev/null
+++ b/iso/usr/share/smgl.install/smgl-spellcaster
@@ -0,0 +1,141 @@
+#!/bin/bash
+
+PREFIX=/var/cache/sorcery
+EXTENSION="*.tar.bz2"
+CACHES=
+SELECTED=
+NUM_CACHES=
+
+function usage() {
+ cat <<USAGE
+$(basename $0) [/path/to/target]
+Generates a listing of cache files available to install, and then
+installs the selected caches to the target directory (defined as
+/mnt/root if not specified).
+USAGE
+}
+
+function prompt() {
+ local input=
+
+ echo ""
+ printf "\tPlease enter a number (0 when finished): "
+ while [[ -z $input ]]
+ do
+ read input
+ if [[ -n $input ]]
+ then
+ # fancy way to make sure that we have the correct input
+ # if the user passes 1-12, that will be evaluated mathematically fist,
+ # yielding -11, which fals outside the range of allowable input
+ # this may be changed later, but currently we only support entering one
+ # value at a time
+ if [[ $(echo $((input)) ) -lt 0 || $(echo $((input)) ) -gt $NUM_CACHES
]]
+ then
+ echo "Error: You must enter a number corresponding to one"
+ echo "of the choices in the list."
+ input=
+ fi
+ fi
+ done
+ return $input
+}
+
+function make_list {
+ # get a list of all the caches available and get the spell names from them,
+ # sorted and uniq'ed
+ CACHES=( $(find $PREFIX/ -maxdepth 1 -type f -name "$EXTENSION" | sed
's#.*/##' | sed 's/-[0-9].*//' | sort | uniq) )
+ NUM_CACHES=${#CACHES[*]}
+
+ # for each cache available, check to see if it was already selected before
+ # and mark it as selected if found
+ for ((i=0; i < $NUM_CACHES; i++))
+ do
+ grep -s -q "^${CACHES[i]}$" /tmp/spells && SELECTED[i]="*"
+ done
+}
+
+function print_list {
+ echo ""
+ for ((i=0; i < $NUM_CACHES; i++))
+ do
+ printf "[%2d] %s %s\n" "$(($i + 1))" "${SELECTED[i]:- }" "${CACHES[i]}"
+ done | column | more
+}
+
+function main {
+ local choice=-1
+
+ # generate the list of spells to choose from by scanning the contents of
+ # /var/caches/sorcery on the ISO
+ echo "Generating cache list, please be patient..."
+ make_list
+
+ # present the menu and prompt for user input, until the user enters 0 to
+ # finish
+ while [[ $choice -ne 0 ]]
+ do
+ print_list
+ prompt
+ choice="$?"
+ [[ $choice -gt 0 ]] && SELECTED[$((choice-1))]="*"
+ done
+
+ # for each selected spell, output it to the spell listing file
+ for (( i=0; i < $NUM_CACHES; i++ ))
+ do
+ if [[ ${SELECTED[i]} = '*' ]]
+ then
+ echo ${CACHES[i]} >> /tmp/spells
+ fi
+ done
+
+ # make sure we don't have duplicates
+ sort /tmp/spells | uniq > /tmp/spells
+
+ # copy the selected list so that it's available inside the chroot
+ cp -f /tmp/spells "$TARGET"/spells
+
+ # mount bind to get to the caches from inside the chroot
+ # this is cheaper than copying, plus the user doesn't have a bunch of
+ # "useless" cache files on their system since presumably they will be
+ # changing both compile options (like arch) and spell version when they
+ # update their grimoires
+ mount --bind /var/cache/sorcery "$TARGET"/var/cache/sorcery
+
+ # cast inside the chroot using the selected list and ISO caches
+ chroot "$TARGET" /usr/sbin/cast $(< /spells)
+
+ # clean up
+ umount "$TARGET"/var/cache/sorcery
+ rm "$TARGET"/spells
+}
+
+function message() {
+ echo ""
+ cat <<-Message
+ Spell selection menu.
+ You may select any number of the following spells to install. Some of
them may
+ be necessary, depending on how you have set up your installation. For
example,
+ if you formatted your disk with xfs, then you will need xfsprogs. Also,
you
+ will need at least one bootloader installed (e.g. lilo, grub, etc.).
+
+ When you are satisfied with your selections, enter 0 (zero) and the list
of
+ spells to cast will be compiled. Sorcery will then ask you if the list of
+ spells is correct and if you would like to cast them, as it normally
does when
+ casting.
+
+Message
+}
+
+[[ $# -lt 1 ]] && TARGET="/mnt/root"
+TARGET=$1
+
+message
+
+main
+#clear
+
+
+
+# vim:tabstop=2:softtabstop=2:shiftwidth=2:expandtab:ai
diff --git a/scripts/spellcaster.sh b/scripts/spellcaster.sh
new file mode 100644
index 0000000..6c8f205
--- /dev/null
+++ b/scripts/spellcaster.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+# this script handles automatically casting all required spells into the ISO
+# chroot, and also the casting and subsequent dispelling (with caches
enabled)
+# of the optional spells.
+
+MYDIR="$(dirname $0)"
+CAULDRONDIR="$MYDIR"/../data
+
+function usage() {
+ cat << EndUsage
+Usage: $(basename $0) [-h] /path/to/target ARCHITECTURE
+
+Casts the required and optional spells onto the ISO.
+This script requires superuser privileges.
+
+Required:
+ /path/to/target
+ The location of the chroot directory you would like to have the
+ casting done in.
+
+ ARCHITECTURE
+ The architecture you are building the ISO for. Although the spells
+ will largely be the same, there will be some differences,
+ particularly in the case of bootloaders. Defaults to "x86" if not
+ specified.
+
+Options:
+ -h Shows this help information
+EndUsage
+ exit 1
+} >&2
+
+while getopts ":h" Option
+do
+ case $Option in
+ h ) usage ;;
+ * ) echo "Unrecognized option." >&2 && usage ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+SELF="$0"
+
+if [[ $UID -ne 0 ]]
+then
+ if [[ -x $(which sudo > /dev/null) ]]
+ then
+ exec sudo "$SELF $*"
+ else
+ echo "Please enter the root password."
+ exec su -c "$SELF $*" root
+ fi
+fi
+
+[[ $# -lt 1 ]] && usage
+TARGET=$1
+shift
+
+TYPE="x86"
+[[ $# -gt 0 ]] && TYPE="$1"
+
+rspells="rspells.$TYPE"
+ospells="ospells.$TYPE"
+
+# check to make sure that the chroot has sorcery set to do caches
+if [[ -e "$TARGET"/etc/sorcery/local/config ]]
+then
+ CONFIG_ARCHIVE=$(grep 'ARCHIVE=' "$TARGET"/etc/sorcery/local/config |
cut -d = -f 2)
+ if [[ -n $CONFIG_ARCHIVE && $CONFIG_ARCHIVE != "on" ]]
+ then
+ echo "Error! TARGET sorcery configured to not archive!" >&2
+ echo -n "Set the TARGET sorcery to archive? [yn]" >&2
+ read -n1 CHOICE
+
+ if [[ $CHOICE == 'y' ]]
+ then
+ sed -i 's/ARCHIVE=.*/ARCHIVE=on/'
"$TARGET"/etc/sorcery/local/config
+ else
+ exit 2
+ fi
+ fi
+fi
+
+# first cast all the required spells
+cp "$CAULDRONDIR"/"$rspells" "$TARGET"/
+chroot "$TARGET" /usr/sbin/cast </"$rspells"
+rm "$TARGET"/"$rspells"
+
+# now cast all the optional spells
+cp "$CAULDRONDIR"/"$ospells" "$TARGET"/
+chroot "$TARGET" /usr/sbin/cast </"$ospells"
+chroot "$TARGET" /usr/sbin/dispel </"$ospells"
+rm "$TARGET"/"$ospells"
+
+exit 0



  • [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (065d93d3de59362ba0643d22d8cc59ae09843af7), Justin Boffemmyer, 10/19/2008

Archive powered by MHonArc 2.6.24.

Top of Page