Rename conf_files to confs
This commit is contained in:
parent
340041420e
commit
4594f96547
22
inventory.sh
22
inventory.sh
|
@ -11,7 +11,7 @@ apache_dir=/etc/apache2
|
||||||
apache_conf=$apache_dir/apache2.conf
|
apache_conf=$apache_dir/apache2.conf
|
||||||
|
|
||||||
tmp_dir=/tmp/apache-require
|
tmp_dir=/tmp/apache-require
|
||||||
conf_files=$tmp_dir/conf_files
|
confs=$tmp_dir/confs
|
||||||
files_with_directives=$tmp_dir/files_with_directives
|
files_with_directives=$tmp_dir/files_with_directives
|
||||||
mkdir -p "$tmp_dir"
|
mkdir -p "$tmp_dir"
|
||||||
|
|
||||||
|
@ -20,22 +20,22 @@ module_loaded() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get all config files included the
|
# Get all config files included the
|
||||||
get_conf_files() {
|
get_confs() {
|
||||||
# Initialize le the list of configuration files with the default conf
|
# Initialize le the list of configuration files with the default conf
|
||||||
test ! -e "$conf_files" && printf "%s\\n" $apache_conf > "$conf_files"
|
test ! -e "$confs" && printf "%s\\n" $apache_conf > "$confs"
|
||||||
|
|
||||||
cd "$apache_dir"
|
cd "$apache_dir"
|
||||||
# TODO: Refactor this mess
|
# TODO: Refactor this mess
|
||||||
conf_files_size=0
|
confs_size=0
|
||||||
while [ "$conf_files_size" -lt "$(stat -c %s "$conf_files")" ]; do
|
while [ "$confs_size" -lt "$(stat -c %s "$confs")" ]; do
|
||||||
conf_files_size=$(stat -c %s "$conf_files")
|
confs_size=$(stat -c %s "$confs")
|
||||||
for conf_file in $(cat "$conf_files"); do
|
for conf_file in $(cat "$confs"); do
|
||||||
# XXX: Expand the filenames
|
# XXX: Expand the filenames
|
||||||
for glob in $(awk '/^[[:space:]]*Include/ {print $2}' "$conf_file"); do
|
for glob in $(awk '/^[[:space:]]*Include/ {print $2}' "$conf_file"); do
|
||||||
realpath $glob >> "$conf_files"
|
realpath $glob >> "$confs"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
sort "$conf_files" | uniq > "$conf_files"_tmp && mv "$conf_files"_tmp "$conf_files"
|
sort "$confs" | uniq > "$confs"_tmp && mv "$confs"_tmp "$confs"
|
||||||
done
|
done
|
||||||
cd - 1>/dev/null
|
cd - 1>/dev/null
|
||||||
}
|
}
|
||||||
|
@ -59,10 +59,10 @@ display_results() {
|
||||||
|
|
||||||
printf 'File\tAllow\tOrder\tDeny\tSatsify\n' >&2
|
printf 'File\tAllow\tOrder\tDeny\tSatsify\n' >&2
|
||||||
# TODO make shellcheck happy
|
# TODO make shellcheck happy
|
||||||
for file in $(cat $conf_files); do
|
for file in $(cat $confs); do
|
||||||
count_directives "$file" | tee -a "$files_with_directives"
|
count_directives "$file" | tee -a "$files_with_directives"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
get_conf_files
|
get_confs
|
||||||
display_results
|
display_results
|
||||||
|
|
Loading…
Reference in a new issue