A file can also be a link, so check not only for a file, but also for a link

in the delete-old and check-old targets.

We don't install a lib (libXY.so.Z) as a link, but an user may have created
something like this. This is dangerous if this link points to a different
version of the lib. So check for a link also in the *-lib targets (an
annoyed user which absolutely wants this redirection of a lib should use
libmap.conf instead of a link).

A directory can also be a link, but in this case just echo a message to
remove it by hand.
This commit is contained in:
Alexander Leidinger 2006-02-18 16:58:21 +00:00
parent da3482e0f6
commit 8a32134cdd

View File

@ -1079,11 +1079,14 @@ delete-old-files:
.for file in ${OLD_FILES} .for file in ${OLD_FILES}
# Ask for every old file if the user really wants to remove it. # Ask for every old file if the user really wants to remove it.
# It's annoying, but better safe than sorry. # It's annoying, but better safe than sorry.
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
|| ([ -f "${DESTDIR}/${file}" ] \ rm ${RM_I} "${DESTDIR}/${file}" || true; \
&& echo "Removing schg flag on ${DESTDIR}/${file}" \ if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\
&& chflags noschg "${DESTDIR}/${file}" \ echo "Removing schg flag on ${DESTDIR}/${file}"; \
&& rm ${RM_I} "${DESTDIR}/${file}")) chflags noschg "${DESTDIR}/${file}"; \
rm ${RM_I} "${DESTDIR}/${file}"; \
fi; \
fi
.endfor .endfor
# Remove catpages without corresponding manpages. # Remove catpages without corresponding manpages.
@3<&0; \ @3<&0; \
@ -1100,7 +1103,9 @@ delete-old-files:
check-old-files: check-old-files:
@echo ">>> Checking for old files" @echo ">>> Checking for old files"
.for file in ${OLD_FILES} .for file in ${OLD_FILES}
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
echo "${DESTDIR}/${file}"; \
fi
.endfor .endfor
# Check for catpages without corresponding manpages. # Check for catpages without corresponding manpages.
@find ${DESTDIR}/usr/share/man/cat* ! -type d | \ @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
@ -1116,32 +1121,49 @@ delete-old-libs:
@echo ">>> Removing old libraries" @echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt @echo "${OLD_LIBS_MESSAGE}" | fmt
.for file in ${OLD_LIBS} .for file in ${OLD_LIBS}
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
|| ([ -f "${DESTDIR}/${file}" ] \ rm ${RM_I} "${DESTDIR}/${file}" || true; \
&& echo "Removing schg flag on ${DESTDIR}/${file}" \ if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\
&& chflags noschg "${DESTDIR}/${file}" \ echo "Removing schg flag on ${DESTDIR}/${file}"; \
&& rm ${RM_I} "${DESTDIR}/${file}")) chflags noschg "${DESTDIR}/${file}"; \
rm ${RM_I} "${DESTDIR}/${file}"; \
fi; \
fi
.endfor .endfor
@echo ">>> Old libraries removed" @echo ">>> Old libraries removed"
check-old-libs: check-old-libs:
@echo ">>> Checking for old libraries" @echo ">>> Checking for old libraries"
.for file in ${OLD_LIBS} .for file in ${OLD_LIBS}
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
echo "${DESTDIR}/${file}"; \
fi
.endfor .endfor
delete-old-dirs: delete-old-dirs:
@echo ">>> Removing old directories" @echo ">>> Removing old directories"
.for dir in ${OLD_DIRS} .for dir in ${OLD_DIRS}
# Don't fail if an old directory isn't empty. # Don't fail if an old directory isn't empty.
@[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true) @if [ -d "${DESTDIR}/${dir}" ]; then \
rmdir -v "${DESTDIR}/${dir}" || true; \
else \
if [ -L "${DESTDIR}/${dir}" ]; then \
echo "${DESTDIR}/${dir} is a link, please remove everything manually."; \
fi; \
fi
.endfor .endfor
@echo ">>> Old directories removed" @echo ">>> Old directories removed"
check-old-dirs: check-old-dirs:
@echo ">>> Checking for old directories" @echo ">>> Checking for old directories"
.for dir in ${OLD_DIRS} .for dir in ${OLD_DIRS}
@[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}" @if [ -d "${DESTDIR}/${dir}" ]; then \
echo "${DESTDIR}/${dir}"; \
else \
if [ -L "${DESTDIR}/${dir}" ]; then \
echo "${DESTDIR}/${dir} is a link, please remove everything manually."; \
fi; \
fi
.endfor .endfor
delete-old: delete-old-files delete-old-dirs delete-old: delete-old-files delete-old-dirs