diff options
-rw-r--r-- | src/ob-installplatconf.sh | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ob-installplatconf.sh b/src/ob-installplatconf.sh index d179cc4..4acaf3b 100644 --- a/src/ob-installplatconf.sh +++ b/src/ob-installplatconf.sh @@ -25,6 +25,9 @@ ob_use locale ob_use output ob_use package +system_paths_ifs=' +' + main() { ob_set_text_domain 'opkbuild' @@ -58,21 +61,28 @@ copy_config() if [ -z "${src}" -o -z "${dest}" ]; then ob_error "$(ob_get_msg 'bad_config_syntax')" "${list}" fi + # Make sure the destination directory exists. mkdir -p "${dest_base}/${dest%/*}" || \ ob_error "$(ob_get_msg 'cant_make_config_dest_dir')" "${dest%/*}" + # Find the config package files. - config_dir_base="$(ob_get_system_path 'platconf' \ - "${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" "${OPK_HOST_PLAT}")" - if [ -d "${config_dir_base}-${OPK_SOURCE_VERSION_UPSTREAM}" ]; then - src_base="${config_dir_base}-${OPK_SOURCE_VERSION_UPSTREAM}" - elif [ -d "${config_dir_base}" ]; then - src_base="${config_dir_base}" - else + src_base='' + IFS="${system_paths_ifs}" + for config_dir_base in $(ob_get_system_path 'platconf' \ + "${OPK_SOURCE}" "${OPK_SOURCE_VERSION}" "${OPK_HOST_PLAT}"); do + unset IFS + if [ -d "${config_dir_base}" ]; then + src_base="${config_dir_base}" + fi + done + unset IFS + if [ -z "${src_base}" ]; then # This shouldn't happen unless the package maintainer neglected to # add the config package to the package's Build-Depends field. ob_error "$(ob_get_msg 'no_config_dir')" fi + # Copy the config file(s). ob_info "$(ob_get_msg 'copying_config_file')" "${src}" "${dest}" cp -p "${src_base}/${src}" "${dest_base}/${dest}" || \ |