misc/libfreetype/builds/unix/mkinstalldirs
author unc0rr
Fri, 02 Nov 2012 10:07:30 +0400
changeset 7924 351f970c60e1
parent 5172 88f2e05288ba
permissions -rw-r--r--
oops, fix incorrect room owner name in ROOM UPD command
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
#! /bin/sh
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
# mkinstalldirs --- make directory hierarchy
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
scriptversion=2006-05-11.19
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
# Created: 1993-05-16
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
# Public domain.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
#
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
# This file is maintained in Automake, please report
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
# bugs to <bug-automake@gnu.org> or send patches to
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
# <automake-patches@gnu.org>.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
nl='
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
'
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
IFS=" ""	$nl"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
errstatus=0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
dirmode=
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
usage="\
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
Create each directory DIR (with mode MODE, if specified), including all
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
leading file name components.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
Report bugs to <bug-automake@gnu.org>."
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
# process command line arguments
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
while test $# -gt 0 ; do
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  case $1 in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
    -h | --help | --h*)         # -h for help
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
      echo "$usage"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
      exit $?
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
      ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
    -m)                         # -m PERM arg
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
      shift
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
      dirmode=$1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
      shift
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
      ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
    --version)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
      echo "$0 $scriptversion"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
      exit $?
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
      ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
    --)                         # stop option processing
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
      shift
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
      break
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
      ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    -*)                         # unknown option
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
      echo "$usage" 1>&2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
      exit 1
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
      ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
    *)                          # first non-opt arg
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
      break
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
      ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  esac
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
done
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
for file
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
do
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
  if test -d "$file"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    shift
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
  else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
    break
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
done
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
case $# in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  0) exit 0 ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
esac
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
# mkdir -p a/c at the same time, both will detect that a is missing,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
# one will create a, then the other will try to create a and die with
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
# a "File exists" error.  This is a problem when calling mkinstalldirs
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
# from a parallel make.  We use --version in the probe to restrict
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
# ourselves to GNU mkdir, which is thread-safe.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
case $dirmode in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
  '')
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
      echo "mkdir -p -- $*"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
      exec mkdir -p -- "$@"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
      # On NextStep and OpenStep, the `mkdir' command does not
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
      # recognize any option.  It will interpret all options as
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
      # directories to create, and then abort because `.' already
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
      # exists.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
      test -d ./-p && rmdir ./-p
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
      test -d ./--version && rmdir ./--version
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  *)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
       test ! -d ./--version; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
      echo "mkdir -m $dirmode -p -- $*"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
      exec mkdir -m "$dirmode" -p -- "$@"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
      # Clean up after NextStep and OpenStep mkdir.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
      for d in ./-m ./-p ./--version "./$dirmode";
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
      do
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
        test -d $d && rmdir $d
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
      done
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
    fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
    ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
esac
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
for file
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
do
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
  case $file in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
    /*) pathcomp=/ ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    *)  pathcomp= ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
  esac
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
  oIFS=$IFS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
  IFS=/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
  set fnord $file
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
  shift
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
  IFS=$oIFS
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
  for d
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
  do
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    test "x$d" = x && continue
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    pathcomp=$pathcomp$d
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    case $pathcomp in
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
      -*) pathcomp=./$pathcomp ;;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
    esac
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
    if test ! -d "$pathcomp"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
      echo "mkdir $pathcomp"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
      mkdir "$pathcomp" || lasterr=$?
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
      if test ! -d "$pathcomp"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
	errstatus=$lasterr
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
      else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
	if test ! -z "$dirmode"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
	  echo "chmod $dirmode $pathcomp"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
	  lasterr=
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
	  chmod "$dirmode" "$pathcomp" || lasterr=$?
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
	  if test ! -z "$lasterr"; then
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
	    errstatus=$lasterr
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
	  fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
	fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
      fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
    fi
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    pathcomp=$pathcomp/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
  done
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
done
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
exit $errstatus
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
# Local Variables:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
# mode: shell-script
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
# sh-indentation: 2
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
# eval: (add-hook 'write-file-hooks 'time-stamp)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
# time-stamp-start: "scriptversion="
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
# time-stamp-format: "%:y-%02m-%02d.%02H"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
# time-stamp-end: "$"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
# End: