The following is no big enhancement just a small change to make life easier when maintaining a system after a kernel upgraade in portage while having the "symlink" flag set on the kernel sources. Just adds a usr/src/linux-old symlink along with the usr/src/linux symlink already added by the eclass. Submitted to be included in the kernel-2.eclass review and update. Tested with upgrading between linux-2.6.12-gentoo-r4 and linux-2.6.12-gentoo-r6. Reproducible: Always Steps to Reproduce: # File: /usr/portage/kernel-2.eclass # Starting line: 530 # Submitter: Kevin williams (llslim) <llslym@yahoo.com> # Type: enhancement # # Description. # Trivial upgrade to the symlink use flag functionality. # When the "symlink" use flag is set, we Create an additional symlink # (linux-old) # to the /usr/src/ directory for the purpose of locating last workinng kernel. postinst_sources() { local MAKELINK=0 local MAKE_OLDLINK=0 # current and working Kernel tree. local K_DIR # if we have USE=symlink, then force K_SYMLINK=1 use symlink && K_SYMLINK=1 # if we are to forcably create the symlink for the new kernel tree, # then first we need to delete the symlinks for the current andd backup # kernel trees if they exsist. if [[ -n ${K_SYMLINK} ]]; then if [[ -h ${ROOT}usr/src/linux ]]; then # remove the backup kernel symlink, only when upgrading kernel # emerging the same kernel version only removes the symlink # for current kernel tree. K_DIR=$(readlink ${ROOT}usr/src/linux) [[ "${K_DIR}" != "linux-${KV_FULL}" ]] && MAKE_OLDLINK=1 [[ -h ${ROOT}usr/src/linux-old ]] && [[ ${MAKE_OLDLINK} == 1 ]] && rm ${ROOT}usr/src/linux-old # remove the link for current kernel tree rm ${ROOT}usr/src/linux fi MAKELINK=1 fi # enabling making a new current link if it doesn't already exsist. [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1 # create the symlinks for the current and backup kernel trees. if [[ ${MAKELINK} == 1 ]]; then cd ${ROOT}usr/src ln -sf linux-${KV_FULL} linux [[ ${MAKE_OLDLINK} == 1 ]] && ln -sf ${K_DIR} linux-old cd ${OLDPWD} fi #===============================end of snippet=================================# Actual Results: in test case with kernels linux-2.6.12-gentoo-r4 and linux-2.6.12-gentoo-r6 these symlinks were created/updated /usr/src/linux -> /usr/src/linux-2.6.12-gentoo-r6 /usr/src/linux-old -> /usr/src/linux-2.6.12-gentoo-r4 Expected Results: see actual results plse let me know. if you think this is worth adding to the kernel-2 eclass for the general population of gentoo users
Perhaps it should be /usr/src/linux.old to follow the naming scheme of the kernel files in /boot?
Created attachment 64307 [details] Symlink use flag code update Here is the symlink use flag code with previous kernel symlink in the form of linux.old. this file is a snippet. Is that the right form, or what format should it be in?
Created attachment 64308 [details] Symlink use flag code update Here is the symlink use flag code with previous kernel symlink in the form of linux.old. this file is a snippet. Is that the right form, or what format should it be in?
A unified diff (diff -up) is the preferred way of submitting patches.
Created attachment 64422 [details] The diff file Here is the diff file for patch
That patch can not be accepted - did you even look at your diff output before uploading? Your patch removes important sections of the kernel-2.eclass which was recently added. Please bring your local version up-to-date and rediff.
Created attachment 64463 [details] the symlink use flag update Sorry about that. Forgot there was an baselayout updated after i did work on kernel-2, and did the diff while dead tired. Anyway, here is the patch updated checkedagainst a sync this morning. Tested it as well. Works well on my machine.
I just talked with John about this, we aren't sure how useful it would be (by default, the /usr/src/linux symlink is used in every ebuild that looks at or uses kernel stuff, which is part of the Gentoo reasoning behind it and why it is important). We won't be including this right now, but thanks for the contribution.
That's understandable, it wasn't any major critical upddate. Having a symlink to the previous working kernel treedoes have it advantages when a person needs to revert back to previious kernel during the transition period of upgradinng the kernel version of a system to add new features. I figured one moree symlink wouldn't put to much strain on the ebuild. Then write the script that put the symlink to good use in one you have to run manually called "update-kern". Oh well, I will find a work aroun. Thank you for the consideration.