Revert "previous commit requires lots of changes in other modules so introduce a...
[bootcd.git] / kvariant.sh
index f369d28..2613fa9 100755 (executable)
@@ -49,15 +49,19 @@ set -e
 variant=$1; shift
 [[ -z "$@" ]] && usage
 kernelrpm_url=$1; shift
+if [[ -n "$@" ]] ; then
+    extrarpm_url=$1; shift
+fi
 [[ -n "$@" ]] && usage
 
-standard_path="/usr/share/bootcd/build"
+basedir=$(cd -P $(dirname $0); pwd)
+standard_path="$basedir/build"
 if [ ! -d $standard_path ] ; then
     echo "Cound not find standard image $standard_path - exiting"
     exit 1
 fi
 
-variant_path=/usr/share/bootcd/$variant
+variant_path="$basedir/$variant"
 if [ -e $variant_path ] ; then
     echo "Found $variant_path - please remove first - exiting"
     exit 1
@@ -72,6 +76,12 @@ kernelrpm=$variant_path/$(basename $kernelrpm_url)
 getrpm $kernelrpm_url $kernelrpm
 checkrpm $kernelrpm
 
+if [ -n "$extrarpm_url" ] ; then
+    extrarpm=$variant_path/$(basename $extrarpm_url)
+    getrpm $extrarpm_url $extrarpm
+    checkrpm $extrarpm
+fi
+
 isofsdir=$variant_path/isofs
 
 tmpdir=
@@ -89,6 +99,10 @@ rm -rf boot/*
 rm -rf lib/modules
 echo "Replacing with new kernel"
 rpm2cpio  $kernelrpm | cpio -diu
+if [ -n $"extrarpm_url" ] ; then
+    echo "Unpacking $extrarpm"
+    rpm2cpio  $extrarpm | cpio -diu
+fi
 echo "Running depmod"
 version=$(cd ./boot && ls vmlinuz* | sed 's,vmlinuz-,,')
 depmod -b . $version
@@ -114,7 +128,7 @@ mv ${tmpdir}/bootcd.img ${isofsdir}/bootcd.img
 echo -n " bootcd.img"
 echo ""
 
-rm -rf $tmpdir
+rm -rf $tmpdir $kernelrpm $extrarpm
 
 echo "new variant $variant ready"
 trap - ERR