Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/etc This script is run on the host for cross builds, so it c...
details: https://anonhg.NetBSD.org/src/rev/8fa273546dcb
branches: trunk
changeset: 526233:8fa273546dcb
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Sun Apr 28 22:17:43 2002 +0000
description:
This script is run on the host for cross builds, so it can't use mktemp -d.
Use a tidied-up version of my shell fragment from maketars instead.
diffstat:
etc/postinstall | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r f768897dc580 -r 8fa273546dcb etc/postinstall
--- a/etc/postinstall Sun Apr 28 21:32:14 2002 +0000
+++ b/etc/postinstall Sun Apr 28 22:17:43 2002 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: postinstall,v 1.3 2002/04/26 16:32:49 lukem Exp $
+# $NetBSD: postinstall,v 1.4 2002/04/28 22:17:43 bjh21 Exp $
#
# Copyright (c) 2002 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -434,13 +434,29 @@
esac
}
+mkdtemp ()
+{
+ # Make sure we don't loop forever if mkdir will always fail.
+ [ -d /tmp ] || err 1 /tmp is not a directory
+ [ -w /tmp ] || err 1 /tmp is not writeable
+
+ _base=/tmp/_postinstall.$$
+ _serial=0
+
+ while true; do
+ _dir=${_base}.${_serial}
+ mkdir -m 0700 ${_dir} && break
+ _serial=$((${_serial} + 1))
+ done
+ echo ${_dir}
+}
# defaults
#
PROGNAME=${0##*/}
SRC_ETC=/usr/src/etc
DEST_ETC=/etc
-SCRATCHDIR=$( mktemp -d /tmp/_postinstall.XXXXXX ) ||
+SCRATCHDIR=$( mkdtemp ) ||
err 1 "Can't create scratch directory"
trap "/bin/rm -rf $SCRATCHDIR ; exit 0" 0 1 2 3 15 # EXIT HUP INT QUIT TERM
umask 022
Home |
Main Index |
Thread Index |
Old Index