summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-06-21 18:38:04 +0200
committerDave Reisner <dreisner@archlinux.org>2014-06-21 18:38:22 +0200
commit02d387b2370215d51d1aa8958fce42cd099bee29 (patch)
tree96b9e9368344db974a70d2131486b4614fe23de2 /functions
parent8ac740cbb14a5971897501e81a99e25767953841 (diff)
downloadmkinitcpio-02d387b2370215d51d1aa8958fce42cd099bee29.tar.gz
mkinitcpio-02d387b2370215d51d1aa8958fce42cd099bee29.tar.xz
add second param to add_full_dir to allow filtering files
Use this to only add files matching *.conf in the modconf hook. Fixes FS#39994.
Diffstat (limited to 'functions')
-rw-r--r--functions7
1 files changed, 4 insertions, 3 deletions
diff --git a/functions b/functions
index b4f51a8..20bbffe 100644
--- a/functions
+++ b/functions
@@ -414,19 +414,20 @@ add_full_dir() {
# Add a directory and all its contents, recursively, to the initcpio image.
# No parsing is performed and the contents of the directory is added as is.
# $1: path to directory
+ # $2: glob pattern to filter file additions (optional)
- local f=
+ local f= filter=${2:-*}
if [[ -n $1 && -d $1 ]]; then
add_dir "$1"
for f in "$1"/*; do
if [[ -L $f ]]; then
- add_symlink "$f" "$(readlink "$f")"
+ [[ $f = $filter ]] && add_symlink "$f" "$(readlink "$f")"
elif [[ -d $f ]]; then
add_full_dir "$f"
elif [[ -f $f ]]; then
- add_file "$f"
+ [[ $f = $filter ]] && add_file "$f"
fi
done
fi