Code

* Script updates
[gosa.git] / gosa-core / contrib / make-gosa-package
index 461b4f135087b0b1c8986b075a2fdde73c9a99a3..ffdf3c9ffbd3a64dda16652ecc58fc217de56948 100755 (executable)
@@ -1,13 +1,78 @@
-#!/bin/sh
-
-# TODO: getopts ###########################################################
+#!/bin/bash
+# This code is part of GOsa (http://www.gosa-project.org)
+# Copyright (C) 2008 GONICUS GmbH
+#
+# ID: $$Id$$
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# Define defaults
 RELEASE_REASON="GOsa svn snapshot"
 BRANCH="trunk"
 SECTION="web"
 SI_SECTION="utils"
 TARGET_RELEASE="etch"
 MAKE_PLUGINS=""
-###########################################################################
+
+usage() {
+       cat <<-EOF
+       GOsa Debian package build tool. Build snapshots from selected SVN locations.
+       Usage: ${0##*/} [options]
+       
+       Options:
+         -b|--branch      Branch to export [$BRANCH]
+         -p|--plugins     Comma seperate list of plugins to build. Leave empty to build all.
+         -r|--release     Debian release to build for [$TARGET_RELEASE]
+         -c|--changelog   Debian changelog entry [$RELEASE_REASON]
+         -s|--section     Debian section to place GOsa in [$SECTION]
+         -i|--si-section  Debian section to place GOsa-SI in [$SI_SECTION]
+         -h|--help        this help
+
+       EOF
+       exit 1
+}
+
+# Import command line parameters
+PARMS=`getopt -o brscip:,h --long branch,changelog,plugins,section,si-section,release:,help -n "${0##*/}" -- "$@"`
+eval set -- "$PARMS"
+
+while true; do
+        case "$1" in
+                -b|--branch)
+                       BRANCH=$2; shift 2 ;;
+                -r|--release)
+                       TARGET_RELEASE=$2; shift 2 ;;
+                -c|--changelog)
+                       RELEASE_REASON=$2; shift 2 ;;
+                -p|--plugins)
+                       MAKE_PLUGINS=${2//,/ }; shift 2 ;;
+                -s|--section)
+                       SECTION=$2; shift 2 ;;
+                -i|--si-section)
+                       SI_SECTION=$2; shift 2 ;;
+                -h|--help)
+                       usage ;;
+                --)
+                       shift; break ;;
+                *)
+                       echo "getopt error" ;;
+        esac
+done
+
+echo $BRANCH
+exit 0
 
 [ $BRANCH = "trunk" ] || BRANCH="branches/$BRANCH"
 echo "Loading svn information for '${BRANCH}'..."
@@ -119,14 +184,7 @@ else
 fi
 
 echo "Removing gosa snapshot..."
-#for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
-#      rm -rf "$dir"
-#done
-
-echo
-echo "Moving result to 'dest'"
-[ -d dest ] && rm -rf dest
-mkdir dest
-
-mv *.deb *.changes *.dsc *.gz dest/
+for dir in $GOSA_DIR $GOSA_SI_DIR $GOSA_PLUGIN_DIRS; do
+       rm -rf "$dir"
+done