Don't use slow file_exists_exact if we don't have to.

file_exists_exact function was introduced in 1.26 for the benefit of
cross-building on OS X case-insensitive file system.  It is extremely
slow on diskless machines.  That becomes especially noticeable when
you upgrade a system that has a lot of obsolete files, it can take
literally hours.
This commit is contained in:
uwe 2017-02-11 19:35:45 +00:00
parent 9fcc111dff
commit 13be1262d3
1 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: postinstall,v 1.209 2017/01/09 19:51:31 christos Exp $
# $NetBSD: postinstall,v 1.210 2017/02/11 19:35:45 uwe Exp $
#
# Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
# All rights reserved.
@ -523,7 +523,7 @@ obsolete_paths()
failed=0
while read ofile; do
if ! file_exists_exact "${ofile}"; then
if ! ${file_exists_exact} "${ofile}"; then
continue
fi
ofile="${DEST_DIR}${ofile#.}"
@ -534,6 +534,8 @@ obsolete_paths()
elif [ -d "${ofile}" ]; then
ftype="directory"
cmd="rmdir"
elif [ ! -e "${ofile}" ]; then
continue
fi
if [ "${op}" = "check" ]; then
msg "Remove obsolete ${ftype} ${ofile}"
@ -2328,6 +2330,16 @@ main()
DIRMODE=false # true if "-s" specified a directory
SOURCEMODE=false # true if "-s" specified a source directory
case "$(uname -s)" in
Darwin)
# case sensitive match for case insensitive fs
file_exists_exact=file_exists_exact
;;
*)
file_exists_exact=:
;;
esac
while getopts s:x:d:m:a: ch; do
case "${ch}" in
s)