From 3d45f943876853b3a745914c8a5a74ffc039f99b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20B=C3=A9langer?= <snowmaniscool@gmail.com>
Date: Wed, 14 Oct 2009 15:18:07 -0400
Subject: Moved chk_license to db-functions file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Eric BĂ©langer <snowmaniscool@gmail.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
---
 db-functions | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'db-functions')

diff --git a/db-functions b/db-functions
index f4f9ee9..6611a92 100644
--- a/db-functions
+++ b/db-functions
@@ -110,4 +110,20 @@ get_repos_for_host() {
 	fi
 }
 
+#usage: chk_license ${license[@]}"
+chk_license() {
+    local l
+    for l in "$@"; do
+        l="$(echo $l | tr '[:upper:]' '[:lower:]')"
+        for allowed in ${ALLOWED_LICENSES[@]}; do
+            allowed="$(echo $allowed | tr '[:upper:]' '[:lower:]')"
+            if [ "$l" = "$allowed" ]; then
+                return 0
+            fi
+        done
+    done
+
+    return 1
+}
+
 # vim: set ts=4 sw=4 noet ft=sh:
-- 
cgit v1.2.3-2-g168b