diff options
author | P. J. McDermott <pjm@nac.net> | 2012-10-20 22:23:02 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-10-20 22:23:02 (EDT) |
commit | 4227ff88a1b6c022af7064bc52deaf3efc19eff8 (patch) | |
tree | 58cf620760fe849d1d97be47c8c4a821ad5c69db /src | |
parent | 6f59eb5f7feb1b8a60c3ddea8960adedfbe63dfd (diff) |
Let user specify the dir in which files are found.
Diffstat (limited to 'src')
-rw-r--r-- | src/oh-installfiles.sh | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/oh-installfiles.sh b/src/oh-installfiles.sh index 6c4bcf5..6de0d5c 100644 --- a/src/oh-installfiles.sh +++ b/src/oh-installfiles.sh @@ -30,9 +30,23 @@ files_ifs=' main() { + dir='dest' + ob_set_locale_path '@@LOCALEDIR@@/%s/LC_MESSAGES/%s.ms' ob_set_text_domain 'opkhelper' + while getopts 'd:' opt; do + case "${opt}" in + d) + dir="${OPTARG}" + ;; + ?) + ob_error "$(ob_get_msg 'bad_opt')" + exit 1 + ;; + esac + done + ob_init_package '..' ob_parse_package_metadata -c '.opkbuild.cache' @@ -45,12 +59,12 @@ main() chmod 755 "${pkg}.data" while IFS="${files_ifs}" read -r pattern; do - for file in dest/${pattern}; do + for file in "${dir}/"${pattern}; do [ -e "${file}" ] || continue - file="${file#dest}" + file="${file#${dir}}" mkdir -p "${pkg}.data/${file%/*}" # TODO: If file, ln file. If dir, recursively mkdir and ln. - mv "${PWD}/dest/${file}" "${pkg}.data/${file}" + mv "${PWD}/${dir}/${file}" "${pkg}.data/${file}" done done <"../${pkg}.pkg/files" done |