kmerge.sh: Fix line wrapping typo from 9ceebbf
[catalyst.git] / targets / support / kmerge.sh
old mode 100755 (executable)
new mode 100644 (file)
index ed7030b..e78e0b4
@@ -49,21 +49,26 @@ setup_gk_args() {
        then
                GK_ARGS="${GK_ARGS} --kernel-cc=/usr/lib/ccache/bin/gcc --utils-cc=/usr/lib/ccache/bin/gcc"
        fi
-       
-       if [ "${clst_devmanager}" == "devfs" ]
-       then
-               GK_ARGS="${GK_ARGS} --no-udev"
-       fi
 
        if [ -n "${clst_linuxrc}" ]
        then
                GK_ARGS="${GK_ARGS} --linuxrc=/tmp/linuxrc"
        fi
 
-    if [ "${clst_target}" == "netboot2" -a -n "${clst_merge_path}" ]
-    then
-        GK_ARGS="${GK_ARGS} --initramfs-overlay=\"${clst_merge_path}\""
-    fi
+       if [ -n "${clst_busybox_config}" ]
+       then
+               GK_ARGS="${GK_ARGS} --busybox-config=/tmp/busy-config"
+       fi
+
+       if [ "${clst_target}" == "netboot2" ]
+       then
+               GK_ARGS="${GK_ARGS} --netboot"
+
+               if [ -n "${clst_merge_path}" ]
+               then
+                       GK_ARGS="${GK_ARGS} --initramfs-overlay=\"${clst_merge_path}\""
+               fi
+       fi
 }
 
 genkernel_compile(){
@@ -72,16 +77,19 @@ genkernel_compile(){
 
        setup_gk_args
        #echo "The GK_ARGS are"
-       #echo ${GK_ARGS}        
+       #echo ${GK_ARGS}
        export clst_kernel_merge
        export clst_initramfs_overlay
        # Build our list of kernel packages
-       if [ "${clst_livecd_type}" = "gentoo-release-livecd" ] \
-       && [ -n "${clst_kernel_merge}" ]
-       then
-               mkdir -p /usr/livecd
-               echo "${clst_kernel_merge}" > /usr/livecd/kernelpkgs.txt
-       fi
+       case ${clst_livecd_type} in
+               gentoo-release-live*)
+                       if [ -n "${clst_kernel_merge}" ]
+                       then
+                               mkdir -p /usr/livecd
+                               echo "${clst_kernel_merge}" > /usr/livecd/kernelpkgs.txt
+                       fi
+               ;;
+       esac
        # Build with genkernel using the set options
        # callback is put here to avoid escaping issues
        gk_callback_opts="-qN"
@@ -101,8 +109,11 @@ genkernel_compile(){
        else
                genkernel ${GK_ARGS} || exit 1
        fi
-       md5sum /var/tmp/${clst_kname}.config | awk '{print $1}' > \
-               /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
+       if [ -e /var/tmp/${clst_kname}.config ]
+       then
+               md5sum /var/tmp/${clst_kname}.config | awk '{print $1}' > \
+                       /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
+       fi
 }
 
 build_kernel() {
@@ -133,15 +144,15 @@ fi
 # USE variables (and thus different patches enabled/disabled.) Also, there's no
 # real benefit in using the pkgcache for kernel source ebuilds.
 
-USE_MATCH=0 
+USE_MATCH=0
 if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ]
 then
        STR1=$(for i in `cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
        STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort)
        if [ "${STR1}" = "${STR2}" ]
-       then 
+       then
                #echo "USE Flags match"
-               USE_MATCH=1 
+               USE_MATCH=1
        else
                if [ -n "${clst_KERNCACHE}" ]
                then
@@ -159,7 +170,7 @@ then
        STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION`
        STR2=${clst_kextraversion}
        if [ "${STR1}" = "${STR2}" ]
-       then 
+       then
                if [ -n "${clst_KERNCACHE}" ]
                then
                        #echo "EXTRAVERSION match"
@@ -169,22 +180,24 @@ then
 fi
 
 CONFIG_MATCH=0
-if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
+if [ -n "${clst_KERNCACHE}" -a \
+     -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
 then
-       STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
-       STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
-       if [ "${STR1}" = "${STR2}" ]
-       then 
-               if [ -n "${clst_KERNCACHE}" ]
+       if [ ! -e /var/tmp/${clst_kname}.config ]
+       then
+               CONFIG_MATCH=1
+       else
+               STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
+               STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
+               if [ "${STR1}" = "${STR2}" ]
                then
-                       #echo "CONFIG match"
                        CONFIG_MATCH=1
                fi
        fi
 fi
 
-[ -e /etc/make.conf ] && \
-       echo "USE=\"\${USE} ${clst_kernel_use} build\"" >> /etc/make.conf
+[ -e /etc/portage/make.conf ] && \
+       echo "USE=\"\${USE} ${clst_kernel_use} build\"" >> /etc/portage/make.conf
 
 if [ -n "${clst_KERNCACHE}" ]
 then
@@ -196,7 +209,7 @@ then
                mkdir -p /etc/portage/profile
                echo "${KERNELVERSION}" > /etc/portage/profile/package.provided
        else
-               if ( ! grep -q "^${KERNELVERSION}\$"  /etc/portage/profile/package.provided ) 
+               if ( ! grep -q "^${KERNELVERSION}\$"  /etc/portage/profile/package.provided )
                then
                        echo "${KERNELVERSION}" >> /etc/portage/profile/package.provided
                fi
@@ -218,13 +231,13 @@ then
                echo "Setting extraversion to ${clst_kextraversion}"
                sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
                echo ${clst_kextraversion} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
-       else 
+       else
                touch /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
        fi
 fi
 
 build_kernel
-sed -i "/USE=\"\${USE} ${clst_kernel_use} build\"/d" /etc/make.conf
+sed -i "/USE=\"\${USE} ${clst_kernel_use} build\"/d" /etc/portage/make.conf
 # grep out the kernel version so that we can do our modules magic
 VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
 PAT=`grep ^PATCHLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
@@ -242,6 +255,6 @@ if [ -n "${clst_KERNCACHE}" ]
 then
        if [ -e /etc/portage/profile/package.provided ]
        then
-               sed -i "/^${KERNELVERSION}\$/d" /etc/portage/profile/package.provided
+               sed -i "/^$(echo "${KERNELVERSION}" | sed -e 's|/|\\/|g')\$/d" /etc/portage/profile/package.provided
        fi
 fi