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 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#!/bin/sh
# PCP QA Test No. 769
# Check if the "chkconfig" controls and tests for the init scripts
# and as used in the QA tests really work.
#
# Copyright (c) 2014 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
# chconfig controls just don't work on some platforms ...
#
[ -f /etc/gentoo-release ] && _notrun "chkconfig does not work for Gentoo"
[ -f /etc/slackware-version ] && _notrun "chkconfig does not work for Slackware"
status=1 # failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
VERBOSE_CONFIG=false
PMWEBD_INSTALLED=false
PMMGR_INSTALLED=false
FULL_LIST="pmcd pmie pmlogger pmproxy"
. $PCP_SHARE_DIR/lib/rc-proc.sh
_check_chk()
{
if is_chkconfig_on $1
then
echo "is_chkconfig_on $1 returns true"
else
echo "is_chkconfig_on $1 returns false"
fi
}
# real QA test starts here
VERBOSE_CONFIG=true
is_chkconfig_on pmie >>$seq_full
VERBOSE_CONFIG=false
for svc in $FULL_LIST
do
save=off
is_chkconfig_on $svc && save=on
echo "initial state for $svc: $save" >>$seq_full
for state in off on
do
echo "=== $svc $state ==="
if [ -f $PCP_RC_DIR/$svc ]
then
_change_config $svc $state || _exit 1
_check_chk $svc
else
# fake output when init script not installed
#
xpect=true
[ $state = off ] && xpect=false
echo "is_chkconfig_on $svc returns $xpect"
fi
done
[ -f $PCP_RC_DIR/$svc ] && _change_config $svc $save
done
# success, all done
status=0
exit
|