Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/sets * use ${MKTEMP} -d instead of home-grown tempd...



details:   https://anonhg.NetBSD.org/src/rev/e27d62aeca9b
branches:  trunk
changeset: 552681:e27d62aeca9b
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Sep 30 05:07:40 2003 +0000

description:
* use ${MKTEMP} -d  instead of home-grown tempdir creation code
* use $(...) instead of `...`
* fix a recent modification to follow the same coding style as the
  rest of the file...  (mmm, consistency)

diffstat:

 distrib/sets/maketars |  38 ++++++++++----------------------------
 1 files changed, 10 insertions(+), 28 deletions(-)

diffs (75 lines):

diff -r b466051370c2 -r e27d62aeca9b distrib/sets/maketars
--- a/distrib/sets/maketars     Tue Sep 30 04:58:20 2003 +0000
+++ b/distrib/sets/maketars     Tue Sep 30 05:07:40 2003 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: maketars,v 1.42 2003/08/22 19:08:47 dsl Exp $
+# $NetBSD: maketars,v 1.43 2003/09/30 05:07:40 lukem Exp $
 #
 # Make release tar files for some or all lists.  Usage:
 # maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir]
@@ -13,16 +13,17 @@
 # In this case, remove "etc" from the list of default sets.
 #
 
-prog=`basename $0`
+prog=${0##*/}
 
 # set defaults
 : ${PAX=pax}
+: ${MKTEMP=mktemp}
 : ${MTREE=mtree}
-make="${MAKE:-make} -j 1 -f `dirname $0`/Makefile"
+make="${MAKE:-make} -j 1 -f $(dirname $0)/Makefile"
 
-machine=`${make} print_machine`
-machine_arch=`${make} print_machine_arch`
-setd=`pwd`
+machine=$(${make} print_machine)
+machine_arch=$(${make} print_machine_arch)
+setd=$(pwd)
 nlists="base comp etc games man misc text"
 xlists="xbase xcomp xcontrib xfont xserver xmisc"
 lists=$nlists
@@ -107,26 +108,7 @@
 fi
 : ${etcdir:=${dest}/etc}
 
-# Make sure we don't loop forever if mkdir will always fail.
-
-if [ ! -d /tmp ]; then
-       echo /tmp is not a directory
-       exit 1
-fi
-
-if [ ! -w /tmp ]; then
-       echo /tmp is not writable
-       exit 1
-fi
-
-SDIR_BASE=/tmp/maketar.$$
-SDIR_SERIAL=0
-
-while true; do
-       SDIR=${SDIR_BASE}.${SDIR_SERIAL}
-       mkdir -m 0700 ${SDIR} && break
-       SDIR_SERIAL=$((${SDIR_SERIAL} + 1))
-done    
+SDIR=$(${MKTEMP} -d /tmp/${prog}.XXXXXX)
 
 es=0
 cleanup()
@@ -161,10 +143,10 @@
        if [ -n "$installdir" ]; then
                echo "Copying set $setname"
        else
-               [ -n "$metalog" -a $tars/$out -nt "$metalog" ] && {
+               if [ -n "$metalog" -a $tars/$out -nt "$metalog" ]; then
                        echo "$out is up to date"
                        continue
-               }
+               fi
                echo "Creating $out"
        fi
        sh $setd/makeflist -a $machine_arch -m $machine -s $setd $setname \



Home | Main Index | Thread Index | Old Index