diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2016-05-01 17:37:02 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2016-05-26 08:15:08 +0200 |
commit | 75e60fe045c7961f374965034aab15cf16f19d6f (patch) | |
tree | 7881721836565b476021e4c09b6f20f3a6f9bf00 /scripts/lib | |
parent | 5efcadb3dc32132b3ea73035ecd617c9e7ac873c (diff) | |
download | ptxdist-75e60fe045c7961f374965034aab15cf16f19d6f.tar.gz ptxdist-75e60fe045c7961f374965034aab15cf16f19d6f.tar.xz |
install: add new 'install_glob' command
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/ptxd_make_xpkg_pkg.sh | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh index 3122d7236..50c9c3998 100644 --- a/scripts/lib/ptxd_make_xpkg_pkg.sh +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh @@ -574,16 +574,21 @@ ptxd_install_find() { local strip="${5}" local -a dirs ndirs pdirs sdirs ddirs local mod_nfs mod_rw + if [ -z "${glob}" ]; then + local glob="-o -print" + fi ptxd_install_setup_src && test -d "${src}" && - find "${src}" -path "*/.svn" -prune -o -path "*/.git" -prune -o \ - -path "*/.pc" -prune -o -path "*/CVS" -prune -o \ - ! -path "${src}" -print | while read file; do + find "${src}" ! -path "${src}" -a \( \ + -path "*/.svn" -prune -o -path "*/.git" -prune -o \ + -path "*/.pc" -prune -o -path "*/CVS" -prune \ + ${glob} \) | while read file; do local dst_file="${dst}${file#${src}}" ptxd_install_generic "${file}" "${dst_file}" "${usr}" "${grp}" "${strip}" || return done + check_pipe_status } export -f ptxd_install_find @@ -597,6 +602,31 @@ ptxd_install_tree() { } export -f ptxd_install_tree +ptxd_install_glob() { + local cmd="file" + local src="${1}" + local dst="${2}" + local yglob=( ${3} ) + local nglob=( ${4} ) + local glob + + if [ -n "${3}" ]; then + yglob=( "${yglob[@]/#/-o -path }" ) + glob="${yglob[*]/%/ -print }" + else + glob="-o -print" + fi + if [ -n "${4}" ]; then + nglob=( "${nglob[@]/#/-o -path }" ) + glob="${nglob[*]/%/ -prune } ${glob}" + fi + shift 4 + + ptxd_install_find "${src}" "${dst}" "$@" || + ptxd_install_error "install_glob failed!" +} +export -f ptxd_install_glob + ptxd_install_alternative_tree() { local cmd="alternative" local src="${1}" |