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 | |
parent | 6f59eb5f7feb1b8a60c3ddea8960adedfbe63dfd (diff) |
Let user specify the dir in which files are found.
-rw-r--r-- | locale/en_US/opkhelper.sh | 1 | ||||
-rw-r--r-- | src/oh-installfiles.sh | 20 |
2 files changed, 18 insertions, 3 deletions
diff --git a/locale/en_US/opkhelper.sh b/locale/en_US/opkhelper.sh index 6cb20f0..8c3a71d 100644 --- a/locale/en_US/opkhelper.sh +++ b/locale/en_US/opkhelper.sh @@ -17,4 +17,5 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +msg_opkhelper_bad_opt='Invalid option' msg_opkhelper_installing_files='Installing files for package "%s"...' 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 |