blob: 4f58503ea4e09c65165aa1ecaeac7c2c688648f3 [file] [log] [blame]
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -06001#! /bin/sh
2# mkinstalldirs --- make directory hierarchy
3# Author: Noah Friedman <friedman@prep.ai.mit.edu>
4# Created: 1993-05-16
5# Public domain
6
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -06007# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
8
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -06009errstatus=0
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060010
11for file
12do
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060013 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
14 shift
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060015
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060016 pathcomp=
17 for d
18 do
19 pathcomp="$pathcomp$d"
20 case "$pathcomp" in
21 -* ) pathcomp=./$pathcomp ;;
22 esac
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060023
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060024 if test ! -d "$pathcomp"; then
25 echo "mkdir $pathcomp"
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060026
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060027 mkdir "$pathcomp" || lasterr=$?
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060028
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060029 if test ! -d "$pathcomp"; then
30 errstatus=$lasterr
31 fi
32 fi
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060033
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060034 pathcomp="$pathcomp/"
35 done
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060036done
37
38exit $errstatus
39
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060040# mkinstalldirs ends here