pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/bootstrap Provide a better mkdir -p replacement for th...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d96f93f301d6
branches:  trunk
changeset: 557738:d96f93f301d6
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Apr 21 14:21:10 2009 +0000

description:
Provide a better mkdir -p replacement for the early build for platforms
that don't have it.
Explicitly bail out if the work directory exists already.

diffstat:

 bootstrap/bootstrap |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (45 lines):

diff -r 911119e4ca24 -r d96f93f301d6 bootstrap/bootstrap
--- a/bootstrap/bootstrap       Tue Apr 21 14:19:21 2009 +0000
+++ b/bootstrap/bootstrap       Tue Apr 21 14:21:10 2009 +0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: bootstrap,v 1.142 2009/04/06 14:21:05 joerg Exp $
+# $NetBSD: bootstrap,v 1.143 2009/04/21 14:21:10 joerg Exp $
 #
 #
 # Copyright (c) 2001-2002 Alistair G. Crooks.  All rights reserved.
@@ -282,14 +282,14 @@
 
 mkdir_p_early()
 {
-       if [ ! -d "$1" ]; then
-               if mkdir -p "$1"; then
-                       :
-               else
-                       echo_msg "mkdir $1 exited with status $?"
-                       die "aborted."
-               fi
+       [ -d "$1" ] && return 0 
+       mkdir -p "$1" 2> /dev/null && return 0
+       mkdir_p_early `basename "$1"`
+       if [ ! -d "$1" ] && mkdir "$1"; then
+               echo_msg "mkdir $1 exited with status $?"
+               die "aborted."
        fi
+       return 0
 }
 
 copy_src()
@@ -692,6 +692,11 @@
 check_prog shprog sh
 check_prog whoamiprog whoami
 
+if [ -d "${wrkdir}" ] || [ -f "${wrkdir}"; then
+       echo "\"${wrkdir}\" already exists, please remove it or use --workdir.";
+       exit 1
+fi
+
 mkdir_p_early ${wrkdir}
 if touch ${wrkdir}/.writeable; then
        :



Home | Main Index | Thread Index | Old Index