xref: /freebsd/crypto/krb5/src/config/mkinstalldirs (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert#! /bin/sh
2*7f2fe78bSCy Schubert# mkinstalldirs --- make directory hierarchy
3*7f2fe78bSCy Schubert# Author: Noah Friedman <friedman@prep.ai.mit.edu>
4*7f2fe78bSCy Schubert# Created: 1993-05-16
5*7f2fe78bSCy Schubert# Public domain
6*7f2fe78bSCy Schubert
7*7f2fe78bSCy Schubert# $Id$
8*7f2fe78bSCy Schubert
9*7f2fe78bSCy Schuberterrstatus=0
10*7f2fe78bSCy Schubert
11*7f2fe78bSCy Schubertfor file
12*7f2fe78bSCy Schubertdo
13*7f2fe78bSCy Schubert   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
14*7f2fe78bSCy Schubert   shift
15*7f2fe78bSCy Schubert
16*7f2fe78bSCy Schubert   pathcomp=
17*7f2fe78bSCy Schubert   for d
18*7f2fe78bSCy Schubert   do
19*7f2fe78bSCy Schubert     pathcomp="$pathcomp$d"
20*7f2fe78bSCy Schubert     case "$pathcomp" in
21*7f2fe78bSCy Schubert       -* ) pathcomp=./$pathcomp ;;
22*7f2fe78bSCy Schubert     esac
23*7f2fe78bSCy Schubert
24*7f2fe78bSCy Schubert     if test ! -d "$pathcomp"; then
25*7f2fe78bSCy Schubert        echo "mkdir $pathcomp"
26*7f2fe78bSCy Schubert
27*7f2fe78bSCy Schubert        mkdir "$pathcomp" || lasterr=$?
28*7f2fe78bSCy Schubert
29*7f2fe78bSCy Schubert        if test ! -d "$pathcomp"; then
30*7f2fe78bSCy Schubert  	  errstatus=$lasterr
31*7f2fe78bSCy Schubert        fi
32*7f2fe78bSCy Schubert     fi
33*7f2fe78bSCy Schubert
34*7f2fe78bSCy Schubert     pathcomp="$pathcomp/"
35*7f2fe78bSCy Schubert   done
36*7f2fe78bSCy Schubertdone
37*7f2fe78bSCy Schubert
38*7f2fe78bSCy Schubertexit $errstatus
39*7f2fe78bSCy Schubert
40*7f2fe78bSCy Schubert# mkinstalldirs ends here
41