From 4227ff88a1b6c022af7064bc52deaf3efc19eff8 Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pjm@nac.net>
Date: Sat, 20 Oct 2012 22:23:02 -0400
Subject: Let user specify the dir in which files are found.

---
(limited to 'src')

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
--
cgit v0.9.1