inventory.sh: Get included directories

Not only wildcard
This commit is contained in:
Brice Waegeneire 2021-03-23 11:11:12 +01:00
parent 17d1f6069a
commit 07e2e8913e
2 changed files with 10 additions and 4 deletions

View File

@ -35,9 +35,15 @@ get_confs() {
while [ "$confs_size" -lt "$(stat -c %s "$confs")" ]; do
confs_size=$(stat -c %s "$confs")
for conf_file in $(cat "$confs"); do
# XXX: Expand the filenames
for glob in $(awk '/^[[:space:]]*Include/ {print $2}' "$conf_file"); do
realpath --canonicalize-existing --quiet $glob >> "$confs" || true
# Get all Include directives
for included in $(awk '/^[[:space:]]*Include/ {print $2}' "$conf_file"); do
# In case a directory is included even tho it's not recomended
if [ -d "$included" ]; then
included=$included/*
fi
# XXX: Expand the filenames
realpath --canonicalize-existing --quiet $included \
| grep -v mods-available >> "$confs" || true
done
done
sort "$confs" | uniq > "$confs"_tmp && mv "$confs"_tmp "$confs"

View File

@ -5,7 +5,7 @@
* Machine
** hosting05
- /etc/apache2/sites-enabled/acelem.conf
- /etc/apache2/mods-enabled/status.conf
- /etc/apache2/mods-enabled/status.conf
- /home/labri/www/zp-data/.htaccess
- /home/oldwiki/www/bleuroy/.htaccess