1f08c3bdfSopenharmony_ci#!/bin/sh
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_ci################################################################################
4f08c3bdfSopenharmony_ci##                                                                            ##
5f08c3bdfSopenharmony_ci## Copyright (c) International Business Machines  Corp., 2005                 ##
6f08c3bdfSopenharmony_ci##                                                                            ##
7f08c3bdfSopenharmony_ci## This program is free software;  you can redistribute it and#or modify      ##
8f08c3bdfSopenharmony_ci## it under the terms of the GNU General Public License as published by       ##
9f08c3bdfSopenharmony_ci## the Free Software Foundation; either version 2 of the License, or          ##
10f08c3bdfSopenharmony_ci## (at your option) any later version.                                        ##
11f08c3bdfSopenharmony_ci##                                                                            ##
12f08c3bdfSopenharmony_ci## This program is distributed in the hope that it will be useful, but        ##
13f08c3bdfSopenharmony_ci## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
14f08c3bdfSopenharmony_ci## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
15f08c3bdfSopenharmony_ci## for more details.                                                          ##
16f08c3bdfSopenharmony_ci##                                                                            ##
17f08c3bdfSopenharmony_ci## You should have received a copy of the GNU General Public License          ##
18f08c3bdfSopenharmony_ci## along with this program;  if not, write to the Free Software               ##
19f08c3bdfSopenharmony_ci## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
20f08c3bdfSopenharmony_ci##                                                                            ##
21f08c3bdfSopenharmony_ci##                                                                            ##
22f08c3bdfSopenharmony_ci################################################################################
23f08c3bdfSopenharmony_ci#
24f08c3bdfSopenharmony_ci# File:
25f08c3bdfSopenharmony_ci#   check_setkey
26f08c3bdfSopenharmony_ci#
27f08c3bdfSopenharmony_ci# Description:
28f08c3bdfSopenharmony_ci#   Check the local/remote host has setkey command
29f08c3bdfSopenharmony_ci#
30f08c3bdfSopenharmony_ci# Arguments:
31f08c3bdfSopenharmony_ci#   None
32f08c3bdfSopenharmony_ci#
33f08c3bdfSopenharmony_ci# Returns:
34f08c3bdfSopenharmony_ci#   0: Both host have setkey command
35f08c3bdfSopenharmony_ci#   1: One or both host doesn't have setkey command
36f08c3bdfSopenharmony_ci#
37f08c3bdfSopenharmony_ci# Author:
38f08c3bdfSopenharmony_ci#   Mitsuru Chinen <mitch@jp.ibm.com>
39f08c3bdfSopenharmony_ci#
40f08c3bdfSopenharmony_ci# History:
41f08c3bdfSopenharmony_ci#   Oct 19 2005 - Created (Mitsuru Chinen)
42f08c3bdfSopenharmony_ci#
43f08c3bdfSopenharmony_ci#-----------------------------------------------------------------------
44f08c3bdfSopenharmony_ci#Uncomment line below for debug output.
45f08c3bdfSopenharmony_ci#trace_logic=${trace_logic:-"set -x"}
46f08c3bdfSopenharmony_ci$trace_logic
47f08c3bdfSopenharmony_ci
48f08c3bdfSopenharmony_ci
49f08c3bdfSopenharmony_ci# Make sure the value of LTPROOT
50f08c3bdfSopenharmony_ciLTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
51f08c3bdfSopenharmony_ciexport LTPROOT
52f08c3bdfSopenharmony_ci
53f08c3bdfSopenharmony_ci# Check the environmanet variable for the test
54f08c3bdfSopenharmony_ci. check_envval || exit 1
55f08c3bdfSopenharmony_ci
56f08c3bdfSopenharmony_ciwhich setkey >/dev/null 2>&1
57f08c3bdfSopenharmony_ciif [ $? -ne 0 ]; then
58f08c3bdfSopenharmony_ci    echo "The local host does not have setkey command"
59f08c3bdfSopenharmony_ci    exit 1
60f08c3bdfSopenharmony_cifi
61f08c3bdfSopenharmony_ci
62f08c3bdfSopenharmony_ciret=`$LTP_RSH $RHOST 'PATH=/sbin:/usr/sbin:$PATH which setkey >/dev/null 2>&1 ; echo $?'`
63f08c3bdfSopenharmony_ciif [ $ret -ne 0 ]; then
64f08c3bdfSopenharmony_ci    echo "The remote host does not have setkey command"
65f08c3bdfSopenharmony_ci    exit 1
66f08c3bdfSopenharmony_cifi
67