[SCM] pkg-kde repository scripts branch, master, updated. f6ae4f8a61c7f93340c4cdcd5d5df2686dd20d9b

Modestas Vainius modax-guest at alioth.debian.org
Sat Nov 14 12:45:16 UTC 2009


The following commit has been merged in the master branch:
commit 354988e4590f3f977baad8d1b4099c4edc126de4
Author: Modestas Vainius <modestas at vainius.eu>
Date:   Sat Nov 14 14:15:09 2009 +0200

    create_repository: use named options.
---
 create-repository |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/create-repository b/create-repository
index 7537e1a..b060800 100755
--- a/create-repository
+++ b/create-repository
@@ -2,16 +2,30 @@
 
 set -e
 
-if [ "$#" -ne 3 ]; then
-    echo "Usage: $0 repository_name repository_path repository_url" >&2
-    exit 1
-fi
-
 SUBDIRS="conf keyring ."
 
-name="$1"
-path="$2"
-url="$3"
+usage() {
+	echo "Usage: $0 -n name -p path -u url [ file ] ..." >&2
+	exit 1
+}
+
+# Parse options
+name=""
+path=""
+url=""
+while getopts n:p:u: opt; do
+	case $opt in
+		n)  name="$OPTARG";;
+		p)  path="$OPTARG";;
+		u)  url="$OPTARG";;
+		\?) usage;;
+	esac
+done
+
+if [ -z "$name" ] || [ -z "$path" ] || [ -z "$url" ]; then
+	echo "You must specify name, path and url" >&2
+	usage;
+fi
 
 if [ -e "$name" ]; then
     echo "File or directory $name already exists." >&2

-- 
pkg-kde repository scripts



More information about the pkg-kde-commits mailing list