Module Name: src
Committed By: uwe
Date: Sat Feb 11 19:35:45 UTC 2017
Modified Files:
src/usr.sbin/postinstall: postinstall
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/usr.sbin/postinstall/postinstall
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.209 src/usr.sbin/postinstall/postinstall:1.210
--- src/usr.sbin/postinstall/postinstall:1.209 Mon Jan 9 19:51:31 2017
+++ src/usr.sbin/postinstall/postinstall Sat Feb 11 19:35:45 2017
@@ -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)