Add initial get_htaccess

This commit is contained in:
Brice Waegeneire 2020-10-02 15:03:48 +02:00
parent bdda0c6554
commit d4462bbdee

View file

@ -1,9 +1,9 @@
#!/bin/sh
# TODO Find .htacces from DocumentRoot
# TODO Find .htaccess from DocumentRoot
# TODO find piece of apache conf in /etc
# TODO Handle /sur/share/scripts/vhost...
# TODO total by host: vhost, htacces, conf, cgi
# TODO total by host: vhost, htaccess, conf, cgi
set -e
@ -12,6 +12,9 @@ apache_conf=$apache_dir/apache2.conf
tmp_dir=/tmp/apache-require
confs=$tmp_dir/confs
confs_vhost=$tmp_dir/confs_vhost
confs_system=$tmp_dir/confs_system
confs_htaccess=$tmp_dir/confs_htaccess
result=$tmp_dir/result
mkdir -p "$tmp_dir"
@ -40,6 +43,14 @@ get_confs() {
cd - 1>/dev/null
}
get_htaccess() {
mv -b "$confs_htaccess" "$confs_htaccess".bak || true
for file in $(cat "$confs"); do
awk 'sub("^[[:space:]]*DocumentRoot[[:space:]]*", "") {print $0}' "$file" >> "$confs_htaccess"
done
}
count_directives() {
directives="Allow Order Deny Satisfy"