diff options
author | jlam <jlam@pkgsrc.org> | 2003-09-09 11:00:30 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2003-09-09 11:00:30 +0000 |
commit | 42f190469cdd9d1ebde904e5b8d845973b38edaa (patch) | |
tree | e121b9f294d0dd69a1c13eed4c3482318f9635ee /mk | |
parent | e3f344c97489e22180d5537af367e03691488a41 (diff) | |
download | pkgsrc-42f190469cdd9d1ebde904e5b8d845973b38edaa.tar.gz |
Check that the lockfile isn't stale from being left over across a system
reboot by testing whether or not /var/run/dmesg.boot is newer than it or
not. Fix suggested by agc@NetBSD.org and simonb@NetBSD.org.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index d804256d77f..23c579ff70d 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1265 2003/09/08 01:13:02 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1266 2003/09/09 11:00:30 jlam Exp $ # # This file is in the public domain. # @@ -1888,6 +1888,11 @@ _ACQUIRE_LOCK= \ ${_PKG_SILENT}${_PKG_DEBUG} \ ppid=`${PS} -p $$$$ -o ppid | ${AWK} 'NR == 2 { print $$1 }'`; \ while true; do \ + if [ -f /var/run/dmesg.boot -a -f ${LOCKFILE} -a \ + /var/run/dmesg.boot -nt ${LOCKFILE} ]; then \ + ${ECHO} "=> Removing stale ${LOCKFILE}"; \ + ${RM} ${LOCKFILE}; \ + fi; \ ${SHLOCK} -f ${LOCKFILE} -p $$ppid && break; \ ${ECHO} "=> Lock is held by pid `cat ${LOCKFILE}`"; \ case "${PKGSRC_LOCKTYPE}" in \ |