]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/atf/admin/check-install.sh
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / atf / admin / check-install.sh
1 #! /bin/sh
2 #
3 # Automated Testing Framework (atf)
4 #
5 # Copyright (c) 2007 The NetBSD Foundation, Inc.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
10 # are met:
11 # 1. Redistributions of source code must retain the above copyright
12 #    notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 #    notice, this list of conditions and the following disclaimer in the
15 #    documentation and/or other materials provided with the distribution.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
18 # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26 # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #
30
31 #
32 # A utility to ensure that INSTALL lists the correct versions of the
33 # tools used to generate the distfile.
34 #
35
36 Prog_Name=${0##*/}
37
38 #
39 # err message
40 #
41 err() {
42     echo "${Prog_Name}: ${@}" 1>&2
43     exit 1
44 }
45
46 #
47 # warn message
48 #
49 warn() {
50     echo "${Prog_Name}: ${@}" 1>&2
51 }
52
53 #
54 # check_tool readme_file prog_name verbose_name
55 #
56 #   Executes 'prog_name' to determine its version and checks if the
57 #   given 'readme_file' contains 'verbose_name <version>' in it.
58 #
59 check_tool() {
60     readme=${1}
61     prog=${2}
62     name=${3}
63
64     ver=$(${prog} --version | head -n 1 | cut -d ' ' -f 4)
65
66     if grep "\\* ${name} ${ver}" ${readme} >/dev/null; then
67         true
68     else
69         warn "Incorrect version of ${name}"
70         false
71     fi
72 }
73
74 #
75 # main readme_file
76 #
77 # Entry point.
78 #
79 main() {
80     readme=${1}
81     ret=0
82
83     check_tool ${readme} autoconf "GNU autoconf" || ret=1
84     check_tool ${readme} automake "GNU automake" || ret=1
85     check_tool ${readme} libtool "GNU libtool" || ret=1
86
87     return ${ret}
88 }
89
90 main "${@}"
91
92 # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4