commit:     ba88b2e852c94222437dc9567d15942210ef5b6f
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 23 21:58:31 2014 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Jun 23 22:05:18 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=ba88b2e8

gen_package: packaged kernel/initramfs name fixes

Previous commit 76e801c8 did not actually go far enough.

The existing install from kerncache code that is normally used with
passing --install used a form of kernel-${KNAME}-${ARCH}-${KV}.

Instead of just the kernel-${ARCH}-${KV} we were using in commit
76e801c8, or kernel-${KV} that we used before that, let's use the same
naming per the regular path.

Also add safety checks that the kernels exist, as you could get an empty
tarball otherwise!

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 gen_package.sh | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/gen_package.sh b/gen_package.sh
index 1a9068a..9dd166b 100755
--- a/gen_package.sh
+++ b/gen_package.sh
@@ -8,10 +8,18 @@ gen_minkernpackage() {
        if [ "${KERNCACHE}" != "" ]
        then
                /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} 
kernel-${ARCH}-${KV}
+               mv 
minkernpackage/{kernel-${ARCH}-${KV},kernel-${KNAME}-${ARCH}-${KV}}
                /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} 
config-${ARCH}-${KV}
+               mv 
minkernpackage/{config-${ARCH}-${KV},config-${KNAME}-${ARCH}-${KV}}
                if isTrue "${GENZIMAGE}"
                then
                        /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} 
kernelz-${ARCH}-${KV}
+                       mv 
minkernpackage/{kernelz-${ARCH}-${KV},kernelz-${KNAME}-${ARCH}-${KV}}
+               fi
+               if [ ! -f minkernpackage/kernel-${KNAME}-${ARCH}-${KV} \
+                 -o ! -f minkernpackage/config-${KNAME}-${ARCH}-${KV} ];
+               then
+                       gen_die "Cannot locate kernel binary"
                fi
        else
                local tmp_kernel_binary=$(find_kernel_binary ${KERNEL_BINARY})
@@ -21,24 +29,29 @@ gen_minkernpackage() {
                        gen_die "Cannot locate kernel binary"
                fi
                cd "${KERNEL_OUTPUTDIR}"
-               cp "${tmp_kernel_binary}" 
"${TEMP}/minkernpackage/kernel-${ARCH}-${KV}" || gen_die 'Could not the copy 
kernel for the min kernel package!'
-               cp ".config" "${TEMP}/minkernpackage/config-${ARCH}-${KV}" || 
gen_die 'Could not the copy kernel config for the min kernel package!'
+               cp "${tmp_kernel_binary}" 
"${TEMP}/minkernpackage/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not 
the copy kernel for the min kernel package!'
+               cp ".config" 
"${TEMP}/minkernpackage/config-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not 
the copy kernel config for the min kernel package!'
                if isTrue "${GENZIMAGE}"
                then
-                       cp "${tmp_kernel_binary2}" 
"${TEMP}/minkernpackage/kernelz-${ARCH}-${KV}" || gen_die "Could not copy the 
kernelz for the min kernel package"
+                       cp "${tmp_kernel_binary2}" 
"${TEMP}/minkernpackage/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die "Could not 
copy the kernelz for the min kernel package"
                fi
        fi
 
        if ! isTrue "${INTEGRATED_INITRAMFS}"
        then
-               [ "${BUILD_RAMDISK}" != '0' ] && { cp 
"${TMPDIR}/initramfs-${KV}" "${TEMP}/minkernpackage/initramfs-${ARCH}-${KV}" || 
gen_die 'Could not copy the initramfs for the kernel package!'; }
+               [ "${BUILD_RAMDISK}" != '0' ] && { cp 
"${TMPDIR}/initramfs-${KV}" 
"${TEMP}/minkernpackage/initramfs-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not 
copy the initramfs for the kernel package!'; }
        fi
 
        if [ "${KERNCACHE}" != "" ]
        then
                /bin/tar -xj -C ${TEMP}/minkernpackage -f ${KERNCACHE} 
System.map-${ARCH}-${KV}
+               mv 
minkernpackage/{System.map-${ARCH}-${KV},System.map-${KNAME}-${ARCH}-${KV}}
+               if [ ! -f System.map-${KNAME}-${ARCH}-${KV} ]
+               then
+                       gen_die 'Could not copy System.map from kerncache for 
the kernel package!'
+               fi
        else
-               cp "${KERNEL_OUTPUTDIR}/System.map" 
"${TEMP}/minkernpackage/System.map-${ARCH}-${KV}" || gen_die 'Could not copy 
System.map for the kernel package!';
+               cp "${KERNEL_OUTPUTDIR}/System.map" 
"${TEMP}/minkernpackage/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could 
not copy System.map for the kernel package!';
        fi
 
        cd "${TEMP}/minkernpackage"

Reply via email to