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 | ca972ec9d582601cf73a3924c45618fc6f190d0b (patch) | |
tree | e121b9f294d0dd69a1c13eed4c3482318f9635ee /mk | |
parent | 0e1155f7067631d270a6a00857030f53a9860cbe (diff) | |
download | pkgsrc-ca972ec9d582601cf73a3924c45618fc6f190d0b.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 \ |