summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--locale/en_US/opkhelper.sh1
-rw-r--r--src/oh-installfiles.sh20
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