|
|
rm -f "${BOOTDIR}/${symlinkName}.old" | rm -f "${BOOTDIR}/${symlinkName}.old" |
fi | fi |
| |
# We only erase the old image when it is the exact same version as the |
# We only erase the .old image when it is the exact same version as the |
# current and new images. Different version old images are left behind. |
# current and new images. Different version .old (and current) images are |
# This is consistent with how "make install" of the manual kernel build |
# left behind. This is consistent with how "make install" of the manual |
# works. |
# kernel build works. |
if [ "${currDestImage}" == "${fullDestName}" -a \ |
if [ "${currDestImage}" == "${fullDestName}" ] |
"${prevDestImage}" == "${currDestImage}.old" ] |
|
then | then |
# | # |
# Case for new, currrent, and old of the same base version. |
# 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." | print_info 5 " Same base version. May have to delete old image to make room." |
| |
if [ "${currDestImageExists}" -eq '1' ] | if [ "${currDestImageExists}" -eq '1' ] |
then | then |
if [ "${prevDestImageExists}" -eq '1' ] |
if [ -e "${BOOTDIR}/${currDestImage}.old" ] |
then | then |
print_info 5 " Deleting old identical version ${symlinkName}." | print_info 5 " Deleting old identical version ${symlinkName}." |
rm -f "${BOOTDIR}/${prevDestImage}" |
rm -f "${BOOTDIR}/${currDestImage}.old" |
fi | fi |
print_info 5 " Moving ${BOOTDIR}/${currDestImage}" | print_info 5 " Moving ${BOOTDIR}/${currDestImage}" |
print_info 5 " to ${BOOTDIR}/${currDestImage}.old" | print_info 5 " to ${BOOTDIR}/${currDestImage}.old" |
mv "${BOOTDIR}/${currDestImage}" "${BOOTDIR}/${currDestImage}.old" || | mv "${BOOTDIR}/${currDestImage}" "${BOOTDIR}/${currDestImage}.old" || |
gen_die "Could not rename the old ${symlinkName} image!" | gen_die "Could not rename the old ${symlinkName} image!" |
|
prevDestImage="${currDestImage}.old" |
|
prevDestImageExists=1 |
fi | fi |
else | else |
# | # |
# Case for current / old not of the same base version. |
# Case for new / current not of the same base version. |
# | # |
print_info 5 " Different base version. Do not delete old images." | print_info 5 " Different base version. Do not delete old images." |
if [ "${currDestImageExists}" -eq 1 ] |
prevDestImage="${currDestImage}" |
then |
|
prevDestImage="${currDestImage}" |
|
fi |
|
currDestImage="${fullDestName}" | currDestImage="${fullDestName}" |
fi | fi |
| |
|
|
pushd ${BOOTDIR} >/dev/null | pushd ${BOOTDIR} >/dev/null |
ln -s "${currDestImage}" "${symlinkName}" || | ln -s "${currDestImage}" "${symlinkName}" || |
gen_die "Could not create the ${symlinkName} symlink!" | gen_die "Could not create the ${symlinkName} symlink!" |
if [ "${currDestImageExists}" -eq '1' ] |
if [ "${prevDestImageExists}" -eq '1' ] |
then | then |
print_info 5 " ${symlinkName}.old -> ${prevDestImage}" | print_info 5 " ${symlinkName}.old -> ${prevDestImage}" |
ln -s "${prevDestImage}" "${symlinkName}.old" || | ln -s "${prevDestImage}" "${symlinkName}.old" || |