File: version

package info (click to toggle)
rancid 3.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,436 kB
  • sloc: sh: 2,627; ansic: 1,683; makefile: 390; exp: 185
file content (59 lines) | stat: -rwxr-xr-x 1,051 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# Test version output of scripts
#
# (c) 2018  Roland Rosenfeld <roland@debian.org>

if [ -z "$AUTOPKGTEST_TMP" ]; then
    AUTOPKGTEST_TMP=$(mktemp -d)
fi

trap "rm -rf $AUTOPKGTEST_TMP" EXIT

VERSION=$(dpkg-parsechangelog -SVersion | sed -e 's/-[^-]*$//')

cd $AUTOPKGTEST_TMP

for a in /usr/lib/rancid/bin/* /usr/bin/rancid-run
do
    case "$a" in
	*/hpuifilter)
	    CMD="$a -v"
	    EXPECT="hpuifilter: rancid version $VERSION"
            GOT=$($CMD 2>&1)
	    ;;
	*/rancid_par)
	    CMD="$a -v 2>&1"
	    EXPECT="rancid_par: rancid version $VERSION"
            GOT=$($CMD 2>&1)
	    ;;
	*/plogin)
	    CMD="$a -V"
	    EXPECT="plogin: rancid $VERSION"
            GOT=$($CMD 2>/dev/null)
	    ;;
	*/rancid-fe)
	    EXPECT=ignore
	    GOT=ignore
	    ;;
	*)
	    CMD="$a -V"
	    EXPECT="rancid $VERSION"
	    GOT=$($CMD)
	    ;;
    esac


    if [ "$GOT" != "$EXPECT" ]
    then
	echo "$CMD: got '$GOT' expected '$EXPECT'" >> errors
    fi
done

if [ -f errors ] && [ -s errors ]
then
    cat errors
    exit 1
else
    exit 0
fi