Commit e4891341 authored by Cédric BRINER's avatar Cédric BRINER Committed by Cédric BRINER
Browse files

use a2query; better handling '-' for sscp

parent 70c7b6ba
......@@ -645,10 +645,12 @@ function indent
function sscp
{
legend=$1
raw_legend=$1
space_legend=$(echo "${raw_legend}" | sed -r "s|(^ *).*|\1|" )
legend=$(echo "${raw_legend}" | sed -r "s|^ *||" )
org=$2
dst=$3
echo -ne " \e[34m- ${legend}\e[0m : "
echo -ne " ${space_legend}\e[34m- ${legend}\e[0m : "
if scp -pq $org $dst
then
echo -e "\e[34mscp \e[32mok\e[0m"
......@@ -1316,21 +1318,26 @@ EOF
sscp " mods-enabled/info.conf" /etc/apache2/mods-available/info.conf ${h}:/etc/apache2/mods-available/
sscp " mods-enabled/ssl.conf" /etc/apache2/mods-available/ssl.conf ${h}:/etc/apache2/mods-available/
# enable modules
echo -e " \e[34m- enable modules\e[0m"
for apache_module in info status ssl proxy_ajp; do
echo -e " \e[34m- enable module : ${apache_module}\e[0m"
ssh root@${h} "a2query -q -m ${apache_module} || a2enmod ${apache_module}" | indent 5
echo -e " \e[34m- ${apache_module}\e[0m"
ssh root@${h} "a2query -q -m ${apache_module} || a2enmod ${apache_module}" | indent 7
done
# configure conf (conf-available)
echo -e " \e[34m- configure conf (conf-available)\e[0m"
sscp " conf-available/security.conf" /etc/apache2/conf-available/security.conf ${h}:/etc/apache2/conf-available/
# enable conf (conf-available)
echo -e " \e[34m- enable conf\e[0m"
for apache_conf in security; do
echo -e " \e[34m- enable conf : ${apache_conf}\e[0m"
ssh root@${h} "a2query -c security || a2enconf security" | indent 5
echo -e " \e[34m- ${apache_conf}\e[0m"
ssh root@${h} "a2query -q -c security || a2enconf security" | indent 7
done
# disable/enable site
echo -e " \e[34m- sites (disable/enable)\e[0m"
ssh root@${h} "ls -1 /etc/apache2/sites-enabled/*conf | xargs -I@ basename @ | xargs -I@ a2ensite @" | indent 5
echo -e " \e[34m- enable site\e[0m"
for apache_site in $(ssh root@${h} "ls -1 /etc/apache2/sites-enabled/*conf" | xargs -I@ basename @); do
echo -e " \e[34m- ${apache_site}\e[0m"
ssh root@${h} "a2query -q -s ${apache_site} || a2ensite ${apache_site}" | indent 7
done
# restart apache
echo -e " \e[34m- restart apache\e[0m"
if test ${RESTART_OTHER_DAEMON} = "True"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment