diff options
author | netchild <netchild@FreeBSD.org> | 2006-02-18 16:58:21 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2006-02-18 16:58:21 +0000 |
commit | d7398f13f68494afcd3a27d0365e85e340e50f7e (patch) | |
tree | 1380e32f607632ed14dba4798e0b8119cfc4e1a2 /Makefile.inc1 | |
parent | 9e25820325ec2ff99adbf82916515f2e38adbbbb (diff) | |
download | FreeBSD-src-d7398f13f68494afcd3a27d0365e85e340e50f7e.zip FreeBSD-src-d7398f13f68494afcd3a27d0365e85e340e50f7e.tar.gz |
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.
Diffstat (limited to 'Makefile.inc1')
-rw-r--r-- | Makefile.inc1 | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index 8d6f327..fc909aa 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1079,11 +1079,14 @@ delete-old-files: .for file in ${OLD_FILES} # Ask for every old file if the user really wants to remove it. # It's annoying, but better safe than sorry. - @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ - || ([ -f "${DESTDIR}/${file}" ] \ - && echo "Removing schg flag on ${DESTDIR}/${file}" \ - && chflags noschg "${DESTDIR}/${file}" \ - && rm ${RM_I} "${DESTDIR}/${file}")) + @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \ + rm ${RM_I} "${DESTDIR}/${file}" || true; \ + if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\ + echo "Removing schg flag on ${DESTDIR}/${file}"; \ + chflags noschg "${DESTDIR}/${file}"; \ + rm ${RM_I} "${DESTDIR}/${file}"; \ + fi; \ + fi .endfor # Remove catpages without corresponding manpages. @3<&0; \ @@ -1100,7 +1103,9 @@ delete-old-files: check-old-files: @echo ">>> Checking for 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 # Check for catpages without corresponding manpages. @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ @@ -1116,32 +1121,49 @@ delete-old-libs: @echo ">>> Removing old libraries" @echo "${OLD_LIBS_MESSAGE}" | fmt .for file in ${OLD_LIBS} - @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ - || ([ -f "${DESTDIR}/${file}" ] \ - && echo "Removing schg flag on ${DESTDIR}/${file}" \ - && chflags noschg "${DESTDIR}/${file}" \ - && rm ${RM_I} "${DESTDIR}/${file}")) + @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \ + rm ${RM_I} "${DESTDIR}/${file}" || true; \ + if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\ + echo "Removing schg flag on ${DESTDIR}/${file}"; \ + chflags noschg "${DESTDIR}/${file}"; \ + rm ${RM_I} "${DESTDIR}/${file}"; \ + fi; \ + fi .endfor @echo ">>> Old libraries removed" check-old-libs: @echo ">>> Checking for old libraries" .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 delete-old-dirs: @echo ">>> Removing old directories" .for dir in ${OLD_DIRS} # 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 @echo ">>> Old directories removed" check-old-dirs: @echo ">>> Checking for old directories" .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 delete-old: delete-old-files delete-old-dirs |