Tizen 2.0 Release
[external/tizen-coreutils.git] / tests / install / create-leading
1 #! /bin/sh
2 # Test -D option.
3
4 # Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
5
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
20
21 # Note that the tests below use `ginstall', not install, because
22 # that's the name of the binary in ../../src.
23
24 if test "$VERBOSE" = yes; then
25   set -x
26   ginstall --version
27 fi
28
29 . $srcdir/../envvar-check
30
31 pwd=`pwd`
32 dir=install-D$$
33
34 trap 'cd "$pwd" && rm -rf $dir' 0 1 2 3 15
35
36 mkdir $dir
37
38 fail=0
39 cd $dir
40 file=file
41 echo foo > $file
42
43 # Before 4.0q, this would mistakenly create $file, not `dest'
44 # in no-dir1/no-dir2/.
45 ginstall -D $file no-dir1/no-dir2/dest || fail=1
46 test -d no-dir1/no-dir2 || fail=1
47 test -r no-dir1/no-dir2/dest || fail=1
48
49 exit $fail