automake
[Top][All Lists]
Advanced

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

Patch 2 of 4: mkinstalldirs


From: Tim Van Holder
Subject: Patch 2 of 4: mkinstalldirs
Date: Sat, 10 Feb 2001 22:54:06 +0100

Most of this is taken from the Cygnus build tree, I think.
The test -d was added because:
 a) it makes sense (to me, at least) not to try creating a
    dir that exists
 b) not checking this would cause the creation of actual
    "/dev" and "/dev/env" directories, where paths of the
    form "/dev/env/ENVVAR/foo" are used to get around the
    DOS drivespec problems (and, in fact, 'prefix' on DJGPP
    will usually be '/dev/env/DJDIR', as this will point to
    the top of the DJGPP installation on _any_ DJGPP system
    (which is a big deal given the decidedly unstandardised
    PC directory structure).

2001-02-10  Tim Van Holder  <address@hidden>

        * mkinstalldirs: Update with latest from Cygnus build
        tree.  Don't try making a dir when it already exists.

Index: mkinstalldirs
===================================================================
RCS file: /cvs/automake/mkinstalldirs,v
retrieving revision 1.7
diff -u -r1.7 mkinstalldirs
--- mkinstalldirs       1999/01/14 11:59:35     1.7
+++ mkinstalldirs       2001/02/10 21:25:16
@@ -7,10 +7,35 @@
 # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $

 errstatus=0
+dirmode=""

+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+   case "${1}" in
+     -h | --help | --h* )                      # -h for help
+        echo "${usage}" 1>&2; exit 0 ;;
+     -m )                                      # -m PERM arg
+        shift
+        test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
+        dirmode="${1}"
+        shift ;;
+     -- ) shift; break ;;                      # stop option processing
+     -* ) echo "${usage}" 1>&2; exit 1 ;;      # unknown option
+     * )  break ;;                             # first non-opt arg
+   esac
+done
+
 for file
 do
-   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\//
/g;s/^#/\//;p'`
+   # Added for the benefit of DJGPP; we don't want this script to try and
+   # create portions of its virtual /dev/env paths.
+   # This doesn't help if we actually need creating a dir though.
+   test -d "$file" && continue
+
+   set fnord `echo ":$file" | sed -ne 's,^:/,#,;s,^:,,;s,/, ,g;s,^#,/,;p'`
    shift

    pathcomp=
@@ -28,6 +53,17 @@

         if test ! -d "$pathcomp"; then
          errstatus=$lasterr
+       else
+         if test ! -z "$dirmode"; then
+            echo "chmod $dirmode $pathcomp"
+
+            lasterr=""
+            chmod $dirmode "$pathcomp" || lasterr=$?
+
+            if test ! -z "$lasterr"; then
+              errstatus=$lasterr
+            fi
+         fi
         fi
      fi

@@ -37,4 +73,7 @@

 exit $errstatus

-# mkinstalldirs ends here
+# Local Variables:
+# mode:shell-script
+# sh-indentation:3
+# End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]