summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-21 14:48:21 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-21 14:48:21 (EST)
commit5ea4ab3467d2933ff95bada09fc3fdbe05e0077d (patch)
tree61cc5251de1c0ba610535999cd978af1ee78aeb6
parentccd620cc4df4b302e384459636bdd5613f42d9ad (diff)
Support multiple arguments in oh-gencontrol.
-rw-r--r--src/oh-gencontrol83
1 files changed, 48 insertions, 35 deletions
diff --git a/src/oh-gencontrol b/src/oh-gencontrol
index 6407eda..066200b 100644
--- a/src/oh-gencontrol
+++ b/src/oh-gencontrol
@@ -38,36 +38,8 @@ invalid_pkg_name()
exit 2
}
-if [ ${#} -eq 0 ]; then
- print_usage ${0} >&2
- exit 1
-fi
-
-is_src=false
-opts=$(getopt -n "${0}" -o 's' -- "${@}")
-if [ ${?} -ne 0 ]; then
- print_usage "${0}" >&2
- exit 1;
-fi
-eval set -- "${opts}"
-while true; do
- case "${1}" in
- -s)
- is_src=true
- shift
- ;;
- --)
- shift
- break
- ;;
- *)
- print_usage "${0}" >&2
- exit 1
- ;;
- esac
-done
-
-if ${is_src}; then
+gen_control_src()
+{
srcpkg=$(oh_get_field Source) || missing_field Source
oh_validate_pkg_name "${srcpkg}" || invalid_pkg_name "${srcpkg}"
@@ -88,12 +60,10 @@ if ${is_src}; then
{ printf 'Maintainer: ' && oh_get_field Maintainer;} >> ${control}
[ ${?} -eq 1 ] && missing_field Maintainer
{ printf 'Homepage: ' && oh_get_field Homepage;} >> ${control}
-else
- if [ ${#} -ne 1 ]; then
- print_usage "${0}" >&2
- exit 1
- fi
+}
+gen_control_bin()
+{
binpkg="${1}"
oh_validate_pkg_name "${binpkg}" || invalid_pkg_name "${binpkg}"
@@ -148,4 +118,47 @@ else
# TODO: Handle links?
fi
done
+}
+
+if [ ${#} -eq 0 ]; then
+ print_usage ${0} >&2
+ exit 1
+fi
+
+is_src=false
+opts=$(getopt -n "${0}" -o 's' -- "${@}")
+if [ ${?} -ne 0 ]; then
+ print_usage "${0}" >&2
+ exit 1;
+fi
+eval set -- "${opts}"
+while true; do
+ case "${1}" in
+ -s)
+ is_src=true
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ print_usage "${0}" >&2
+ exit 1
+ ;;
+ esac
+done
+
+if ${is_src}; then
+ gen_control_src
+else
+ if [ ${#} -eq 0 ]; then
+ print_usage "${0}" >&2
+ exit 1
+ fi
+
+ while [ ${#} -gt 0 ]; do
+ gen_control_bin "${1}"
+ shift
+ done
fi