gunnar: server install-kolab.sh,1.65,1.66

cvs at kolab.org cvs at kolab.org
Tue Jun 8 10:21:43 CEST 2010


Author: gunnar

Update of /kolabrepository/server
In directory doto:/tmp/cvs-serv32361

Modified Files:
	install-kolab.sh 
Log Message:
Extract the determine action part into its own function.

Index: install-kolab.sh
===================================================================
RCS file: /kolabrepository/server/install-kolab.sh,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- install-kolab.sh	8 Jun 2010 08:14:52 -0000	1.65
+++ install-kolab.sh	8 Jun 2010 08:21:41 -0000	1.66
@@ -212,69 +212,73 @@
 echo "Exclude following Kolab packages:   $EXCLUDEPKGS"
 echo
 
-umask 022
-SRCDIR=`pwd`
-WORKDIR=`mktmpdir`
-echo "Changing to temporary working directory $WORKDIR ..."
-cd "$WORKDIR"
-populate_workdir
+prefix_openpkg_determine_action() {
+    umask 022
+    SRCDIR=`pwd`
+    WORKDIR=`mktmpdir`
+    echo "Changing to temporary working directory $WORKDIR ..."
+    cd "$WORKDIR"
+    populate_workdir
 
-echo "Received no instructions. Trying to determine required action..."
-if [ -d "$PREFIX/etc/openpkg" -a -z "$FLAG_BOOTSTRAP" ]; then
+    echo "Received no instructions. Trying to determine required action..."
+    if [ -d "$PREFIX/etc/openpkg" -a -z "$FLAG_BOOTSTRAP" ]; then
     # Assume an upgrade based on the current directory
-    INSTALL=`pwd`
-    if [ "$FLAG_ENV" ]; then
-        echo "The OpenPKG environment already exists!"
-        exit 1
-    fi
-    echo "Found an OpenPKG environment. Assuming upgrade..."
-else
-    INSTALLER=`find . $FIND1 -name "openpkg-*.src.sh" -print`
-    BINARY=`find . $FIND1 -name "openpkg-*.sh" \! -name "openpkg-*.src.sh" -print`
-    if [ -z "$INSTALLER" ]; then
+	INSTALL=`pwd`
+	if [ "$FLAG_ENV" ]; then
+            echo "The OpenPKG environment already exists!"
+            exit 1
+	fi
+	echo "Found an OpenPKG environment. Assuming upgrade..."
+    else
+	INSTALLER=`find . $FIND1 -name "openpkg-*.src.sh" -print`
+	BINARY=`find . $FIND1 -name "openpkg-*.sh" \! -name "openpkg-*.src.sh" -print`
+	if [ -z "$INSTALLER" ]; then
         # No install script? Determine if there is a binary script
-        if [ -z "$BINARY" ]; then
-            echo "Sorry there is no OpenPKG installation script in the current directory!"
-            usage
-            exit 0
-        else
+            if [ -z "$BINARY" ]; then
+		echo "Sorry there is no OpenPKG installation script in the current directory!"
+		usage
+		exit 0
+            else
             # Looks like we only have a binary. Hope that it matches the plattform and install it
-            INSTALL="$BINARY"
-            echo "Found a binary OpenPKG package. This will be installed now."
-        fi
-    else
+		INSTALL="$BINARY"
+		echo "Found a binary OpenPKG package. This will be installed now."
+            fi
+	else
         # We have a source package. Check for a matching binary
-        PLATTAG=`shtool_get_plattag`
-        BIN=`basename "$INSTALLER" .src.sh`.$PLATTAG.sh
-        if [ "$BINARY" = "$BIN" ]; then
+            PLATTAG=`shtool_get_plattag`
+            BIN=`basename "$INSTALLER" .src.sh`.$PLATTAG.sh
+            if [ "$BINARY" = "$BIN" ]; then
             # There is a binary with the correct tag. Install it
-            INSTALL=$BIN
-            echo "Found a binary OpenPKG package with a correct tag. This will be installed now."
-        else
+		INSTALL=$BIN
+		echo "Found a binary OpenPKG package with a correct tag. This will be installed now."
+            else
             # Install from source
-            INSTALL=$INSTALLER
-            echo "Found a source based OpenPKG installer. Trying to install Kolab from source."
-        fi
+		INSTALL=$INSTALLER
+		echo "Found a source based OpenPKG installer. Trying to install Kolab from source."
+            fi
+	fi
     fi
-fi
 
-if echo "$INSTALL" | grep '\.src\.sh$' >/dev/null; then
+    if echo "$INSTALL" | grep '\.src\.sh$' >/dev/null; then
     # install from source
-    SRC="$INSTALL"
-    PLATTAG=`shtool_get_plattag`
-    BIN=`basename "$INSTALL" .src.sh`.$PLATTAG.sh
-    DIR=`dirname "$SRC"`
-elif echo "$INSTALL" | grep 'openpkg-.*\.sh$' >/dev/null; then
+	SRC="$INSTALL"
+	PLATTAG=`shtool_get_plattag`
+	BIN=`basename "$INSTALL" .src.sh`.$PLATTAG.sh
+	DIR=`dirname "$SRC"`
+    elif echo "$INSTALL" | grep 'openpkg-.*\.sh$' >/dev/null; then
     # install from binary
-    SRC=""
-    BIN="$INSTALL"
-    DIR=`dirname "$BIN"`
-elif [ -d "$PREFIX/etc/openpkg" ]; then
+	SRC=""
+	BIN="$INSTALL"
+	DIR=`dirname "$BIN"`
+    elif [ -d "$PREFIX/etc/openpkg" ]; then
     # upgrade
-    SRC=""
-    BIN=""
-    DIR="$INSTALL"
-fi
+	SRC=""
+	BIN=""
+	DIR="$INSTALL"
+    fi
+}
+
+prefix_openpkg_determine_action
 
 DIR=`cd $DIR; pwd`
 





More information about the commits mailing list