Wed, 24 Jul 2024 23:45:31 +0200
fix dav add-repo crash in case .dav/config.xml doesn't exist
425
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | #!/bin/sh |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | # Copyright 2018 Olaf Wintermann. All rights reserved. |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | # Redistribution and use in source and binary forms, with or without |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | # modification, are permitted provided that the following conditions are met: |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | # 1. Redistributions of source code must retain the above copyright |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | # notice, this list of conditions and the following disclaimer. |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | # 2. Redistributions in binary form must reproduce the above copyright |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | # notice, this list of conditions and the following disclaimer in the |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | # documentation and/or other materials provided with the distribution. |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | # POSSIBILITY OF SUCH DAMAGE. |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | # |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | if [ -z "$DAV_BIN" ]; |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | then |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | echo "DAV_BIN variable not set" |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | exit 1 |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | fi |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | # test |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | dav list dav-test-repo > /dev/null |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | if [ $? -ne 0 ]; then |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | echo "dav list failed" |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | exit 2 |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | fi |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | OUT=`dav list dav-test-repo/tests/ | wc -l` |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | if [ $OUT != 9 ]; then |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | echo "wrong number of output lines" |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | exit 2 |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | fi |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | OUT=`dav list -lR dav-test-repo/tests/ | wc -l` |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | if [ $OUT != 19 ]; then |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | echo "wrong number of output linesin recursive mode" |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | exit 2 |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | fi |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | |
ae4d89c3477c
fixes dav list return value
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 |