Added patch to improve symlink support by Michael Hordijk <hoffbrinkle@hotmail.com...
authorChris Gianelloni <wolf31o2@gentoo.org>
Mon, 13 Nov 2006 19:35:26 +0000 (19:35 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Mon, 13 Nov 2006 19:35:26 +0000 (19:35 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@459 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
genkernel

index c7cbc07dd8388b87722083d428afb106b8d30a05..0c111e1b614588ad725a93f3f820b6608ea436b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 # Copyright 2006-2006 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  13 Nov 2006; Chris Gianelloni <wolf31o2@gentoo.org> genkernel:
+  Added patch to improve symlink support by Michael Hordijk
+  <hoffbrinkle@hotmail.com> for bug #143217.
+
   13 Nov 2006; Chris Gianelloni <wolf31o2@gentoo.org> generic/linuxrc:
   Added patch from Tim Steiner <tsteiner@nerdclub.net> to add a real_rootflags
   parameter for bug #122672.
index 1a6315385c4a6438f98901e3f4b1f73e8b893e66..b7a229f7ac224740a0e9b7dca790db1e9f27eebe 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -402,40 +402,56 @@ then
        [ "${UNIONFS}" -eq '1' ] && print_info 1 '      or "unionfs=<block_device>"'
 fi
 
+
+symlinker() {
+       local base=$1
+       local fullVer=${KNAME}-${ARCH}-${KV}
+
+       local newThing=${BOOTDIR}/${base}-${fullVer}
+       local newSym=${BOOTDIR}/${base}
+       local oldSym=${newsym}.old
+
+       local prevLink
+       local ret=0
+
+       print_info 1 "      creating ${base} name symlink!"
+       if [ -e ${newThing} ] ; then
+               if [ -L ${newSym} ] ; then
+                       prevLink=`readlink --no-newline ${newSym}`
+                       if [ ${prevLink} != ${newThing} ] ; then
+                               if [ -L ${oldSym} ] ; then
+                                       rm ${oldSym}
+                               fi
+                               ln -s ${prevLink} ${oldSym}
+                               [ $((ret += $?)) ]
+                       fi
+                       rm ${newSym}
+               fi
+               ln -s ${newThing} ${newSym}
+               [ $((ret += $?)) ]
+       fi
+       
+       if [[ ${ret} > 0 ]] ; then
+               print_error 1 "     $base link failed: ${ret}"
+       fi
+
+       return ${ret}
+}
+
+
 if [ "${CMD_NOINSTALL}" != '1' -a "${SYMLINK}" = '1' ]
 then 
     echo
     print_info 1 'Creating symlinks'
     
     
-    print_info 1 '         creating kernel name symlink!'
-    if [ -e ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ]
-    then
-       /bin/rm ${BOOTDIR}/kernel
-        ln -s ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/kernel
-        ret=$?
-        [ ${ret} = '1' ] && print_error 1 'kernel link failed'
-    fi
-    
-    if [ "${KERN_24}" != '1' -a  "${CMD_BOOTSPLASH}" != '1' ]
-    then
-       print_info 1 '      creating initramfs name symlink!'
-       if [ -e ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ]
-       then
-           /bin/rm ${BOOTDIR}/initramfs
-           ln -s ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initramfs
-           ret=$?
-           [ ${ret} = '1' ] && print_error 1 'initramfs link failed'
-       fi
-    else
-       print_info 1 '      creating initrd name symlink!'
-       if [ -e ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ]
-       then
-           /bin/rm ${BOOTDIR}/initrd
-           ln -s ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initrd
-           ret=$?
-           [ ${ret} = '1' ] && print_error 1 'initrd link failed'
-       fi
+       symlinker kernel
+       symlinker System.map 
+
+       if [ "${KERN_24}" != '1' -a  "${CMD_BOOTSPLASH}" != '1' ] ; then
+               symlinker initramfs
+       else
+               symlinker initrd
     fi
 fi