Reword the copyright notices to match what's suggested in GPLv3.
[automake/plouj.git] / tests / instsh2.test
blob17b61aba190248f03250530b6b25817883f29c8c
1 #! /bin/sh
2 # Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Various install-sh checks
19 . ./defs || exit 1
20 set -e
22 # Basic errors
23 ./install-sh && exit 1
24 ./install-sh -m 644 dest && exit 1
26 # Directories
28 # It should be OK to create no directory. We sometimes need
29 # this when directory are conditionally defined.
30 ./install-sh -d
31 # One directory.
32 ./install-sh -d d0
33 test -d d0
34 # Multiple directories (for make installdirs).
35 ./install-sh -d d1 d2 d3 d4
36 test -d d1
37 test -d d2
38 test -d d3
39 test -d d4
40 # Subdirectories
41 ./install-sh -d p1/p2/p3 p4//p5//p6//
42 test -d p1/p2/p3
43 test -d p4/p5/p6
45 # Files.
46 : > x
47 ./install-sh -c -m 644 x y
48 test -f x
49 test -f y
50 ./install-sh -m 644 y z
51 test -f y
52 test -f z
53 # Multiple files
54 ./install-sh -m 644 -c x z d1
55 test -f x
56 test -f z
57 test -f d1/x
58 test -f d1/z
59 ./install-sh -m 644 x z d2//
60 test -f x
61 test -f z
62 test -f d2/x
63 test -f d2/z
64 ./install-sh -t d3 -m 644 x z
65 test -f x
66 test -f z
67 test -f d3/x
68 test -f d3/z
69 ./install-sh -t d4// -m 644 x z
70 test -f x
71 test -f z
72 test -f d4/x
73 test -f d4/z
74 ./install-sh -T x d3/y
75 test -f x
76 test -f d3/y
77 ./install-sh -T x d3 && exit 1
78 ./install-sh -T x d4// && exit 1
80 # Do not change the timestamps when using -C.
81 echo foo >file
82 ./install-sh -C file d1
83 TZ=UTC0 touch -t $old_timestamp d1/file
84 ./install-sh -C file d1
85 is_newest file d1/file
86 echo foo1 >file
87 ./install-sh -C file d1
88 diff file d1/file
89 # Rights must be updated.
90 ./install-sh -C -m 444 file d1
91 test -r d1/file
92 test ! -w d1/file
94 # Ensure that install-sh works with names that include spaces
95 touch 'a b'
96 mkdir 'x y'
97 ./install-sh 'a b' 'x y'
98 test -f x\ \ y/a\ \ b
99 test -f 'a b'