#!/bin/bash
yum -y install policycoreutils-python

/usr/sbin/semanage fcontext -a -t httpd_sys_content_t "/home/http(/.*)?"
/usr/sbin/semanage fcontext -a -t httpd_sys_content_t "/home/celltest(/.*)?"
/usr/sbin/semanage permissive -a httpd_sys_script_t
/usr/sbin/setsebool -P httpd_can_network_connect true
/usr/sbin/setsebool -P httpd_read_user_content 1
/usr/sbin/setsebool -P httpd_enable_cgi on
/usr/sbin/setsebool -P httpd_unified on
/usr/sbin/setsebool -P httpd_builtin_scripting on
if [ -d /var/lock/SemaforeFile ]; then
    /usr/sbin/semanage fcontext -a -t httpd_sys_content_t "/var/lock/SemaforeFile(/.*)?"
fi
/usr/sbin/semanage fcontext -a -t httpd_sys_content_t "/tmp/SemaforeFile.lock"
if [ -f /usr/sbin/restorecon ]; then
    /usr/sbin/restorecon -R /home/celltest
    if [ -d /var/lock/SemaforeFile ]; then
	/usr/sbin/restorecon -R /var/lock/SemaforeFile
    fi
    /usr/sbin/restorecon -R /home/http
    if [ -e /tmp/SemaforeFile.lock ]; then
	/usr/sbin/restorecon /tmp/SemaforeFile.lock
    fi
else
    /sbin/restorecon -R /home/celltest
    if [ -d /var/lock/SemaforeFile ]; then
	/sbin/restorecon -R /var/lock/SemaforeFile
    fi
    /sbin/restorecon -R /home/http
    if [ -e /tmp/SemaforeFile.lock ]; then
	/sbin/restorecon /tmp/SemaforeFile.lock
    fi
fi
