bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_freeradius/0-install_freeradius.sh

Christoph Galuschka d240c8
#!/bin/bash
Christoph Galuschka d240c8
# Author: Christoph Galuschka <christoph.galuschka@tiwag.at>
Christoph Galuschka d240c8
Christoph Galuschka d240c8
# Install freeradius
Christoph Galuschka 104052
# On C5 both freeradius and freeradius2 are provided, however only freeradius2-utils are provided as well
Christoph Galuschka 104052
# so we will install freeradius2 on C5 and freeradius (being freeradius2) on C6
Christoph Galuschka 104052
if (t_GetPkgRel basesystem | grep -q el6)
Christoph Galuschka 104052
then
Christoph Galuschka 104052
  #Install Freeradius (V2)
Christoph Galuschka 104052
  t_InstallPackage freeradius
Christoph Galuschka 104052
else
Christoph Galuschka 104052
  #Install Freeradius2
Christoph Galuschka 104052
  t_InstallPackage freeradius2
Christoph Galuschka 104052
fi
Christoph Galuschka d240c8
Christoph Galuschka d240c8
# activate at boot
Christoph Galuschka d240c8
chkconfig radiusd on
Christoph Galuschka d240c8
# start daemon with default settings
Christoph Galuschka 104052
if (t_GetPkgRel basesystem | grep -q el6)
Christoph Galuschka 104052
then
Christoph Galuschka 104052
  t_ServiceControl radiusd start
Christoph Galuschka 104052
else
Christoph Galuschka 104052
  # C5 has an eap-setting in radiusd.conf and 3 "sites-available" which prevent successfull start (probably missing some dep)
Christoph Galuschka 104052
  # as the basic test works without these, the eap setting 2 sites-available will be removed for the test and later restored
Christoph Galuschka 104052
  sed -i 's/.*INCLUDE\ eap\.conf/# INCLUDE eap.conf/g' /etc/raddb/radiusd.conf
Christoph Galuschka 104052
  rm -rf /etc/raddb/sites-enabled/control-socket
Christoph Galuschka 104052
  rm -rf /etc/raddb/sites-enabled/inner-tunnel
Christoph Galuschka 104052
  # /etc/raddb/sites-configured will be changed to remove all traces of eap
Christoph Galuschka 104052
  /bin/cp -a /etc/raddb/sites-available/default /etc/raddb/sites-available/default.orig
Christoph Galuschka 104052
  head -n 138 /etc/raddb/sites-available/default.orig | grep -v eap > /etc/raddb/sites-available/default
Christoph Galuschka 104052
  tail -n 416 /etc/raddb/sites-available/default.orig | grep -v eap >> /etc/raddb/sites-available/default
Christoph Galuschka 104052
  sed -i 's/.*ok\ \=\ return/# ok = return/g' /etc/raddb/sites-available/default
Christoph Galuschka 104052
  t_ServiceControl radiusd start
Christoph Galuschka 104052
fi
Christoph Galuschka d240c8