Added command line options to rebuild-kernel.sh
authorW. Trevor King <wking@drexel.edu>
Tue, 23 Mar 2010 18:11:32 +0000 (14:11 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 23 Mar 2010 18:11:32 +0000 (14:11 -0400)
Added dynamic control over .spec files:
  VERSION_STAMP, ISODIR, REPOSRC, and REPOBIN
  are now set dynamically during a rebuild-kernel.sh run.

Moved mainfiles/setsnapshot.sh to buildscripts/, since it's a just a
helpful maintenance script and contains no build-specific information.

buildscripts/rebuild-kernel.sh
buildscripts/setsnapshot.sh [new file with mode: 0755]
mainfiles/setsnapshot.sh [deleted file]
mainfiles/sysresccd-stage2-altker32.spec
mainfiles/sysresccd-stage2-altker64.spec
mainfiles/sysresccd-stage2-rescue64.spec
mainfiles/sysresccd-stage2-standard.spec

index 0ef5ad5635ee7afe9c5e6c0e8c8c97a412d8b067..546bd38d4e4fd042ed47cb29c0504abcca55352b 100755 (executable)
@@ -1,43 +1,90 @@
 #!/bin/bash
 
-imagename="$1"
+PROG="${0}"
+ISODIR=/worksrc/isofiles
+REPOSRC=/worksrc/sysresccd-src
+REPOBIN=/worksrc/sysresccd-bin
+CATALYSTDIR=/var/tmp/catalyst
 
-case ${imagename} in
+usage()
+{
+       cat <<EOF
+Usage: ${PROG} [options] <imagename>
+
+Build the distribution kernel (and other things?)
+
+imagename: rescue64 | altker32 | altker64
+
+Options:
+ -h|--help         Display this screen and exit
+ -i ISODIR         Directory containing the iso file to rebuild ($ISODIR)
+                     <isodir>/systemrescuecd-<arch>-current.iso
+ -r REPOSRC        Location of git systemrescuecd repo ($REPOSRC)
+ -b REPOBIN        ? ($REPOBIN)
+ -m CATALYSTDIR    Set catalyst's output directory ($CATALYSTDIR)
+
+Distributed under the GNU Public License version 2 - http://www.sysresccd.org
+EOF
+}
+
+while getopts "i:r:b:c:" Option
+do
+       case $Option in
+               i ) ISODIR="$OPTARG";;
+               r ) REPOSRC="$OPTARG";;
+               b ) REPOBIN="$OPTARG";;
+               c ) CATALYSTDIR="$OPTARG";;
+               * ) usage; exit 1;;  # Default, handles -h
+       esac
+done
+shift $(($OPTIND - 1))
+
+IMAGENAME="$1"
+case ${IMAGENAME} in
        rescue64)
                KERTYPE=std
-               ARCHNAME=amd64
+               ARCH=amd64
+               BASEARCH=x86
                LIBDIR=lib64
                ;;
        altker32)
                KERTYPE=alt
-               ARCHNAME=i386
+               ARCH=i386
+               BASEARCH=x86
                LIBDIR=lib
                ;;
        altker64)
                KERTYPE=alt
-               ARCHNAME=amd64
+               ARCH=amd64
+               BASEARCH=x86
                LIBDIR=lib64
                ;;
        *)
-               echo "$0: invalid argument"
+               usage
                exit 1
                ;;
 esac
+VERSION=$(cat ${REPOSRC}/overlay-squashfs-${BASEARCH}/root/version)
 
-(cd /worksrc/sysresccd-src/mainfiles ; nice catalyst -a -f sysresccd-stage2-${imagename}.spec)
+SPEC=$(cat ${REPOSRC}/mainfiles/sysresccd-stage2-${IMAGENAME}.spec \
+    | sed "s!VERSION_STAMP!${VERSION}-${KERTYPE}!" \
+    | sed "s!ISODIR!${ISODIR}!" \
+    | sed "s!REPOSRC!${REPOSRC}!" \
+    | sed "s!REPOBIN!${REPOBIN}!" \
+    )
+(cd ${REPOSRC}/mainfiles ; nice catalyst -a -f <(echo "$SPEC") )
 
-targetdir="/worksrc/sysresccd-bin/overlay-squashfs-x86/${LIBDIR}/modules"
-rootkernel=$(ls -d /var/tmp/catalyst/builds/default/livecd-stage2-${ARCHNAME}-*-${KERTYPE}/isolinux)
-rootmodule=$(ls -d /var/tmp/catalyst/tmp/default/livecd-stage2-${ARCHNAME}-*-${KERTYPE}/${LIBDIR}/modules)
+targetdir="${REPOBIN}/overlay-squashfs-x86/${LIBDIR}/modules"
+rootkernel=$(ls -d ${CATALYSTDIR}/builds/default/livecd-stage2-${ARCH}-*-${KERTYPE}/isolinux)
+rootmodule=$(ls -d ${CATALYSTDIR}/tmp/default/livecd-stage2-${ARCH}-*-${KERTYPE}/${LIBDIR}/modules)
 kerversion=$(ls ${rootmodule})
 
 echo "rootkernel=[${rootkernel}]"
 echo "rootmodule=[${rootmodule}]"
 echo "kerversion=[${rootmodule}]"
 
-echo "cp ${rootkernel}/${imagename}* /worksrc/sysresccd-bin/kernels-x86/"
-cp ${rootkernel}/${imagename}* /worksrc/sysresccd-bin/kernels-x86/
+echo "cp ${rootkernel}/${IMAGENAME}* ${REPOBIN}/kernels-x86/"
+cp ${rootkernel}/${IMAGENAME}* ${REPOBIN}/kernels-x86/
 
 echo "(cd ${rootmodule} ; tar cfj ${targetdir}/${kerversion}.tar.bz2 ${kerversion})"
 (cd ${rootmodule} ; tar cfj ${targetdir}/${kerversion}.tar.bz2 ${kerversion})
-
diff --git a/buildscripts/setsnapshot.sh b/buildscripts/setsnapshot.sh
new file mode 100755 (executable)
index 0000000..14b07c6
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+PROG="${0}"
+REPOSRC=/worksrc/sysresccd-src
+NEWDATE=$(date --date='1 days ago' '+%Y%m%d')
+
+usage()
+{
+       cat <<EOF
+Usage: ${PROG} [options] [NEWDATE]
+
+Replace the snapshot date in REPOSRC/mainfiles/*.spec with NEWDATE (defaults
+to ${NEWDATE}).
+
+Options:
+ -h|--help         Display this screen and exit
+ -r REPOSRC        Location of git systemrescuecd repo ($REPOSRC)
+EOF
+}
+
+while getopts "r:" Option
+do
+       case $Option in
+               r ) REPOSRC="$OPTARG";;
+               * ) usage; exit 1;;  # Default, handles -h
+       esac
+done
+shift $(($OPTIND - 1))
+
+if [ "${1}" == "--help" ]
+then
+       usage
+       exit 1
+fi
+
+if [ -n "${1}" ]
+then
+       NEWDATE="${1}"
+fi
+
+for f in ${REPOSRC}/mainfiles/sysresccd-*.spec
+do
+       sed -i -e "s!^snapshot: [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]!snapshot: ${NEWDATE}!g" ${f}
+done
+
+grep '^snapshot: ' ${REPOSRC}/mainfiles/sysresccd-*.spec
diff --git a/mainfiles/setsnapshot.sh b/mainfiles/setsnapshot.sh
deleted file mode 100755 (executable)
index 69c412f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-if [ -n "${1}" ]
-then
-       newdate="${1}"
-else
-       newdate="$(date --date='1 days ago' +%Y%m%d)"
-fi
-
-for f in sysresccd-*.spec
-do
-       sed -i -e "s!^snapshot: [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]!snapshot: ${newdate}!g" ${f}
-done
-
-grep '^snapshot: ' *.spec
-
index 13729bbd87aa9d205c473e32dae4d046a3817cea..dd087663697e60c28f0deecb502e5ae0ba0ce706 100644 (file)
@@ -5,23 +5,23 @@ rel_type: default
 profile: default/linux/x86/10.0
 snapshot: 20100315
 source_subpath: default/livecd-stage1-i386-1.5
-portage_confdir: /worksrc/sysresccd-src/portage-etc-x86
-portage_overlay: /worksrc/sysresccd-src/portage-overlay
+portage_confdir: REPOSRC/portage-etc-x86
+portage_overlay: REPOSRC/portage-overlay
 
 livecd/fstype: none
 livecd/cdtar: /usr/lib/catalyst/livecd/cdtar/isolinux-3.09-cdtar.tar.bz2
-livecd/iso: /worksrc/isofiles/systemrescuecd-x86-current.iso
+livecd/iso: ISODIR/systemrescuecd-x86-current.iso
 livecd/splash_type: 
 livecd/splash_theme: 
 livecd/bootargs: dokeymap
 livecd/gk_mainargs: --makeopts="-j5"
-livecd/linuxrc: /worksrc/sysresccd-src/mainfiles/linuxrc
+livecd/linuxrc: REPOSRC/mainfiles/linuxrc
 livecd/type: generic-livecd
 livecd/readme:
 livecd/motd: 
 livecd/modblacklist:
-livecd/overlay: /worksrc/sysresccd-src/overlay-iso-x86
-livecd/root_overlay: /worksrc/sysresccd-src/overlay-squashfs-x86
+livecd/overlay: REPOSRC/overlay-iso-x86
+livecd/root_overlay: REPOSRC/overlay-squashfs-x86
 livecd/devmanager: udev
 livecd/users:
 livecd/volid: sysresccd
@@ -29,10 +29,10 @@ livecd/volid: sysresccd
 boot/kernel: altker32
 
 boot/kernel/altker32/sources: sys-kernel/alt-sources
-boot/kernel/altker32/config: /worksrc/sysresccd-src/kernelcfg/config-x86-2.6.27-alt150.conf
+boot/kernel/altker32/config: REPOSRC/kernelcfg/config-x86-2.6.27-alt150.conf
 boot/kernel/altker32/use: pcmcia usb -X png truetype 
 boot/kernel/altker32/extraversion: i386
-boot/kernel/altker32/initramfs_overlay: /worksrc/sysresccd-src/overlay-initramfs
+boot/kernel/altker32/initramfs_overlay: REPOSRC/overlay-initramfs
 boot/kernel/altker32/packages:
        app-accessibility/speakup
        net-dialup/speedtouch-usb
index 9c7ad87f39c69c1f9ee0dcbb3ac3dcde8130e517..1f22f02cd9749781214fb39b263436d7b92ff9eb 100644 (file)
@@ -1,27 +1,27 @@
 subarch: amd64
-version_stamp: 1.5-alt
+version_stamp: VERSION_STAMP
 target: livecd-stage2
 rel_type: default
 profile: default/linux/x86/10.0
 snapshot: 20100315
 source_subpath: default/livecd-stage1-amd64-1.5
-portage_confdir: /worksrc/sysresccd-src/portage-etc-x86
-portage_overlay: /worksrc/sysresccd-src/portage-overlay
+portage_confdir: REPOSRC/portage-etc-x86
+portage_overlay: REPOSRC/portage-overlay
 
 livecd/fstype: none
 livecd/cdtar: /usr/lib/catalyst/livecd/cdtar/isolinux-3.09-cdtar.tar.bz2
-livecd/iso: /worksrc/isofiles/systemrescuecd-amd64-current.iso
+livecd/iso: ISODIR/systemrescuecd-amd64-current.iso
 livecd/splash_type: 
 livecd/splash_theme: 
 livecd/bootargs: dokeymap
 livecd/gk_mainargs: --makeopts="-j5"
-livecd/linuxrc: /worksrc/sysresccd-src/mainfiles/linuxrc
+livecd/linuxrc: REPOSRC/mainfiles/linuxrc
 livecd/type: generic-livecd
 livecd/readme:
 livecd/motd: 
 livecd/modblacklist:
-livecd/overlay: /worksrc/sysresccd-src/overlay-iso-x86
-livecd/root_overlay: /worksrc/sysresccd-src/overlay-squashfs-x86
+livecd/overlay: REPOSRC/overlay-iso-x86
+livecd/root_overlay: REPOSRC/overlay-squashfs-x86
 livecd/devmanager: udev
 livecd/users:
 livecd/volid: sysresccd
@@ -31,10 +31,10 @@ livecd/rcdel: spind|default
 boot/kernel: altker64
 
 boot/kernel/altker64/sources: sys-kernel/alt-sources
-boot/kernel/altker64/config: /worksrc/sysresccd-src/kernelcfg/config-amd64-2.6.27-alt150.conf
+boot/kernel/altker64/config: REPOSRC/kernelcfg/config-amd64-2.6.27-alt150.conf
 boot/kernel/altker64/use: pcmcia usb -X png truetype 
 boot/kernel/altker64/extraversion: amd64
-boot/kernel/altker64/initramfs_overlay: /worksrc/sysresccd-src/overlay-initramfs
+boot/kernel/altker64/initramfs_overlay: REPOSRC/overlay-initramfs
 boot/kernel/altker64/packages:
        app-accessibility/speakup
        net-dialup/hsfmodem
index aac611c9bd4684fd775c1531530a9401708718bf..e91999916d9add96c8f1521bf6fdecd627b2a666 100644 (file)
@@ -1,27 +1,27 @@
 subarch: amd64
-version_stamp: 1.5-std
+version_stamp: VERSION_STAMP
 target: livecd-stage2
 rel_type: default
 profile: default/linux/x86/10.0
 snapshot: 20100315
 source_subpath: default/livecd-stage1-amd64-1.5
-portage_confdir: /worksrc/sysresccd-src/portage-etc-x86
-portage_overlay: /worksrc/sysresccd-src/portage-overlay
+portage_confdir: REPOSRC/portage-etc-x86
+portage_overlay: REPOSRC/portage-overlay
 
 livecd/fstype: none
 livecd/cdtar: /usr/lib/catalyst/livecd/cdtar/isolinux-3.09-cdtar.tar.bz2
-livecd/iso: /worksrc/isofiles/systemrescuecd-amd64-current.iso
+livecd/iso: ISODIR/systemrescuecd-amd64-current.iso
 livecd/splash_type: 
 livecd/splash_theme: 
 livecd/bootargs: dokeymap
 livecd/gk_mainargs: --makeopts="-j5"
-livecd/linuxrc: /worksrc/sysresccd-src/mainfiles/linuxrc
+livecd/linuxrc: REPOSRC/mainfiles/linuxrc
 livecd/type: generic-livecd
 livecd/readme:
 livecd/motd: 
 livecd/modblacklist:
-livecd/overlay: /worksrc/sysresccd-src/overlay-iso-x86
-livecd/root_overlay: /worksrc/sysresccd-src/overlay-squashfs-x86
+livecd/overlay: REPOSRC/overlay-iso-x86
+livecd/root_overlay: REPOSRC/overlay-squashfs-x86
 livecd/devmanager: udev
 livecd/users:
 livecd/volid: sysresccd
@@ -29,10 +29,10 @@ livecd/volid: sysresccd
 boot/kernel: rescue64
 
 boot/kernel/rescue64/sources: sys-kernel/std-sources
-boot/kernel/rescue64/config: /worksrc/sysresccd-src/kernelcfg/config-amd64-2.6.32-std150.conf
+boot/kernel/rescue64/config: REPOSRC/kernelcfg/config-amd64-2.6.32-std150.conf
 boot/kernel/rescue64/use: pcmcia usb -X png truetype 
 boot/kernel/rescue64/extraversion: amd64
-boot/kernel/rescue64/initramfs_overlay: /worksrc/sysresccd-src/overlay-initramfs
+boot/kernel/rescue64/initramfs_overlay: REPOSRC/overlay-initramfs
 boot/kernel/rescue64/packages:
        net-dialup/speedtouch-usb
        net-dialup/hsfmodem
index 91456f50de7b2c2c46361ca857b6894700363b81..ee6ff85d381348437511b95f32650610660d0663 100644 (file)
@@ -1,27 +1,27 @@
 subarch: i386
-version_stamp: 1.5-std
+version_stamp: VERSION_STAMP
 target: livecd-stage2
 rel_type: default
 profile: default/linux/x86/10.0
 snapshot: 20100315
 source_subpath: default/livecd-stage1-i386-1.5
-portage_confdir: /worksrc/sysresccd-src/portage-etc-x86
-portage_overlay: /worksrc/sysresccd-src/portage-overlay
+portage_confdir: REPOSRC/portage-etc-x86
+portage_overlay: REPOSRC/portage-overlay
 
 livecd/fstype: squashfs
 livecd/cdtar: /usr/lib/catalyst/livecd/cdtar/isolinux-3.09-cdtar.tar.bz2
-livecd/iso: /worksrc/isofiles/systemrescuecd-x86-current.iso
-livecd/fsscript: /worksrc/sysresccd-src/mainfiles/fsscript.sh
+livecd/iso: ISODIR/systemrescuecd-x86-current.iso
+livecd/fsscript: REPOSRC/mainfiles/fsscript.sh
 livecd/splash_type:
 livecd/splash_theme:
 livecd/bootargs: dokeymap
 livecd/gk_mainargs: --makeopts="-j5"
-livecd/linuxrc: /worksrc/sysresccd-src/mainfiles/linuxrc
+livecd/linuxrc: REPOSRC/mainfiles/linuxrc
 livecd/type: generic-livecd
 livecd/readme:
 livecd/motd:
 livecd/modblacklist:
-livecd/root_overlay: /worksrc/sysresccd-bin/overlay-squashfs-x86 /worksrc/sysresccd-src/overlay-squashfs-x86
+livecd/root_overlay: REPOBIN/overlay-squashfs-x86 REPOSRC/overlay-squashfs-x86
 livecd/devmanager: udev
 livecd/users:
 livecd/volid: sysresccd
@@ -31,7 +31,7 @@ livecd/rcdel: nfsmount|default metalog|default consolefont|boot termencoding|boo
 boot/kernel: rescuecd
 
 boot/kernel/rescuecd/sources: sys-kernel/std-sources
-boot/kernel/rescuecd/config: /worksrc/sysresccd-src/kernelcfg/config-x86-2.6.32-std150.conf
+boot/kernel/rescuecd/config: REPOSRC/kernelcfg/config-x86-2.6.32-std150.conf
 boot/kernel/rescuecd/use: pcmcia usb -X png truetype 
 boot/kernel/rescuecd/extraversion: i386
 boot/kernel/rescuecd/packages: