| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Copyright (C) 2012-2026 Free Software Foundation, Inc. |
| 4 |
# |
| 5 |
# This file is part of GNU Inetutils. |
| 6 |
# |
| 7 |
# GNU Inetutils is free software: you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation, either version 3 of the License, or (at |
| 10 |
# your option) any later version. |
| 11 |
# |
| 12 |
# GNU Inetutils is distributed in the hope that it will be useful, but |
| 13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
# General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with this program. If not, see `http://www.gnu.org/licenses/'. |
| 19 |
|
| 20 |
DNSDOMAINNAME=${DNSDOMAINNAME:-../src/dnsdomainname$EXEEXT} |
| 21 |
|
| 22 |
if test ! -x $DNSDOMAINNAME; then |
| 23 |
echo "No executable $DNSDOMAINNAME available. Skipping test." |
| 24 |
exit 77 |
| 25 |
fi |
| 26 |
|
| 27 |
$DNSDOMAINNAME --version > /dev/null |
| 28 |
rc=$? |
| 29 |
if test $rc -ne 0; then |
| 30 |
echo "invoking $DNSDOMAINNAME --version failed with error code $rc" |
| 31 |
exit 1 |
| 32 |
fi |
| 33 |
|
| 34 |
$DNSDOMAINNAME --help > /dev/null |
| 35 |
rc=$? |
| 36 |
if test $rc -ne 0; then |
| 37 |
echo "invoking $DNSDOMAINNAME --help failed with error code $rc" |
| 38 |
exit 1 |
| 39 |
fi |
| 40 |
|
| 41 |
# FIXME: Don't ignore all errors here. We want to soft-fail (exit 77) |
| 42 |
# on 1) when getaddrinfo cannot lookup the address at all, or 2) when |
| 43 |
# the canonical address does not contain a period. Both are |
| 44 |
# configuration issues, and the tool is arguable correct to fail in |
| 45 |
# these situations. All other errors should lead to hard failures. |
| 46 |
|
| 47 |
$DNSDOMAINNAME > /dev/null |
| 48 |
rc=$? |
| 49 |
if test $rc -ne 0 && test $rc -ne 1; then |
| 50 |
echo "invoking $DNSDOMAINNAME failed with error code $rc" |
| 51 |
exit 1 |
| 52 |
fi |
| 53 |
|
| 54 |
exit 0 |