#!/bin/sh
echo 'Copying config / helper files to <tal:user replace="squid_config_dir" />'
cp squid.conf iRedirector.py squidRewriteRules.py squidAcl.py <tal:dir replace="squid_config_dir" />
echo 'Giving <tal:user replace="squid_user" /> ownership of its config and helper files'
chown <tal:user replace="squid_user" /> <tal:dir replace="squid_config_dir" />/squid.conf <tal:dir replace="squid_config_dir" />/iRedirector.py <tal:dir replace="squid_config_dir" />/squidRewriteRules.py <tal:dir replace="squid_config_dir" />/squidAcl.py
echo 'Giving <tal:user replace="squid_user" /> read and execute access to its config / helper files'
chmod u+r <tal:dir replace="squid_config_dir" />/squid.conf <tal:dir replace="squid_config_dir" />/iRedirector.py <tal:dir replace="squid_config_dir" />/squidRewriteRules.py <tal:dir replace="squid_config_dir" />/squidAcl.py
chmod u+x <tal:dir replace="squid_config_dir" />/iRedirector.py <tal:dir replace="squid_config_dir" />/squidAcl.py

# make sure squid has write access to its log and cache directories
echo 'Giving <tal:user replace="squid_user" /> write access to <tal:dir replace="squid_log_dir" /> and <tal:dir replace="squid_cache_dir" />'
chown -R <tal:user replace="squid_user" /> <tal:dir replace="squid_log_dir" />
chmod -R u+rwx <tal:dir replace="squid_log_dir" />
chown -R <tal:user replace="squid_user" /> <tal:dir replace="squid_cache_dir" />
chmod -R u+rwx <tal:dir replace="squid_cache_dir" />

echo 'Remember to initialize the squid cache (squid -z)'
<tal:apache condition="not:squid_direct">
echo 'Add the items in httpd.conf to the virtual host blocks of your apache config file'
</tal:apache>