[SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (ca53dfbf8a690c502b2655934d8b702ecf08a460)

Justin Boffemmyer scm at sourcemage.org
Sun Feb 8 11:38:02 EST 2009


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

 base/etc/hosts                                      |   12 +
 base/etc/network/interfaces                         |    3 
 data/initrd.files                                   |    2 
 data/ospells.x86                                    |    1 
 iso/isolinux/isolinux.cfg                           |    6 
 iso/usr/share/doc/smgl.install/steps/disk-partition |    5 
 iso/usr/share/doc/smgl.install/steps/edit-confs     |   11 -
 iso/usr/share/doc/smgl.install/steps/grub           |    2 
 iso/usr/share/doc/smgl.install/steps/install        |    2 
 iso/usr/share/doc/smgl.install/steps/reboot         |   20 -
 iso/usr/share/doc/smgl.install/steps/user-setup     |    6 
 iso/usr/share/smgl.install/smgl-enchant             |    9 
 iso/usr/share/smgl.install/smgl-spells              |   15 +
 iso/usr/share/smgl.install/spells                   |    2 
 scripts/qa.sh                                       |  121 +++++++++++
 scripts/spellcaster.sh                              |  207 +++++++++++++-------
 16 files changed, 321 insertions(+), 103 deletions(-)

New commits:
commit ca53dfbf8a690c502b2655934d8b702ecf08a460
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/qa.sh: new, does qaulity assurance
    
    New script that does basic quality assurance on a build tree by checking
    to see if any init scripts available for a spell are not installed, and
    then offers to recast the spell. The user still needs to determine if
    the offending spell really needs to be recast, since it will not always
    be the case that we will want _all_ init scripts for a spell installed,
    but this will help to identify cases where init scripts are missing.

commit b0430802fac0030b59c3334040d4e4dd4931b7c8
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: rm resolv.conf, due to ppp
    
    Remove resolv.conf before trying to copy over it, since ppp will install
    a symlink. This should become unnecessary once/if ppp can be fixed not
    to force a symlink (or rather, fix it to install etc/ppp/resolv.conf as
    a symlink to etc/resolv.conf, instead of the other way around like it
    currently does).

commit 2d113fddf69f3507b1fab660c1738ba5f206aefb
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: format output sub-messages
    
    Sub-messages are formatted with preceding ".. " to make it easier to
    identify in the output what stage of processing the script is in.

commit db1f8e028cd88dc89bcb12a457de7d71033a8928
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: better logfile wiping
    
    Don't wipe out all sorcery log files, but only the activity and install
    queue logs. Otherwise we end up wiping out the install logs of all the
    spells in the starting build tree, so dispels will fail.

commit 8829c8b2ad879f4166e3935a3023c2f617f954f5
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: prepare build sorcery
    
    Install a fresh sorcery into the build tree and configure it with ISO
    build values as part of the prepare_target function.

commit 22ee4fecc5b7c5a663abc9d1f74189be9a1a445f
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: more build-only sanity
    
    Added logic to sanity_check for build-only material, so that spellcaster
    won't sanity check the build tree when not building. Also does better
    build sanity checking by completely wiping the build tree etc and
    setting it up for base defaults via add-sauce, and preparation of the
    build sorcery is done as part of prepare_target.

commit 7d0dbd058dccf0c85fdeeb1942d62a694e2b45ce
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    smgl.install/smgl-enchant: better tablet creation
    
    Don't pre-strip the gathered spell name before looping on it. This
    prevents the script from accidentally stripping too much off. Also do
    better testing to ensure that we have good values for generating
    packages and depends (to be specific, ensure that the calls to
    tablet_get_* succeeded as well as there actually being a spell-specific
    depends file for information to write to depends).

commit c4509d3c4f1b768c5821f0a49d00871e5c55b824
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    smgl.install/smgl-spells: wait for any key
    
    Added a dummy read to slow down the script and make sure the user reads
    the startup information (which includes information about where the
    selectable caches come from) before effectively "clear"ing that
    information by presenting the list of spells (which is long enough to
    warrant more than one full screen by less).

commit 386e9a329cbf7e3414c1687a4652fc25de51d73b
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/user-setup: restore the -d /home/USER example
    
    Added "-d /home/mbolton" back in because, after testing, it is clear
    that the shadow utility has improved but still does not correctly create
    home directories without making it explicit. This was tested both with
    -g users and without, and in both cases it failed to make the home dir
    without the -d option.

commit 412ad66de969349539dbf025010be953d690abbe
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/reboot: remove spurious period
    
    Removed an unnecessary "." that was trailing the reboot command.

commit bb9e3031d271cfc687ece0d193154c68c9f64efa
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/edit-confs: fix some info
    
    Adjusted "create" to "edit" for the interfaces file, since a default is
    now provided for loopback. Also added a line for running smgl-chroot
    before doing the symlinking for the timezone.

commit e6667b0bb0dd71ecffaa8e3790976becd87f8254
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/grub: fix grub menu.lst path
    
    Correct the menu.lst path to /boot/grub/menu.lst. This fixes bug #15053.

commit 5b5cb7d98b42821ef3b2ef424286b8b7e5a349d4
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    data/initrd.files: add insmod and libncurses.so*
    
    Add insmod in case the user needs a more "direct" way of loading modules
    than modprobe, and copy over all the libncurses.so symlinks so that some
    programs that rely on the symlinks (even though the program is linked to
    the utf version, libncursesw) will still properly function.

commit 73d4a4bb61943c592a87dfaf2c84d7013dc939ef
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    base/etc/hosts: add default hosts definition
    
    Add a default hosts definition file to override anything that was
    already existing.

commit ea3940e1dc492ffdb870c9907fde6f10c27f36cd
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: fix a typo
    
    Corrected a capitalization typo in a comment.

commit 8c994362e68adb39cded892db2518d4590d04679
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: two new options
    
    Added the -b and -c options, which perform build-only and basesystem
    chroot generation, respectively. The basesystem chroot should be
    equivalent to whatever goes into SYS, at least for the most part. This
    may get improved over time such that the list in rspells and what goes
    into the auto-generated basesystem chroot may drift apart.

commit 058a2854376c911f2f1d8b1b446a5859fc2d9e24
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: update grimoire better
    
    Improved the way grimoires are updated in the chroots for better sanity
    and ensurance of a properly indexed grimoire.

commit 2daa1ecb6b380eab8885ddc04e2d213d043d8346
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    scripts/spellcaster.sh: clean old sorcery logs
    
    Wipe clean any sorcery logs in the build chroot from previous builds so
    that spellcaster build activity can be easily identified to help with
    debugging and testing.

commit 67620131ac369d19546af736e5930b25903249f6
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    smgl.install/smgl-spells: add more info
    
    Made it more clear how the script functions, and what the presented list
    is intended to be.

commit 88e5d0cdfec88cfa62bb3a091d568d6283fc7707
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    iso/etc/interfaces: removed
    
    I'm not sure why this file was here. It was in the wrong place and had
    the wrong contents. This is superseded by base/etc/network/interfaces
    anyway.

commit d48d284fc6df87def9c64c1a04830d6ecb4d8617
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/reboot: add smgl-setup, rm paranoid
    
    Removed the paranoid instructions to make room for the new smgl-setup
    instructions.

commit 7876af08504ff5c483425349dfbb3735e6bec0a0
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    base/etc/network/interfaces: added for lo support
    
    Added a really basic interfaces file that just sets up loopback.

commit 436b5ecda730ea538367b4ae3f951a51bfe5ea41
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/edit-confs: fill out config info
    
    Finally added in pointers to different types of configurations the user
    might want to do, including some basic networking and setting the
    timezone.

commit a503062422e497fa855ed951f4b86d5c7b27ee86
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/reboot: added more info for reboot
    
    Polished up the reboot step by adding the option of using "reboot"
    instead of the paranoid way, and mentioned swapoff for the paranoid way
    as well.

commit 3478e0eea87571879b451619ffe9e18f43658cf2
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    smgl.install/spells: added netkit-ping as default
    
    Added netkit-ping as a default opt-spell to install as per
    request/suggestion.

commit 318ae36f1501c54913324855416c9b44f2fe89bf
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/install: fix name of smgl-enchant
    
    Corrected enchant to smgl-enchant in the info about running it with -h.

commit ca7dde91a3780e083e379a6886f15fe172e7b2df
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    steps/disk-partition: add info for finding disks
    
    Added the needed info for finding which disks to install onto, and
    removed the now obsolete TODO message.

commit 7b81ec041948bbb639b4a7a76c9d0bc8a9327639
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    iso/isolinux/isolinux.cfg: rootdelay for USB
    
    Added a rootdelay for USB devices. Although it's still possible to boot
    USB devices in the ISO by calling boot-from in the initrd, having the
    delay may help in booting them automatically since some of them may
    still be initialized asynchronously.

commit 5d937495f703001597c78f56da33c78109ac42ff
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    smgl.install/spells: add smgl-setup as default
    
    Default the optional spell install list to include smgl-setup.

commit f3012575e766693bd6a077508b2ea4dd77ed85dc
Author: Justin Boffemmyer <flux at sourcemage.org>
Commit: Justin Boffemmyer <flux at sourcemage.org>

    data/ospells.x86: add smgl-setup
    
    Now that smgl-setup is in the latest stable grimoire, it can safely be
    added to the list of optional spells for install.

diff --git a/base/etc/hosts b/base/etc/hosts
new file mode 100644
index 0000000..0349fed
--- /dev/null
+++ b/base/etc/hosts
@@ -0,0 +1,12 @@
+#
+# hosts		This file describes a number of hostname-to-address
+#		mappings for the TCP/IP subsystem.  It is mostly
+#		used at boot time, when no name servers are running.
+#		On small systems, this file can be used instead of a
+#		"named" name server.  Just add the names, addresses
+#		and any aliases to this file...
+#
+
+127.0.0.1	localhost
+
+# End of hosts.
diff --git a/base/etc/network/interfaces b/base/etc/network/interfaces
new file mode 100644
index 0000000..a37ab5f
--- /dev/null
+++ b/base/etc/network/interfaces
@@ -0,0 +1,3 @@
+# SMGL default loading of loopback interface
+auto lo
+iface lo inet loopback
diff --git a/data/initrd.files b/data/initrd.files
index 2c04e52..bd06d8c 100644
--- a/data/initrd.files
+++ b/data/initrd.files
@@ -8,6 +8,7 @@ rm
 ls
 find
 grep
+insmod
 lsmod
 mknod
 mkdir
@@ -20,3 +21,4 @@ rmmod
 /bin/sh
 pidof
 killall5
+/lib/libncurses.so.*
diff --git a/data/ospells.x86 b/data/ospells.x86
index 7e11cf2..c2d656c 100644
--- a/data/ospells.x86
+++ b/data/ospells.x86
@@ -7,3 +7,4 @@ grub
 lilo
 m4
 perl
+smgl-setup
diff --git a/iso/etc/interfaces b/iso/etc/interfaces
deleted file mode 100644
index e69de29..0000000
diff --git a/iso/isolinux/isolinux.cfg b/iso/isolinux/isolinux.cfg
index cc38772..e411ef2 100644
--- a/iso/isolinux/isolinux.cfg
+++ b/iso/isolinux/isolinux.cfg
@@ -14,12 +14,12 @@ f9 f9.txt
 label install
 
     kernel /boot/linux
-    append vga=normal initrd=/boot/initrd.gz ramdisk_size=@INITRD_SIZE@ root=/dev/ram0 rw
+    append vga=normal initrd=/boot/initrd.gz ramdisk_size=@INITRD_SIZE@ root=/dev/ram0 rw rootdelay=10
 
 label linux
     kernel /boot/linux
-    append root=you-need-to-set-root rw
+    append root=you-need-to-set-root rw rootdelay=10
 
 label initrd
     kernel /boot/linux
-    append initrd=/boot/initrd.gz ramdisk_size=@INITRD_SIZE@ root=you-need-a-set-root rw
+    append initrd=/boot/initrd.gz ramdisk_size=@INITRD_SIZE@ root=you-need-a-set-root rw rootdelay=10
diff --git a/iso/usr/share/doc/smgl.install/steps/disk-partition b/iso/usr/share/doc/smgl.install/steps/disk-partition
index 4e618ef..6f2839a 100644
--- a/iso/usr/share/doc/smgl.install/steps/disk-partition
+++ b/iso/usr/share/doc/smgl.install/steps/disk-partition
@@ -1,7 +1,8 @@
 disk-partition step
 First, we'll need to create some partitions on your disk that we can install
-SMGL to. You'll need to know the device of your hard disk to do this
-(TODO: describe how to find that out).
+SMGL to. You'll need to know the device of your hard disk to do this. One good
+way to find your disks is by ls /sys/block, running cat /proc/partitions, or by
+dmesg | grep -i disk. You probably want something that is either hd or sd.
 
 This image ships with several popular programs for partitioning:
 
diff --git a/iso/usr/share/doc/smgl.install/steps/edit-confs b/iso/usr/share/doc/smgl.install/steps/edit-confs
index 049d67b..27bf859 100644
--- a/iso/usr/share/doc/smgl.install/steps/edit-confs
+++ b/iso/usr/share/doc/smgl.install/steps/edit-confs
@@ -1,5 +1,4 @@
 edit-confs step
-
 Now, we need to set up our partitions so the system will find them again on
 bootup. For this, edit /mnt/root/etc/fstab and add your partitions.
 
@@ -10,4 +9,14 @@ feel should be different. Especially, if you selected a custom keymap at the
 start of this install, you'll need to edit the file called keymap
 in that directory (do  cat /tmp/selected-keymap to see which you chose)
 
+You may also wish to create /mnt/root/etc/hostname with a hostname for your
+system, and you can set up networking by editing the
+/mnt/root/etc/network/interfaces file.
+
+Finally, you can choose to set your timezone by doing the following:
+ smgl-chroot
+ ln -sf /usr/share/zoneinfo/SOME/TIMEZONE /etc/localtime
+
+Just remember to replace "SOME/TIMEZONE" with your actual timezone.
+
 Type next to go to the next step.
diff --git a/iso/usr/share/doc/smgl.install/steps/grub b/iso/usr/share/doc/smgl.install/steps/grub
index 7877ecd..7b966fe 100644
--- a/iso/usr/share/doc/smgl.install/steps/grub
+++ b/iso/usr/share/doc/smgl.install/steps/grub
@@ -15,7 +15,7 @@ for your disk layout):
 > quit
 
 Update menu.lst for your kernel:
-$EDITOR /boot/menu.lst
+$EDITOR /boot/grub/menu.lst
 
 Exit the chroot:
  exit
diff --git a/iso/usr/share/doc/smgl.install/steps/install b/iso/usr/share/doc/smgl.install/steps/install
index bf04b15..da89487 100644
--- a/iso/usr/share/doc/smgl.install/steps/install
+++ b/iso/usr/share/doc/smgl.install/steps/install
@@ -18,6 +18,6 @@ enchant method (uses /tmp/spells):
 Enchant can also take a command-line argument to a cache file with a specified
 path. This enables you to run enchant on any cache file you choose, from any
 directory, without the tedium of typing in the tar line as given in the "manual
-method" section. See  enchant [-h|--help] for more information.
+method" section. See  smgl-enchant [-h|--help] for more information.
 
 When the step finishes type next.
diff --git a/iso/usr/share/doc/smgl.install/steps/reboot b/iso/usr/share/doc/smgl.install/steps/reboot
index 051802d..badbe4a 100644
--- a/iso/usr/share/doc/smgl.install/steps/reboot
+++ b/iso/usr/share/doc/smgl.install/steps/reboot
@@ -1,20 +1,12 @@
 reboot step
-You should be all done with the installation! Congratulations!
+You should be all done with the installation! Congratulations! Time to reboot
+into your installed system! Just type:
 
-Now it is time to umount all of your partitions. For all partitions you mounted
-under /mnt/root, unmount them, starting with the deepest mount first and
-working back up to /mnt/root.
+ reboot
 
-Example - assume that there are separate partitions for /, /var, /var/spool,
-and /var/cache:
-
-umount /mnt/root/var/cache
-umount /mnt/root/var/spool
-umount /mnt/root/var
-umount /mnt/root
-
-Now, reboot via something like:
- shutdown -r now "install finished"
+If you installed smgl-setup (installed by default unless changed), be sure to
+run man smgl-setup when first logging in. It will provide you with
+information on what you can do with your newly installed system.
 
 We don't (yet) eject the CD during shutdown, so be sure to take it out during
 reboot or configure your BIOS not to try and boot from it.
diff --git a/iso/usr/share/doc/smgl.install/steps/user-setup b/iso/usr/share/doc/smgl.install/steps/user-setup
index efaf7ea..e8c3127 100644
--- a/iso/usr/share/doc/smgl.install/steps/user-setup
+++ b/iso/usr/share/doc/smgl.install/steps/user-setup
@@ -7,11 +7,11 @@ and bear in mind that it can be bypassed with a screwdriver):
  passwd root
 
 Recommended: add at least one regular user for daily use:
- useradd -m -g users mbolton
+ useradd -m -d /home/mbolton -g users mbolton
  passwd mbolton
 
-Replace mbolton with whatever login you want.
-You may also change the group (-g users).
+Replace mbolton with whatever login you want. Don't forget to change
+/home/mbolton accordingly. You may also change the group (-g users).
 
 Finally, exit the chroot to return to the installer:
  exit
diff --git a/iso/usr/share/smgl.install/smgl-enchant b/iso/usr/share/smgl.install/smgl-enchant
index 57384bd..2ec53a5 100755
--- a/iso/usr/share/smgl.install/smgl-enchant
+++ b/iso/usr/share/smgl.install/smgl-enchant
@@ -29,7 +29,6 @@ function die() {
 function generate_state() {
   local spell="$1"
 
-  spell=${spell%-*}
   while ! grep -q $spell $TABLETS
   do
     echo $spell | grep -q '.\+[-].\+' || break
@@ -41,11 +40,11 @@ function generate_state() {
 	# generate the depends and packages info for sorcery to use
   for date in "$tablet/$spell"/*
   do
-    tablet_get_version $date ver
-    tablet_get_status $date stat
-    tablet_get_depends $date dep
+    tablet_get_version $date ver &&
+    tablet_get_status $date stat &&
     echo "${spell##*/}:${date##*/}:$stat:$ver" >> "$packages"
-    cat "$dep" >> "$depends"
+    tablet_get_depends $date dep &&
+    [[ -f "$dep" ]] && cat "$dep" >> "$depends"
   done
 }
 
diff --git a/iso/usr/share/smgl.install/smgl-spells b/iso/usr/share/smgl.install/smgl-spells
index 33a72a0..4436b6c 100755
--- a/iso/usr/share/smgl.install/smgl-spells
+++ b/iso/usr/share/smgl.install/smgl-spells
@@ -9,7 +9,10 @@ NUM_CACHES=
 function usage() {
   cat <<USAGE
 $(basename $0)
-Generates a listing of cache files available to install.
+Generates a listing of cache files available to install. The list of caches to
+choose from that is presented is a listing of *all* cache files present on this
+ISO. As a result, there may be some overlap with system.tar.bz2. Check the
+release notes for a list of which spells system.tar.bz2 installs.
 
 USAGE
 }
@@ -128,6 +131,8 @@ function main {
   # /var/caches/sorcery on the ISO
   echo "Populating internal cache list, please be patient..."
   make_list
+  echo "Internal cache populated. Press a key to continue..."
+  read -n1 DUMMY_VARIABLE
 
   # present the menu and prompt for user input, until the user enters 0 to
   # finish
@@ -160,7 +165,13 @@ function message() {
     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.).
+    etc.). Selected spells are marked with '*'. The list begins with some
+    default selections.
+
+    Note that some all caches present on the ISO are included in the list for
+    selection, including caches that may also be installed by system.tar.bz2.
+    This is intentional. To see what spells are in system.tar.bz2, please see
+    the release notes for this ISO.
 
     The output is piped through less, so if there are too many caches to
     fit on one screen you will be able to scroll. When you are satisfied with
diff --git a/iso/usr/share/smgl.install/spells b/iso/usr/share/smgl.install/spells
index 22cc2ba..5de6ce9 100644
--- a/iso/usr/share/smgl.install/spells
+++ b/iso/usr/share/smgl.install/spells
@@ -14,6 +14,7 @@ lilo
 lynx
 m4
 man
+netkit-ping
 openssl
 pciutils
 perl
@@ -24,3 +25,4 @@ texinfo
 which
 usbutils
 udev
+smgl-setup
diff --git a/scripts/qa.sh b/scripts/qa.sh
new file mode 100755
index 0000000..32c79d1
--- /dev/null
+++ b/scripts/qa.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+#
+
+MYDIR="$(dirname $0)"
+CAULDRONDIR="$MYDIR/../data"
+TMPDIR="/tmp/cauldron"
+
+function usage() {
+	cat << EndUsage
+Usage: $(basename $0) [-h] [-o OUTPUT] [-t TYPE] /path/to/target
+Performs Quality Assurance on the target chroot directory. The target must be a
+full chroot.
+
+Options:
+	/path/to/target
+	    The target directory you would like to perform Quality Assurance
+	    on. Defaults to current working directory.
+
+	-h  Shows this help information
+
+	-o  File to write the output to. Defaults to /tmp/cauldron/MISSING_INITS.
+
+	-t  Set the target architecture type to TYPE (currently only x86
+	    supported).
+EndUsage
+	exit 1
+} >&2
+
+# dir to chroot to is either $1 or $CWD
+while getopts ":o:t:h" Option
+do
+	case $Option in
+		o ) OUTPUT="$OPTARG" ;;
+		t ) TYPE="$OPTARG" ;;
+		h ) usage ;;
+		* ) echo "Unrecognized option." >&2 && usage ;;
+	esac
+done
+shift $(($OPTIND - 1))
+
+SELF=$0
+
+if [[ $UID -ne 0 ]]
+then
+	if [[ -x $(which sudo 2> /dev/null) ]]
+	then
+		exec sudo -H $SELF $*
+	else
+		echo "Please enter the root password."
+		exec su -c "$SELF $*" root
+	fi
+fi
+
+[[ $# -eq 1 ]] && TARGET="${1%/}"
+TARGET="${TARGET:-.}"
+TYPE="${TYPE:-x86}"
+
+INSTALL_LOGS="$TARGET/var/log/sorcery/install"
+CODEX="$TARGET/var/lib/sorcery/codex"
+PACKAGES="$TARGET/var/state/sorcery/packages"
+
+rspells="$CAULDRONDIR/rspells.$TYPE"
+ispells="$CAULDRONDIR/ispells.$TYPE"
+ospells="$CAULDRONDIR/ospells.$TYPE"
+
+if [[ -z $OUTPUT ]]
+then
+	OUTPUT="$TMPDIR/MISSING_INITS"
+	[[ -d "$TMPDIR" ]] || mkdir -p "$TMPDIR"
+fi
+
+# ensure that the output file starts as empty
+rm -f "$OUTPUT"
+
+echo "Checking spells for missing init.d files..."
+for list in "$rspells" "$ispells" "$ospells"
+do
+	for spell in $(<$list)
+	do
+		echo ".. checking $spell"
+		if ls "$CODEX"/stable/*/$spell/init.d &> /dev/null
+		then
+			log="$spell-$(grep ${spell}: "$PACKAGES" | cut -d: -f4)"
+			for init in $(find "$CODEX"/stable/*/$spell/init.d -type f)
+			do
+				if [[ -x $init ]]
+				then
+					if ls "$INSTALL_LOGS"/$spell* &> /dev/null
+					then
+						if ! grep -q "^/etc/init.d/.*/${init##*/}" "$INSTALL_LOGS"/$log
+						then
+							echo "--> $spell is missing init.d files!"
+							echo "$spell" >> "$OUTPUT"
+							break
+						fi
+					fi
+				fi
+			done
+		fi
+	done
+done
+
+if [[ -s "$OUTPUT" ]]
+then
+	sort -u -o "$OUTPUT" "$OUTPUT"
+	echo "Spells with missing init.d files:"
+	cat "$OUTPUT" | column
+	echo -n "Re-cast these spells? [yn] "
+	read -n1 RECAST
+	echo ""
+	if [[ $RECAST == 'y' ]]
+	then
+		echo "Re-casting spells with missing init.d files..."
+		for spell in $(<$OUTPUT)
+		do
+			"$MYDIR"/cauldronchr.sh -d "$TARGET" cast -c $spell
+		done
+	fi
+fi
+
diff --git a/scripts/spellcaster.sh b/scripts/spellcaster.sh
index 34a9217..b19ce63 100755
--- a/scripts/spellcaster.sh
+++ b/scripts/spellcaster.sh
@@ -9,7 +9,7 @@ CAULDRONDIR="$MYDIR"/../data
 
 function usage() {
   cat << EndUsage
-Usage: $(basename $0) [-hnq] [-i ISO] [-s SYS] /path/to/target ARCHITECTURE
+Usage: $(basename $0) [-hbcnq] [-i ISO] [-s SYS] /path/to/target ARCHITECTURE
 
 Casts the required and optional spells onto the ISO.
 This script requires superuser privileges.
@@ -26,6 +26,12 @@ Required:
 	    specified.
 
 Options:
+	-b  Build only (don't generate the ISO and SYS trees). Ignores the -i
+	    and -s flags. Conflicts with -n.
+
+	-c  Generate a basesystem chroot (causes -i to be ignored, only SYS is
+	    used).
+
 	-h  Shows this help information
 
 	-i  Path to iso build directory (ISO). Defaults to /tmp/cauldron/iso.
@@ -33,10 +39,11 @@ Options:
 	-s  Path to system build directory (SYS). Defaults to
 	    /tmp/cauldron/system.
 
-	-n  Don't process the build tree. Instead, generate ISO and SYS using
+	-n  Don't process the build tree. Instead, generate target trees using
 	    an already existing build tree. This is useful if you already have
 	    all the caches, but you need to regenerate your ISO and SYS trees
-	    if something went wrong during later processing.
+	    (or a basesystem chroot tree) if something went wrong during later
+	    processing. Conflicts with -b.
 
 	-q  Suppress output messages. Defaults to off (output shown on STDERR).
 EndUsage
@@ -44,9 +51,11 @@ EndUsage
 } >&2
 
 function parse_options() {
-	while getopts ":i:s:nqh" Option
+	while getopts ":bci:s:nqh" Option
 	do
 		case $Option in
+			b ) BUILDONLY="yes" ;;
+			c ) CHROOT="yes" ;;
 			i ) ISODIR="${OPTARG%/}" ;;
 			s ) SYSDIR="${OPTARG%/}" ;;
 			n ) NOBUILD="yes" ;;
@@ -89,8 +98,6 @@ function directory_check() {
 
 # check to make sure that the chroot has sorcery set to do caches
 function sanity_check() {
-	local config="$TARGET/etc/sorcery/local/config"
-	local arch=
 	local choice=
 
 	# Ensure that TARGET is a directory
@@ -99,62 +106,52 @@ function sanity_check() {
 		exit 3
 	}
 
-	# If ISODIR is not a directory, create it.
-	directory_check "$ISODIR"
-
-	# If ISODIR/var/cache/sorcery is not a directory, create it.
-	directory_check "$ISODIR/var/cache/sorcery"
-
-	# If ISODIR/var/spool/sorcery is not a directory, create it.
-	directory_check "$ISODIR/var/spool/sorcery"
-
-	# If SYSDIR is not a directory, create it.
-	directory_check "$SYSDIR"
-
-	# If SYSDIR/var/cache/sorcery is not a directory, create it.
-	directory_check "$SYSDIR/var/cache/sorcery"
-
-	# If SYSDIR/var/spool/sorcery is not a directory, create it.
-	directory_check "$SYSDIR/var/spool/sorcery"
-
-	if [[ -e "$config" ]]
+	if [[ -z $NOBUILD ]]
 	then
-		arch="$(source "$config" &> /dev/null && echo $ARCHIVE)"
-		if [[ -n $arch && $arch != "on" ]]
-		then
-			echo "Error! TARGET sorcery does not archive!" >&2
-			echo -n "Set TARGET sorcery to archive? [yn]" >&2
-			read -n1 choice
-			echo ""
+		# nuke the TARGET /etc and install a clean /etc
+		rm -fr "$TARGET"/etc/*
+		"$MYDIR"/add-sauce.sh -o -s "$TARGET"
 
-			if [[ $choice == 'y' ]]
+		# make sure that either the linux spell is being used or that the
+		# kernel sources are available for building
+		if ! grep -q '^linux$' "$CAULDRONDIR/rspells.$TYPE"
+		then
+			if [[ -d "$TARGET"/usr/src/linux ]]
 			then
-				. "$TARGET/var/lib/sorcery/modules/libstate"
-				modify_config $config ARCHIVE on
+				if [[ ! -s "$TARGET"/usr/src/linux ]]
+				then
+					echo "Couldn't find "$TARGET" kernel config!"
+					exit 2
+				fi
 			else
-				echo "Archiving required, bailing out!"
+				echo "Cannot find the $TARGET kernel!"
+				echo "Either place the kernel sources and kernel config in $TARGET"
+				echo "or add the linux spell to the list of rspells."
 				exit 2
 			fi
 		fi
+
 	fi
 
-	# make sure that either the linux spell is being used or that the
-	# kernel sources are available for building
-	if ! grep -q '^linux$' "$CAULDRONDIR/rspells.$TYPE"
+	if [[ -z $BUILDONLY ]]
 	then
-		if [[ -d "$TARGET"/usr/src/linux ]]
-		then
-			if [[ ! -s "$TARGET"/usr/src/linux ]]
-			then
-				echo "Couldn't find "$TARGET" kernel config!"
-				exit 2
-			fi
-		else
-			echo "Cannot find the $TARGET kernel!"
-			echo "Either place the kernel sources and kernel config in $TARGET"
-			echo "or add the linux spell to the list of rspells."
-			exit 2
-		fi
+		# If ISODIR is not a directory, create it.
+		directory_check "$ISODIR"
+
+		# If ISODIR/var/cache/sorcery is not a directory, create it.
+		directory_check "$ISODIR/var/cache/sorcery"
+
+		# If ISODIR/var/spool/sorcery is not a directory, create it.
+		directory_check "$ISODIR/var/spool/sorcery"
+
+		# If SYSDIR is not a directory, create it.
+		directory_check "$SYSDIR"
+
+		# If SYSDIR/var/cache/sorcery is not a directory, create it.
+		directory_check "$SYSDIR/var/cache/sorcery"
+
+		# If SYSDIR/var/spool/sorcery is not a directory, create it.
+		directory_check "$SYSDIR/var/spool/sorcery"
 	fi
 }
 
@@ -162,14 +159,70 @@ function prepare_target() {
 	export rspells="rspells.$TYPE"
 	export ispells="ispells.$TYPE"
 	export ospells="ospells.$TYPE"
+	local SPOOL="$TARGET/tmp"
+	local SORCERY="sorcery-stable.tar.bz2"
+	local SORCERYDIR="$TARGET/usr/src/sorcery"
+	local LOGS="$TARGET/var/log/sorcery"
 
 	# make sure the TARGET has a clean /tmp
 	rm -fr "$TARGET"/tmp/*
 
+	# download sorcery source if we don't already have it
+	if [[ ! -f "$SPOOL"/$SORCERY ]]
+	then
+		(
+			cd "$SPOOL"
+			wget http://download.sourcemage.org/sorcery/$SORCERY
+		)
+	fi
+
+	# unpack sorcery into TARGET
+	msg "Installing sorcery in build directory..."
+	tar jxf "$SPOOL"/$SORCERY -C "$TARGET/usr/src"
+
+	# ensure absolute path for install dir
+	local installdir="$TARGET"
+	[[ $installdir != /* ]] && installdir="$PWD/$TARGET"
+
+	# install sorcery into TARGET
+	pushd "$SORCERYDIR" &> /dev/null
+	./install "$installdir"
+	popd &> /dev/null
+
+	# set up the build sorcery for the correct values
+	# this includes arch, archive=on, preserve=off, and setting the prompt
+	# delay to 0 so that there is no prompting (automated build)
+	case $TYPE in
+		"x86"	) arch="i486"
+			;;
+		"x86_64") arch="x86_64"
+			;;
+		"ppc"	) arch="g3"
+			;;
+	esac
+	cat > "$TARGET"/set_sorcery.sh <<-"CONFIGURE"
+		#!/bin/bash
+		source /etc/sorcery/config
+		modify_config /etc/sorcery/local/config ARCHITECTURE $arch
+		modify_config /etc/sorcery/local/config ARCHIVE on
+		modify_config /etc/sorcery/local/config PRESERVE off
+		modify_config /etc/sorcery/local/config PROMPT_DELAY 0
+	CONFIGURE
+	chmod a+x "$TARGET"/set_sorcery.sh &&
+	msg "Configuring build sorcery"
+	"$MYDIR"/cauldronchr.sh -d "$TARGET" /set_sorcery.sh &&
+	rm -f "$TARGET"/set_sorcery.sh
+
 	# Copy resolv.conf so spell sources can be downloaded inside the TARGET
 	cp -f "$TARGET"/etc/resolv.conf "$TARGET"/tmp/resolv.conf &&
 		cp -f /etc/resolv.conf "$TARGET"/etc/resolv.conf
 
+	# clean out any old sorcery logs in TARGET
+	for logfile in "$LOGS"/activity "$LOGS"/queue/install
+	do
+		rm -f $logfile
+	done
+
 	# If using the linux spell copy the kernel config to TARGET sorcery
 	grep -q '^linux$' "$CAULDRONDIR/$rspells" "$CAULDRONDIR/$ospells" &&
 	cp "$CAULDRONDIR/config-2.6" "$TARGET/etc/sorcery/local/kernel.config"
@@ -209,9 +262,12 @@ function prepare_target() {
 			wget http://download.sourcemage.org/codex/$stable
 		)
 		msg "Updating build grimoire"
-		[[ -d "$codex" ]] || mkdir -p $codex &&
-		tar jxf "$SPOOL"/$stable -C "$codex"/ &&
-		echo "$grimoire" > "$index"
+		[[ -d "$codex" ]] && mv "$codex" "${codex}.old"
+		mkdir -p "$codex" &&
+		tar xf "$SPOOL"/$stable -C "$codex"/ &&
+		[[ -d "${codex}.old" ]] && rm -fr "${codex}.old"
+		echo "$grimoire" > "$index" &&
+		scribe reindex
 
 		# If console-tools is found in TARGET, get rid of it to make
 		# way for kbd
@@ -370,7 +426,7 @@ function setup_sys() {
 	msg "Installing caches into SYSDIR"
 	for cache in $(<"$TARGET"/sys-list)
 	do
-		msg "Unpacking $cache"
+		msg ".. unpacking $cache"
 		tar xjf "$TARGET"/var/cache/sorcery/$cache*.tar.bz2 -C "$SYSDIR"/
 	done
 
@@ -395,7 +451,7 @@ function setup_sys() {
 	msg "Installing sorcery in SYSDIR"
 	tar jxf "$SPOOL"/$SORCERY -C "$TARGET/usr/src"
 
-	# ensure absolute path for install diR
+	# ensure absolute path for install dir
 	local installdir="$SYSDIR"
 	[[ $installdir != /* ]] && installdir="$PWD/$SYSDIR"
 
@@ -415,10 +471,11 @@ function setup_sys() {
 
 	# install the stable grimoire used for build into SYSDIR
 	msg "Installing grimoire ${stable%.tar.bz2} into SYSDIR"
-	[[ -d "$syscodex" ]] || mkdir -p $syscodex &&
-	tar jxf "$SPOOL"/$stable -C "$syscodex"/ &&
-	mv "$syscodex"/${stable%.tar.bz2} "$syscodex"/stable
-	echo "$grimoire" > "$index"
+	[[ -d "$syscodex" ]] && rm -fr "$syscodex"
+	mkdir -p $syscodex &&
+	tar xf "$SPOOL"/$stable -C "$syscodex"/ &&
+	mv "$syscodex"/${stable%.tar.bz2} "$syscodex"/stable &&
+	echo "$grimoire" > "$index" &&
 
 	msg "Reindexing SYSDIR codex"
 	"$MYDIR"/cauldronchr.sh -d "$SYSDIR" /usr/sbin/scribe reindex
@@ -476,7 +533,7 @@ function setup_iso() {
 	msg "Unpacking ISO caches in ISODIR"
 	for cache in $(<"$TARGET"/iso-list)
 	do
-		msg "Unpacking and copying $cache"
+		msg ".. unpacking and copying $cache"
 		tar xjf "$TARGET"/var/cache/sorcery/$cache*.tar.bz2 -C "$ISODIR"/
 		cp "$TARGET"/var/cache/sorcery/$cache*.tar.bz2 "$ISODIR"/var/cache/sorcery/
 	done
@@ -485,7 +542,7 @@ function setup_iso() {
 	msg "Copying optional caches to ISODIR"
 	for cache in $(<"$TARGET"/opt-list)
 	do
-		msg "Copying $cache"
+		msg ".. copying $cache"
 		cp "$TARGET"/var/cache/sorcery/$cache*.tar.bz2 "$ISODIR"/var/cache/sorcery/
 	done
 
@@ -527,6 +584,8 @@ function clean_target() {
 	# installs a hardlink (like ppp)
 	if [[ -f "$TARGET/tmp/resolv.conf" ]]
 	then
+		# rm the real resolv.conf first, needed because ppp makes a symlink
+		rm -f "$TARGET/etc/resolv.conf"
 		cp -f "$TARGET/tmp/resolv.conf" "$TARGET/etc/resolv.conf" &&
 		rm -f "$TARGET/tmp/resolv.conf"
 	fi
@@ -568,15 +627,21 @@ sanity_check
 # chroot and build all of the spells inside the TARGET
 [[ -z $NOBUILD ]] && "$MYDIR/cauldronchr.sh" -d "$TARGET" /build_spells.sh
 
-# unpack sys caches and set up sorcery into SYSDIR
-setup_sys
-touch "$SYSDIR"/etc/ld.so.conf
-"$MYDIR/cauldronchr.sh" -d "$SYSDIR" /sbin/ldconfig
+if [[ -z $BUILDONLY ]]
+then
+	# unpack sys caches and set up sorcery into SYSDIR
+	setup_sys
+	touch "$SYSDIR"/etc/ld.so.conf
+	"$MYDIR/cauldronchr.sh" -d "$SYSDIR" /sbin/ldconfig
 
-# unpack iso caches and copy iso and optional caches into ISODIR
-setup_iso
-touch "$SYSDIR"/etc/ld.so.conf
-"$MYDIR/cauldronchr.sh" -d "$ISODIR" /sbin/ldconfig
+	if [[ -z $CHROOT ]]
+	then
+		# unpack iso caches and copy iso and optional caches into ISODIR
+		setup_iso
+		touch "$SYSDIR"/etc/ld.so.conf
+		"$MYDIR/cauldronchr.sh" -d "$ISODIR" /sbin/ldconfig
+	fi
+fi
 
 # Keep a clean kitchen, wipes up the leftovers from the preparation step
 [[ -z $NOBUILD ]] && clean_target



More information about the SM-Commit mailing list