Blame tests/p_ipa-server/0-preclean.sh
|
James Hogarth |
62aaba |
#!/bin/bash
|
|
James Hogarth |
62aaba |
# Author: James Hogarth <james.hogarth@gmail.com>
|
|
James Hogarth |
62aaba |
#
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
if (t_GetPkgRel basesystem | grep -q el6)
|
|
James Hogarth |
62aaba |
then
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
t_Log "Running $0 - Stopping and removing httpd if present"
|
|
James Hogarth |
0a8a3f |
if /sbin/service httpd status 2>&1 | grep 'is running...' &> /dev/null
|
|
James Hogarth |
62aaba |
then
|
|
James Hogarth |
62aaba |
/sbin/service httpd stop &> /dev/null
|
|
James Hogarth |
62aaba |
fi
|
|
James Hogarth |
62aaba |
if rpm -q httpd &> /dev/null
|
|
James Hogarth |
62aaba |
then
|
|
James Hogarth |
62aaba |
/usr/bin/yum -y remove httpd &> /dev/null
|
|
James Hogarth |
62aaba |
rm -rf /etc/httpd
|
|
James Hogarth |
62aaba |
fi
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
t_Log "Running $0 - Stopping and removing bind if present"
|
|
James Hogarth |
0a8a3f |
if /sbin/service named status 2>&1 | grep 'is running...' &> /dev/null
|
|
James Hogarth |
62aaba |
then
|
|
James Hogarth |
62aaba |
/sbin/service named stop &> /dev/null
|
|
James Hogarth |
62aaba |
fi
|
|
James Hogarth |
62aaba |
if rpm -q bind &> /dev/null
|
|
James Hogarth |
62aaba |
then
|
|
James Hogarth |
62aaba |
/usr/bin/yum -y remove bind &> /dev/null
|
|
James Hogarth |
62aaba |
rm -rf /etc/named /var/named
|
|
James Hogarth |
62aaba |
fi
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
t_Log "Running $0 - Backing up resolv.conf"
|
|
James Hogarth |
62aaba |
cp /etc/resolv.conf /tmp/resolv.conf.ipa-tests
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
t_Log "Running $0 - Backing up nsswitch.conf"
|
|
James Hogarth |
62aaba |
cp /etc/nsswitch.conf /tmp/nsswitch.conf.ipa-tests
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
t_Log "Running $0 - Backing up hosts file"
|
|
James Hogarth |
62aaba |
cp /etc/hosts /tmp/hosts.ipa-tests
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
t_Log "Running $0 - Backing up saving yum history id"
|
|
James Hogarth |
62aaba |
/usr/bin/yum history list | awk 'NR == 4 {print $1}' > /tmp/yum-rollback-id.ipa-tests
|
|
James Hogarth |
62aaba |
|
|
James Hogarth |
62aaba |
else
|
|
James Hogarth |
62aaba |
echo "Skipped on CentOS 5"
|
|
James Hogarth |
62aaba |
fi
|
|
James Hogarth |
62aaba |
|