summaryrefslogtreecommitdiffstats
path: root/lib/controlfields
diff options
context:
space:
mode:
Diffstat (limited to 'lib/controlfields')
-rw-r--r--lib/controlfields12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/controlfields b/lib/controlfields
index 7eda765..a1a3f7b 100644
--- a/lib/controlfields
+++ b/lib/controlfields
@@ -108,3 +108,15 @@ ${_line}"
echo "${_value}"
return 0
}
+
+# Validates a package name.
+# Parameters:
+# package name
+# Return value:
+# 0 on valid name
+# 1 on invalid name
+oh_validate_pkg_name()
+{
+ {echo "${1}" | grep -E '^[a-z0-9][a-z0-9.+-]+$'} && return 0
+ return 1
+}