From c135a0903c9ef2b51d3f79b116dd1eb0d7a4a159 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 23 Mar 2010 14:11:32 -0400 Subject: [PATCH] Added command line options to rebuild-kernel.sh 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 | 73 +++++++++++++++++++----- buildscripts/setsnapshot.sh | 46 +++++++++++++++ mainfiles/setsnapshot.sh | 16 ------ mainfiles/sysresccd-stage2-altker32.spec | 16 +++--- mainfiles/sysresccd-stage2-altker64.spec | 18 +++--- mainfiles/sysresccd-stage2-rescue64.spec | 18 +++--- mainfiles/sysresccd-stage2-standard.spec | 16 +++--- 7 files changed, 140 insertions(+), 63 deletions(-) create mode 100755 buildscripts/setsnapshot.sh delete mode 100755 mainfiles/setsnapshot.sh diff --git a/buildscripts/rebuild-kernel.sh b/buildscripts/rebuild-kernel.sh index 0ef5ad5..546bd38 100755 --- a/buildscripts/rebuild-kernel.sh +++ b/buildscripts/rebuild-kernel.sh @@ -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 < + +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) + /systemrescuecd--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 index 0000000..14b07c6 --- /dev/null +++ b/buildscripts/setsnapshot.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +PROG="${0}" +REPOSRC=/worksrc/sysresccd-src +NEWDATE=$(date --date='1 days ago' '+%Y%m%d') + +usage() +{ + cat <