Skip to Content.
Sympa Menu

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

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 (e8738e5e14a4292782faddbff262ef58ee22c7c7)
  • Date: Thu, 8 Jan 2009 12:24:48 -0600

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

scripts/add-sauce.sh | 3 ++
scripts/mkinitrd.sh | 68
+++++++++++++++++++++++++++++++++------------------
scripts/mkiso.sh | 24 +++++++++---------
scripts/mkrelease.sh | 24 ++++++++----------
scripts/mksystem.sh | 36 +++++++++++++++------------
5 files changed, 92 insertions(+), 63 deletions(-)

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

scripts/mkinitrd.sh: try to find kernel version

Try to automatically find the kernel version if it isn't specified on
the command-line. This works by checking to see if there is only one
kernel module directory in the ISO chroot, and using the version it
finds there. This should always work, because there should only be one
kernel version per ISO, but it's possible someone will use the scripts
to make an ISO with multiple kernel versions, in which case the version
will have to be specified as the first argument of the script.

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

scripts/mkinitrd.sh: more checking, default output

Added better sanity checks on the iso chroot dir, and defaulted the
output to be ISO/boot/initrd.gz instead of the current directory.

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

scripts/mk*.sh: standardize script invocation

Standardized all the scripts to accept -i,-s flags to get the iso and
sys paths.

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

scripts/add-sauce.sh: don't add grub config to ISO

The ISO doesn't boot with grub, and even if it did this is a sample
config, so don't add it.

diff --git a/scripts/add-sauce.sh b/scripts/add-sauce.sh
index 96f9d96..d069012 100755
--- a/scripts/add-sauce.sh
+++ b/scripts/add-sauce.sh
@@ -124,6 +124,9 @@ if [[ $TYPE == "iso" ]] ;then
# into the TEMPDIR staging area
echo "Copying ISO files to staging area"
cp -a "$MYDIR"/iso/* "$TEMPDIR"/
+
+ # strip boot/grub from the staging area, since the ISO doesn't need this
file
+ rm -fr "$TEMPDIR"/boot/grub
fi

# System Sauce
diff --git a/scripts/mkinitrd.sh b/scripts/mkinitrd.sh
index efed2e7..b3412c6 100755
--- a/scripts/mkinitrd.sh
+++ b/scripts/mkinitrd.sh
@@ -3,17 +3,13 @@

function usage() {
cat << EndUsage
-Usage: $(basename $0) [-o OUTPUT_FILE] /path/to/target ISO_KERNEL_VERSION
+Usage: $(basename $0) [-o OUTPUT_FILE] [-i ISO] [ISO_KERNEL_VERSION]

Generates an initrd using /path/to/target. The output file is named initrd.gz
and is placed in the current working directory by default, but can be
overridden by the -o option. This script requires superuser privileges.

Required:
- /path/to/target
- The target directory you would like to chroot to. Defaults to
- current working directory.
-
ISO_KERNEL_VERSION
A string that specifies the version of the kernel to use.
Typically
you will only have one kernel version in your iso build directory,
@@ -21,18 +17,21 @@ Required:
so you need to specify the version the initrd will be built
against.
Options:
+ -i Path to iso build directory (ISO). Defaults to /tmp/cauldron/iso.
+
-o FILENAME
Specify the output file as FILENAME (can include a path prefix).
- Defaults to "initrd.gz" in the current working directory.
+ Defaults to ISO/boot/initrd.gz.

-h Shows this help information.
EndUsage
exit 1
} >&2

-while getopts ":o:h" Options
+while getopts ":i:o:h" Options
do
case $Options in
+ i ) ISODIR="$OPTARG" ;;
o ) OUTPUT="$OPTARG" ;;
h ) usage ;;
* ) echo "Unrecognized option" >&2 && usage ;;
@@ -53,26 +52,47 @@ then
fi
fi

-[[ $# -ne 2 ]] && usage
-ISO_DIR=$1
-KERNEL_VERSION=$2
+ISODIR="${ISODIR:-/tmp/cauldron/iso}"

# ensure full pathnames
-if [[ $(dirname "$ISO_DIR") == "." ]]
+if [[ $(dirname "$ISODIR") != /* ]]
+then
+ ISODIR="$(pwd)/$ISODIR"
+fi
+
+# make sure that ISODIR is a directory
+if [[ -d $ISODIR ]]
then
- ISO_DIR="$(pwd)/$ISO_DIR"
+ echo "Chroot dir: $ISODIR"
+else
+ echo "error: $ISODIR is not a directory"
+ exit 2
fi
-echo "Chroot dir: $ISO_DIR"

-OUTPUT="${OUTPUT:-./initrd.gz}"
+OUTPUT="${OUTPUT:-$ISODIR/boot/initrd.gz}"
+
+KERNEL_VERSION="$1"
+# try to get the kernel version if not specified
+if [[ -z $KERNEL_VERSION ]]
+then
+ modules="$ISODIR/lib/modules"
+ if [[ $(find $modules -mindepth 1 -maxdepth 1 -type d | wc -l) -eq 1 ]]
+ then
+ KERNEL_VERSION="$(find $modules -mindepth 1 -maxdepth 1 -type d)"
+ KERNEL_VERSION="${KERNEL_VERSION##*/}"
+ else
+ echo "Kernel version could not be determined, bailing out!"
+ exit 3
+ fi
+fi

-if ! [[ -d "$ISO_DIR"/lib/modules/$KERNEL_VERSION/kernel ]] ;then
+if ! [[ -d "$ISODIR"/lib/modules/$KERNEL_VERSION/kernel ]] ;then
echo "Chroot failed sanity check:"
- echo "Unable to find $ISO_DIR/lib/modules/$KERNEL_VERSION/kernel"
+ echo "Unable to find $ISODIR/lib/modules/$KERNEL_VERSION/kernel"
exit 2
fi >&2

-if ! [[ -f "$ISO_DIR"/isolinux/isolinux.cfg ]]
+if ! [[ -f "$ISODIR"/isolinux/isolinux.cfg ]]
then
echo "Chroot failed sanity check:"
echo "Chroot is missing isolinux.cfg!"
@@ -92,7 +112,7 @@ EXECDIRS=(bin sbin usr/bin usr/sbin)
#---------------------------------------------------------------------
# Used to implicitly install linked-against-libs to the initrd with a binary
function libscan() {
- chroot $ISO_DIR /usr/bin/ldd "$1" |
+ chroot $ISODIR /usr/bin/ldd "$1" |
grep '/' |
cut -f 2 |
sed -e 's/.*=> //' |
@@ -104,7 +124,7 @@ function libscan() {
# by running libscan (ldd returns symlinks if that's what the binary
# links to). The leading '/' is removed for convenience.
function reallib() {
- chroot $ISO_DIR readlink -f $1 |
+ chroot $ISODIR readlink -f $1 |
sed -e 's/^[/]//'
}

@@ -130,7 +150,7 @@ function install_prog() {
for prog in $* ;do
# find executable
progpath=$(my_which $prog) &&
- # install executable (path will be relative to $ISO_DIR)
+ # install executable (path will be relative to $ISODIR)
cp --parents -f $progpath $INITRDROOT &&
# install needed libs
for i in $(libscan $progpath) ; do
@@ -175,9 +195,9 @@ function mk_initrd_file() {

rm -rf $tmp_file $tmp_mountdir
echo "initrd is at $2, compressed $(du -ks $2 | cut -d$'\t' -f1)K,
uncompressed ${initrd_size}K."
- if grep -q '@INITRD_SIZE@' "$ISO_DIR"/isolinux/isolinux.cfg
+ if grep -q '@INITRD_SIZE@' "$ISODIR"/isolinux/isolinux.cfg
then
- sed -i "s/@INITRD_SIZE@/$initrd_size/" "$ISO_DIR"/isolinux/isolinux.cfg
+ sed -i "s/@INITRD_SIZE@/$initrd_size/" "$ISODIR"/isolinux/isolinux.cfg
else
echo "Don't forget to adjust isolinux.cfg for the new size."
fi
@@ -197,7 +217,7 @@ rm -rf $INITRDROOT
mkdir -p $INITRDROOT

# Unless otherwise noted, this is our working directory.
-pushd $ISO_DIR >/dev/null
+pushd $ISODIR >/dev/null

# Create all dirs we need on the initrd
echo "Creating dirs..."
@@ -234,7 +254,7 @@ touch $INITRDROOT/var/log/dmesg
# Add kernel modules that are supposed to be on the iso
echo "adding kernel modules"
mkdir -p ${INITRDROOT}/lib/modules/${KERNEL_VERSION}/kernel
-pushd $ISO_DIR/lib/modules/${KERNEL_VERSION}/kernel >/dev/null
+pushd $ISODIR/lib/modules/${KERNEL_VERSION}/kernel >/dev/null
while read line ; do
cp -pr --parents ./${line}
${INITRDROOT}/lib/modules/${KERNEL_VERSION}/kernel
done <$MYDIR/data/initrd.kernel
diff --git a/scripts/mkiso.sh b/scripts/mkiso.sh
index c4e7147..6625741 100755
--- a/scripts/mkiso.sh
+++ b/scripts/mkiso.sh
@@ -6,18 +6,14 @@ KEEP=

function usage() {
cat << EndUsage
-Usage: $(basename $0) [-hu] /path/to/target ISO_VERSION
+Usage: $(basename $0) [-hu] [-i ISO] ISO_VERSION

-Generates a bootable iso9660 iso file using /path/to/target. The output file
is
-named ISO_VERSION. Also creates metadata information appropriate to the iso
+Generates a bootable iso9660 iso file. The output file is named ISO_VERSION
in
+the current directory. Also creates metadata information appropriate to the
iso
(publisher, preparer, volume_id, etc.). Uses ISO_VERSION for the volume_id
field. This script requires superuser privileges.

Required:
- /path/to/target
- The target directory you would like to chroot to. Defaults to
- current working directory.
-
ISO_VERSION
A string that specifies the filename of the iso output file.
You must specify an absolute path or the command will not likely
be
@@ -25,6 +21,8 @@ Required:
the command to execute, or to set the command to be /bin/bash -l
some_command_without_abs_path). Defaults to "/bin/bash -l".
Options:
+ -i Path to iso build directory (ISO). Defaults to /tmp/cauldron/iso.
+
-u Change ownership of output files to $UID:$GID. You must specify
the
$UID:$GID pair as a string such as root:root or 0:0 or the script
will fail.
@@ -39,9 +37,10 @@ EndUsage
exit 1
} >&2

-while getopts ":ku:zh" Options
+while getopts ":i:ku:zh" Options
do
case $Options in
+ i ) ISODIR="$OPTARG" ;;
k ) KEEP="-k" ;;
u ) ISOCHOWN=true
CHOWNSTR="$OPTARG"
@@ -65,10 +64,13 @@ then
exec su -c "$SELF $*" root
fi
fi
-ISO_CHROOT=$1
-ISO_VERSION=$2

-mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot
-boot-load-size 4 -boot-info-table -V ${ISO_VERSION} -publisher "Source Mage
GNU/Linux" -p "Cauldron" -o "${ISO_VERSION}.iso" "$ISO_CHROOT"
+ISODIR="${ISODIR:-/tmp/cauldron/iso}"
+
+[[ $# -ne 1 ]] && usage
+ISO_VERSION=$1
+
+mkisofs -R -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot
-boot-load-size 4 -boot-info-table -V ${ISO_VERSION} -publisher "Source Mage
GNU/Linux" -p "Cauldron" -o "${ISO_VERSION}.iso" "$ISODIR"

if $COMPRESS || [[ -n $KEEP ]]
then
diff --git a/scripts/mkrelease.sh b/scripts/mkrelease.sh
index 7f38c66..b7f9b75 100755
--- a/scripts/mkrelease.sh
+++ b/scripts/mkrelease.sh
@@ -2,24 +2,16 @@

MYDIR="$(dirname $0)"

-TARGET=$1
-VERSION=$2
-
ISOCHOWN=""

function usage() {
cat << EndUsage
-Usage: $(basename $0) [-h] /path/to/target VERSION
+Usage: $(basename $0) [-h] [-i ISO] VERSION

-Creates an official release ISO from /path/to/target for the ISO
-version specified as VERSION. This script requires superuser
-privileges.
+Creates an official release ISO for the ISO version specified as VERSION.
This
+script requires superuser privileges.

Required:
- /path/to/target
- The target directory you would like to make a releasable
- ISO from.
-
VERSION
A string which describes the version of the ISO to
release. Since this script is for making official
@@ -27,6 +19,8 @@ Required:
resulting in smgl-VERSION.iso for the final ISO output.

Options:
+ -i Path to iso build directory (ISO). Defaults to /tmp/cauldron/iso.
+
-u Change ownership of output files to $UID:$GID. You must specify
the
$UID:$GID pair as a string such as root:root or 0:0 or the script
will fail.
@@ -36,9 +30,10 @@ EndUsage
exit 1
} >&2

-while getopts ":u:h" Option
+while getopts ":i:u:h" Option
do
case $Option in
+ i ) TARGET="$OPTARG" ;;
u ) ISOCHOWN="-u"
CHOWNSTR="$OPTARG"
;;
@@ -61,7 +56,10 @@ then
fi
fi

-[[ $# -lt 2 ]] && usage
+TARGET="${TARGET:-/tmp/cauldron/iso}"
+
+[[ $# -ne 1 ]] && usage
+VERSION=$1

# Get the grimoire version used to generate all the spells in the ISO.
GRIMOIRE_VER=$(head -n1 "$TARGET"/etc/grimoire_version)
diff --git a/scripts/mksystem.sh b/scripts/mksystem.sh
index 9058875..caabbd6 100755
--- a/scripts/mksystem.sh
+++ b/scripts/mksystem.sh
@@ -2,18 +2,16 @@

function usage() {
cat << EndUsage
-Usage: $(basename $0) /path/to/target /path/to/output
+Usage: $(basename $0) [-hv] [-i ISO] [-s SYS]
Generates a compressed tarball of the "system" directory specified in
/path/to/target. This script requires superuser privileges.

-Required:
- /path/to/target
- The path to the "system" directory.
+Options:
+ -i Path to iso build directory (ISO). Defaults to /tmp/cauldron/iso.

- /path/to/output
- The path to the desired output file.
+ -s Path to system build directory (SYS). Defaults to
+ /tmp/cauldron/system.

-Options:
-v if specified, tar progress is output to STDOUT

-h Shows this help information
@@ -21,9 +19,11 @@ EndUsage
exit 1
} >&2

-while getopts ":vh" Option
+while getopts ":i:s:vh" Option
do
case $Option in
+ i ) ISODIR="$OPTARG" ;;
+ s ) SYSDIR="$OPTARG" ;;
v ) VERBOSE="-v" ;;
h ) usage ;;
* ) echo "Unrecognized option." >&2 && usage ;;
@@ -44,16 +44,22 @@ then
fi
fi

-SYSDIR=${1:-system}
-SYSTAR="${2:-$(basename $SYSDIR).tar.bz2}"
+SYSDIR="${SYSDIR:-/tmp/cauldron/sys}"
+ISODIR="${ISODIR:-/tmp/cauldron/iso}"
+
+[[ -z $SYSDIR || ! -d $SYSDIR ]] && usage
+[[ -z $ISODIR || ! -d $ISODIR ]] && usage
+
+SYSTAR="$ISODIR/system.tar.bz2"

-[[ -z $SYSDIR ]] && usage
+[[ $(dirname $SYSDIR) != /* ]] && SYSDIR="$PWD/$SYSDIR"
+[[ $(dirname $SYSTAR) != /* ]] && SYSTAR="$PWD/$SYSTAR"

-[[ $(dirname $SYSDIR) == '.' ]] && SYSDIR="$PWD/$SYSDIR"
-[[ $(dirname $SYSTAR) == '.' ]] && SYSTAR="$PWD/$SYSTAR"
+echo "Entering $SYSDIR"
+cd $SYSDIR &&

-cd $SYSDIR
- tar $VERBOSE -jcf "$SYSTAR" *
+echo "Creating $SYSTAR, please be patient"
+tar $VERBOSE -jcf "$SYSTAR" *
echo "Output written to: $SYSTAR"

exit



  • [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (e8738e5e14a4292782faddbff262ef58ee22c7c7), Justin Boffemmyer, 01/08/2009

Archive powered by MHonArc 2.6.24.

Top of Page