+ print_info 4 "automatically managing symlinks and old images." 1 0
+ if [ -e "${BOOTDIR}/${symlinkName}" ]
+ then
+ # JRG: Do I need a special case here for when the standard symlink
+ # name is, in fact, not a symlink?
+ currDestImage=`readlink --no-newline ${BOOTDIR}/${symlinkName}`
+ print_info 5 " Current ${symlinkName} symlink exists:"
+ print_info 5 " ${currDestImage}"
+ else
+ currDestImage="${fullDestName}"
+ print_info 5 " Current ${symlinkName} symlink did not exist."
+ print_info 5 " Defaulted to: ${currDestImage}"
+ fi
+ if [ -e "${BOOTDIR}/${currDestImage}" ]
+ then
+ currDestImageExists=1
+ print_info 5 " Actual image file exists."
+ fi
+
+ if [ -e "${BOOTDIR}/${symlinkName}.old" ]
+ then
+ # JRG: Do I need a special case here for when the standard symlink
+ # name is, in fact, not a symlink?
+ prevDestImage=`readlink --no-newline ${BOOTDIR}/${symlinkName}.old`
+ print_info 5 " Old ${symlinkName} symlink exists:"
+ print_info 5 " ${prevDestImage}"
+ else
+ prevDestImage="${fullDestName}.old"
+ print_info 5 " Old ${symlinkName} symlink did not exist."
+ print_info 5 " Defaulted to: ${prevDestImage}"
+ fi
+ if [ -e "${BOOTDIR}/${prevDestImage}" ]
+ then
+ prevDestImageExists=1
+ print_info 5 " Actual old image file exists."
+ fi
+ else
+ print_info 4 "symlinks not being handled by genkernel." 1 0
+ currDestImage="${fullDestName}"
+ prevDestImage="${fullDestName}.old"
+ fi
+
+ # When symlinks are not being managed by genkernel, old symlinks might
+ # still be useful. Leave 'em alone unless managed.
+ if [ "${SYMLINK}" = '1' ]
+ then
+ print_info 5 " Deleting old symlinks, if any."
+ rm -f "${BOOTDIR}/${symlinkName}"
+ rm -f "${BOOTDIR}/${symlinkName}.old"
+ fi
+
+ # We only erase the .old image when it is the exact same version as the
+ # current and new images. Different version .old (and current) images are
+ # left behind. This is consistent with how "make install" of the manual
+ # kernel build works.
+ if [ "${currDestImage}" == "${fullDestName}" ]
+ then
+ #
+ # Case for new and currrent of the same base version.
+ #
+ print_info 5 " Same base version. May have to delete old image to make room."
+
+ if [ "${currDestImageExists}" = '1' ]
+ then
+ if [ -e "${BOOTDIR}/${currDestImage}.old" ]
+ then
+ print_info 5 " Deleting old identical version ${symlinkName}."
+ rm -f "${BOOTDIR}/${currDestImage}.old"
+ fi
+ print_info 5 " Moving ${BOOTDIR}/${currDestImage}"
+ print_info 5 " to ${BOOTDIR}/${currDestImage}.old"
+ mv "${BOOTDIR}/${currDestImage}" "${BOOTDIR}/${currDestImage}.old" ||
+ gen_die "Could not rename the old ${symlinkName} image!"
+ prevDestImage="${currDestImage}.old"
+ prevDestImageExists=1
+ fi