pax_global_header 0000666 0000000 0000000 00000000064 10647402063 0014514 g ustar 00root root 0000000 0000000 52 comment=a9b0b261a5d85f2f1ce03d9f80879036881242bc
alterator-apache2-1.2/ 0000755 0000000 0000000 00000000000 10647402063 0014652 5 ustar 00root root 0000000 0000000 alterator-apache2-1.2/Makefile 0000644 0000000 0000000 00000001150 10647402063 0016307 0 ustar 00root root 0000000 0000000 NAME=apache2
DESCRIPTION="Web server"
INSTALL=/usr/bin/install
all: build-profile
clean: clean-po clean-profile
install: install-backend install-ui install-po install-profile install-html install-build
include /usr/share/alterator/build/po.mak
include /usr/share/alterator/build/ui2.mak
include /usr/share/alterator/build/backend.mak
include /usr/share/alterator/build/standalone.mak
include /usr/share/alterator/build/fbi.mak
include /usr/share/alterator/build/html-messages.mak
HTML_PO_TEMPLATE=ui/apache2/html-messages.scm
install-build:
$(INSTALL) -d $(datadir)/alterator
cp -a build $(datadir)/alterator
alterator-apache2-1.2/backend3/ 0000755 0000000 0000000 00000000000 10647402063 0016324 5 ustar 00root root 0000000 0000000 alterator-apache2-1.2/backend3/apache2 0000755 0000000 0000000 00000033776 10647402063 0017575 0 ustar 00root root 0000000 0000000 #!/bin/sh
APACHE_CONFDIR="/etc/httpd2/conf"
ALTERATOR_SCONF="900-alterator.conf"
VHOSTS_PATH="/var/www/vhosts"
LOG_PATH="/var/log/httpd2"
_()
{
LANG=${in_language%%;*}.utf8 gettext "alterator-apache2" "$1"
}
#turn off auto expansion
set -f
. /usr/share/alterator/build/backend3.sh
print_aes_name()
{
local object="$1"
local name="$2"
case "$name" in
available)
printf '%s-available' "$object"
;;
enabled)
printf '%s-enabled' "$object"
;;
start)
printf '%s-start.d' "$object"
;;
*)
printf ''
;;
esac
}
print_a2used_name()
{
local object="${1%s}"
local enabled="$2"
local s=
case "$enabled" in
yes)
s="en"
;;
no)
s="dis"
;;
esac
printf 'a2%s%s' "$s" "$object"
}
P_VirtualHost="[Vv][Ii][Rr][Tt][Uu][Aa][Ll][Hh][Oo][Ss][Tt]"
P_OT_VirtualHost="^[[:space:]]*<$P_VirtualHost[[:space:]]+[^[:space:]]+>[[:space:]]*(|(.*))\$"
P_ZT_VirtualHost="^[[:space:]]*\/<$P_VirtualHost>[[:space:]]*(|(.*))\$"
P_pre_VirtualHost="1,/$P_OT_VirtualHost/{b}
/$P_ZT_VirtualHost/,\${b}
"
P_post_VirtualHost="
"
P_Server="[Ss][Ee][Rr][Vv][Ee][Rr]"
P_Name="[Nn][Aa][Mm][Ee]"
P_Path="[Pp][Aa][Tt][Hh]"
P_Admin="[Aa][Dd][Mm][Ii][Nn]"
P_ServerName="$P_Server$P_Name"
P_ServerPath="$P_Server$P_Path"
P_ServerAdmin="$P_Server$P_Admin"
P_DocumentRoot="[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt][Rr][Oo][Oo][Tt]"
P_ErrorLog="[Ee][Rr][Rr][Oo][Rr][Ll][Oo][Gg]"
for p in P_ServerName P_ServerPath P_ServerAdmin P_DocumentRoot P_ErrorLog;
do
eval "P_f_${p#P_}=\$$p[[:space:]]"
eval "P_fs_${p#P_}=^[[:space:]]*\$$p[[:space:]]"
done
P_Summary="^[[:space:]]*\#[[:space:]]*Summary:"
P_f_Summary="\#[[:space:]]*Summary:"
P_fs_Summary="^[[:space:]]*$P_f_Summary"
P_pre_Summary="1,/^[[:space:]]*[^[:space:]]/{
/^[[:space:]]*[^[:space:]]/b e1
b
}
: e1
1,/^[[:space:]]*($|[^\#])/{
/^[[:space:]]*\#/{
1,/$P_Summary/{
"
P_post_Summary="
}
}
}"
get_summary()
{
local fn="$1"
sed -rn "${P_pre_Summary}1,1s/$P_fs_Summary[[:space:]\'\"]*([^[:space:]\'\"].*[^[:space:]\'\"])[[:space:]\'\"]*\$/\1/p$P_post_Summary" \
"$fn"
}
on_message()
{
. /usr/share/alterator/build/apache2.sh
case "$in_action" in
constraints)
echo '('
case "$level" in
0)
printf 'name (label "%s")\n' "`_ "Group of configs"`"
printf 'summary (label "%s")\n' "`_ "Summary"`"
;;
2)
if [ ${objs[2]} = "available" ]; then
case "${objs[1]}" in
ports|mods|sites|extra)
printf 'name (label "%s" required #t)\n' "`_ "Name"`"
printf 'status_def (label "%s")\n' "`_ "By default"`"
printf 'enabled (label "%s")\n' "`_ "Enabling"`"
printf 'summary (label "%s")\n' "`_ "Summary"`"
;;
esac
fi
;;
3)
if [ ${objs[2]} = "available" ]; then
case "${objs[1]}" in
sites)
printf 'summary (label "%s")\n' "`_ "Summary"`"
printf 'ServerName (label "%s")\n' "ServerName"
printf 'ServerPath (label "%s")\n' "ServerPath"
printf 'ServerAdmin (label "%s")\n' "ServerAdmin"
printf 'DocumentRoot (label "%s")\n' "DocumentRoot"
printf 'ErrorLog (label "%s")\n' "ErrorLog"
;;
esac
fi
;;
esac
echo ')'
;;
list)
echo '('
if [ $level = 0 ]; then
printf '("ports" summary "%s")\n' \
"`_ "Configuring IP addresses and ports, which hears server"`"
printf '("mods" summary "%s")\n' \
"`_ "Manage load modules"`"
printf '("sites" summary "%s")\n' \
"`_ "Manage sites"`"
printf '("extra" summary "%s")\n' \
"`_ "Advanced settings"`"
else
case "${objs[1]}" in
ports|mods|sites|extra)
if [ $level = 1 ]; then
printf '("available" name "%s" summary "%s")\n' \
`print_aes_name "$object1" "available"` \
"`_ "Available configs"`"
printf '("enabled" name "%s" summary "%s")\n' \
`print_aes_name "$object1" "enabled"` \
"`_ "Enabled configs"`"
printf '("start" name "%s" summary "%s")\n' \
`print_aes_name "$object1" "start"` \
"`_ "Manage automation integration configs"`"
else
case "${objs[2]}" in
available)
local conf_suf="conf"
if [ "${objs[1]}" = "mods" ]; then
conf_suf="load"
fi
if [ $level = 2 ]; then
local epath="$APACHE_CONFDIR"/`print_aes_name "${objs[1]}" "enabled"`
find "$epath" -maxdepth 1 -name "*.$conf_suf" -type f -o -type l -exec readlink -e {} \; | \
{
local nefnames=0
local efnames=""
local fname
while read -r fname; do
let nefnames++
efnames[$nefnames]="$fname"
done
/usr/sbin/a2chkconfig_list "${objs[1]}" | \
{
local ns=0
local sns=""
local sus=""
local sn
local su
local t
while read -r t sn su; do
let ns++
sns[$ns]="$sn"
sus[$ns]="$su"
done
local apath="$APACHE_CONFDIR"/`print_aes_name "${objs[1]}" "available"`
find "$apath" -maxdepth 1 -name "*.$conf_suf" -type f -o -type l | \
{
local fn
while read -r fn; do
local i
local en="`_ "no"`"
local fname=`readlink -e "$fn"`
for i in `seq 1 "$nefnames"`; do
if [ "x$fname" = "x${efnames[$i]}" ]; then
en="`_ "yes"`"
break;
fi
done
local name=`echo "$fn"|sed -e "s@^$apath/\([^[:space:]]\+\)\.$conf_suf\\$@\1@"`
local status_def="`_ "none"`"
for i in `seq 1 "$ns"`; do
if [ "x$name" = "x${sns[$i]}" ]; then
status_def="${sus[$i]}"
break;
fi
done
case "$status_def" in
yes)
status_def="`_ "enable"`"
;;
no)
status_def="`_ "disable"`"
;;
esac
local summary="`get_summary "$fn"`"
printf '("%s" enabled "%s" status_def "%s" summary "%s")\n' \
"$name" "$en" "$status_def" "$summary"
done
}
}
}
elif [ $level = 3 ]; then
if [ "${objs[3]}" = "avail_actions" ]; then
printf '("nop" label "-- %s --")\n' "`_ "select action"`"
printf '("none_def" label "%s")\n' "`_ "default none"`"
printf '("en_def" label "%s")\n' "`_ "enable by default"`"
printf '("dis_def" label "%s")\n' "`_ "disable by default"`"
printf '("enable" label "%s")\n' "`_ "enable"`"
printf '("disable" label "%s")\n' "`_ "disable"`"
printf '("delete" label "%s")\n' "`_ "delete"`"
fi
fi
;;
esac
fi
;;
esac
fi
echo ')'
;;
read)
echo '('
if [ $level = 3 ]; then
case "${objs[1]}" in
sites)
case "${objs[2]}" in
available)
printf 'group_name "%s"\n' "${objs[1]}/${objs[3]}"
printf 'group_summary "%s %s"\n' \
"`_ "Configure virtual host"`" "${objs[3]}"
local fname="$APACHE_CONFDIR/`print_aes_name "${objs[1]}" "available"`/${objs[3]}.conf"
printf 'summary "%s"\n' "`get_summary "$fname"`"
sed -rn "$P_pre_VirtualHost
/$P_fs_ServerName/{
1,1s/$P_fs_ServerName[[:space:]\'\"]*([A-Za-z0-9.:\/-]+).*\$/ServerName \"\1\"/p}
/$P_fs_ServerPath/{
1,1s/$P_fs_ServerPath[[:space:]\'\"]*([^[:space:]'\"]+).*\$/ServerPath \"\1\"/p}
/$P_fs_ServerAdmin/{
1,1s/$P_fs_ServerAdmin[[:space:]\'\"]*([^[:space:]'\"]+).*\$/ServerAdmin \"\1\"/p}
/$P_fs_DocumentRoot/{
1,1s/$P_fs_DocumentRoot[[:space:]\'\"]([^[:space:]'\"]+).*\$/DocumentRoot \"\1\"/p}
/$P_fs_ErrorLog/{
1,1s/$P_fs_ErrorLog[[:space:]\'\"]*([^[:space:]'\"]+).*\$/ErrorLog \"\1\"/p}
$P_post_VirtualHost" \
"$fname"
;;
esac
;;
esac
elif [ $level != 0 ]; then
printf 'group_name "%s"\n' "${objs[1]}"
case "${objs[1]}" in
ports)
printf 'group_summary "%s"\n' \
"`_ "Configuring IP addresses and ports, which hears server"`"
;;
mods)
printf 'group_summary "%s"\n' \
"`_ "Manage load modules"`"
;;
sites)
printf 'group_summary "%s"\n' \
"`_ "Manage sites"`"
;;
extra)
printf 'group_summary "%s"\n' \
"`_ "Advanced settings"`"
;;
esac
fi
echo ')'
;;
write)
if [ $level = 3 ]; then
case "${objs[1]}" in
sites)
case "${objs[2]}" in
available)
local fname="$APACHE_CONFDIR/`print_aes_name "${objs[1]}" "available"`/${objs[3]}.conf"
local summary="`get_summary "$fname"`"
local fo_summary
if [ "x$summary" != "x" ]; then
fo_summary="y"
fi
sed -rn "$P_pre_VirtualHost
/$P_fs_ServerName/{
1,1s/$P_fs_ServerName[[:space:]\'\"]*([A-Za-z0-9.:\/-]+).*\$/ServerName=\"\1\"/p}
/$P_fs_ServerPath/{
1,1s/$P_fs_ServerPath[[:space:]\'\"]*([^[:space:]'\"]+).*\$/ServerPath=\"\1\"/p}
/$P_fs_ServerAdmin/{
1,1s/$P_fs_ServerAdmin[[:space:]\'\"]*([^[:space:]'\"]+).*\$/ServerAdmin=\"\1\"/p}
/$P_fs_DocumentRoot/{
1,1s/$P_fs_DocumentRoot[[:space:]\'\"]([^[:space:]'\"]+).*\$/DocumentRoot=\"\1\"/p}
/$P_fs_ErrorLog/{
1,1s/$P_fs_ErrorLog[[:space:]\'\"]*([^[:space:]'\"]+).*\$/ErrorLog=\"\1\"/p}
$P_post_VirtualHost" \
"$fname" | \
{
local ServerName fo_ServerName
local ServerPath fo_ServerPath
local ServerAdmin fo_ServerAdmin
local DocumentRoot fo_DocumentRoot
local ErrorLog fo_ErrorLog
local o
while read -r o; do
eval "$o"
eval "fo_${o%=*}=y"
done
for o in summary ServerName ServerPath ServerAdmin DocumentRoot ErrorLog; do
local no
local oold
local foold
local onew
local p_o
local p_f_o
local p_fs_o
local sa
local p_pre p_post
eval "oold=\"\$$o\""
eval "foold=\"\$fo_$o\""
eval "onew=\"\$in_$o\""
if [ "x$o" = "xsummary" ]; then
no="# Summary:"
p_o="$P_Summary"
p_f_o="$P_f_Summary"
p_fs_o="$P_fs_Summary"
p_pre="$P_pre_Summary"
p_post="$P_post_Summary"
else
no="$o"
eval "p_o=\"\$P_$o\""
eval "p_f_o=\"\$P_f_$o\""
eval "p_fs_o=\"\$P_fs_$o\""
p_pre="$P_pre_VirtualHost/$p_fs_o/{
"
p_post="
}$P_post_VirtualHost"
fi
if [ "x$onew" = "x" ]; then
sa="1,1d"
elif [ "x$oold" = "x$onew" ]; then
continue
else
local eonew="`echo "$onew"|sed -e 's@\\\\@\\\\\\\\@g;s@/@\\\\/@g'`"
if [ "x$o" != "xsummary" ]; then
eonew="`echo "$eonew"|sed -r "s/^[[:space:]'\\"]*([^[:space:]'\\"].*[^[:space:]'\\"])[[:space:]'\\"]*$/\\1/"`"
fi
if [ "x$foold" = "xy" ]; then
sa=" 1,1s/^([[:space:]]*)$p_f_o.*\$/\1$no $eonew/"
elif [ "x$o" = "xsummary" ]; then
p_pre="1,1{
"
p_post="
}"
sa=" i\\$no $eonew"
else
p_pre="1,/$P_ZT_VirtualHost/{
"
p_post="
}"
sa=" \$i\\ $no $eonew"
fi
fi
sed -i -r "$p_pre$sa$p_post" "$fname"
done
}
;;
esac
;;
esac
fi
echo '()'
;;
new)
if [ $level = 2 ]; then
case "${objs[1]}" in
sites)
case "${objs[2]}" in
available)
local vhpath="$VHOSTS_PATH/$in_name"
mkdir -p "$vhpath/html"
chgrp webmaster "$vhpath" "$vhpath/html"
chmod 2775 "$vhpath" "$vhpath/html"
local fname="$APACHE_CONFDIR/`print_aes_name "${objs[1]}" "available"`/$in_name.conf"
echo "# Summary: Name-based Virtual Hosts, generated alterator-apache2