[sysadmin-bin: 53/168] Create a 'functions' library



commit 379cc1c9023a87864c60d2be8ddaa5abd739c1d8
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Mar 19 18:16:46 2009 -0400

    Create a 'functions' library
    
    Move repository name validation to validate_repository_name
    a new 'functions' file.

 create-repository |   10 +++-------
 functions         |   12 ++++++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/create-repository b/create-repository
index 4fbeef7..75da363 100755
--- a/create-repository
+++ b/create-repository
@@ -8,14 +8,10 @@
 
 BINDIR=/home/admin/gitadmin-bin
 
-name="$1"
+. $BINDIR/functions
 
-# This check actually excludes some current names like gtk+ and libIDL,
-# but it reflects our general policy
-if ! expr "$name" : "\([a-z][a-z0-9-]*\|perl-[a-zA-Z][a-zA-Z0-9-]*\)$" > /dev/null ; then
-   echo "'$name' is not a valid name for a GNOME project" 1>&2
-   exit 1
-fi
+validate_repository_name "$1"
+name="$1"
 
 if [ -e /git/$name.git -o -e /git/preview/$name.git ] ; then
    echo "'$name' already exists" 1>&2
diff --git a/functions b/functions
new file mode 100644
index 0000000..691fe03
--- /dev/null
+++ b/functions
@@ -0,0 +1,12 @@
+# -*-Shell-script-*-
+
+# Common functions to use for the GNOME Git scripts
+
+# This check actually excludes some current names like gtk+ and libIDL,
+# but it reflects our general policy
+validate_repository_name() {
+    if ! expr "$1" : "\([a-z][a-z0-9-]*\|perl-[a-zA-Z][a-zA-Z0-9-]*\)$" > /dev/null ; then
+        echo "'$1' is not a valid name for a GNOME project" 1>&2
+        exit 1
+    fi
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]