[mapguide-commits] r9167 - trunk/Tools/Vagrant/scripts

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Apr 22 09:00:21 PDT 2017


Author: jng
Date: 2017-04-22 09:00:21 -0700 (Sat, 22 Apr 2017)
New Revision: 9167

Modified:
   trunk/Tools/Vagrant/scripts/mginstallubuntu.sh
Log:
- Remove bash-isms from install script. This script now runs on vanilla POSIX sh. Fixes #2760
- Add support for:
  --no-service-install: To prevent automatic installation of service scripts
  --no-mgserver-start: Do not auto-start mgserver
  --no-tomcat-start: Do not auto-start tomcat
  --no-httpd-start: Do not auto-start httpd

All these new flags only apply if the --headless flag is specified. Fixes #2768

Modified: trunk/Tools/Vagrant/scripts/mginstallubuntu.sh
===================================================================
--- trunk/Tools/Vagrant/scripts/mginstallubuntu.sh	2017-04-21 20:04:40 UTC (rev 9166)
+++ trunk/Tools/Vagrant/scripts/mginstallubuntu.sh	2017-04-22 16:00:21 UTC (rev 9167)
@@ -1,5 +1,10 @@
-#!/bin/bash
-TEMPDIR=/tmp/build_mapguide
+#!/bin/sh
+
+# Set safe shell defaults
+set -euf
+
+HEADLESS=0
+TEMPDIR=/tmp/install_mapguide
 URL_HOST="http://download.osgeo.org"
 URL_RELPATH="/mapguide/releases"
 FDOVER_MAJOR=0
@@ -49,7 +54,7 @@
 fdo_provider_choice=""
 
 # Must have root
-if [[ $EUID -ne 0 ]]; then
+if ! [ "$(id -u)" = "0" ]; then
     echo "You must run this script with superuser privileges"
     exit 1
 fi
@@ -57,9 +62,20 @@
 while [ $# -gt 0 ]; do    # Until you run out of parameters...
     case "$1" in
         -headless|--headless)
-	    HEADLESS=1
-            #shift
-	    ;;
+            HEADLESS=1
+            ;;
+        -no-service-install|--no-service-install)
+            NO_SERVICE_INSTALL=1
+            ;;
+        -no-mgserver-start|--no-mgserver-start)
+            NO_MGSERVER_START=1
+            ;;
+        -no-tomcat-start|--no-tomcat-start)
+            NO_TOMCAT_START=1
+            ;;
+        -no-httpd-start|--no-httpd-start)
+            NO_HTTPD_START=1
+            ;;
         -with-sdf|--with-sdf)
             fdo_provider_choice="$fdo_provider_choice sdf"
             #shift
@@ -141,13 +157,14 @@
     shift   # Check next set of parameters.
 done
 
+echo "[install]: Installing pre-requisite packages"
 if [ "$HEADLESS" != "1" ]
 then
-# Install required packages 
-apt-get -y install dialog libexpat1 libssl1.0.0 odbcinst unixodbc libcurl3 libxslt1.1
+# Install required packages
+apt-get -y -q install dialog libexpat1 libssl1.0.0 odbcinst unixodbc libcurl3 libxslt1.1 libmysqlclient18 libpq5
 else
 # Install required packages 
-apt-get -y install libexpat1 libssl1.0.0 odbcinst unixodbc libcurl3 libxslt1.1
+apt-get -y -q install libexpat1 libssl1.0.0 odbcinst unixodbc libcurl3 libxslt1.1 libmysqlclient18 libpq5
 fi
 
 DIALOG=${DIALOG=dialog}
@@ -161,9 +178,8 @@
         dialog_server
         dialog_webtier
         #dialog_coordsys
-    else
-        dump_configuration
     fi
+    dump_configuration
     install_fdo
     install_mapguide_packages
     post_install
@@ -171,19 +187,21 @@
 
 set_server_vars()
 {
-    set -- $(<$1)
-    server_ip=$1
-    admin_port=$2
-    client_port=$3
-    site_port=$4
+    vars=$(cat $1)
+    set $vars
+    server_ip=${1:-$DEFAULT_SERVER_IP}
+    admin_port=${2:-$DEFAULT_ADMIN_PORT}
+    client_port=${3:-$DEFAULT_CLIENT_PORT}
+    site_port=${4:-$DEFAULT_SITE_PORT}
 }
 
 set_webtier_vars()
 {
-    set -- $(<$1)
-    webtier_server_ip=$1
-    httpd_port=$2
-    tomcat_port=$3
+    vars=$(cat $1)
+    set $vars
+    webtier_server_ip=${1:-$DEFAULT_SERVER_IP}
+    httpd_port=${2:-$DEFAULT_HTTPD_PORT}
+    tomcat_port=${3:-$DEFAULT_TOMCAT_PORT}
 }
 
 dump_configuration()
@@ -228,8 +246,8 @@
 
 dialog_fdo_provider()
 {
-    tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
-    trap "rm -f $tempfile" 0 1 2 5 15
+    tempfile=$(mktemp 2>/dev/null) || tempfile=/tmp/test$$
+    trap 'rm -f $tempfile' 0 1 2 5 15
 
     #arcsde    	"OSGeo FDO Provider for ArcSDE" off \
     # Disable RDBMS provider selection by default
@@ -246,7 +264,7 @@
             wfs    		"OSGeo FDO Provider for WFS" ON \
             wms   		"OSGeo FDO Provider for WMS" ON  2> $tempfile
 
-    fdo_provider_choice=`cat $tempfile | sed s/\"//g`
+    fdo_provider_choice=$(cat $tempfile | sed s/\"//g)
     case $? in
       1)
         echo "Cancelled"
@@ -259,12 +277,13 @@
 
 dialog_server()
 {
+    tempfile=$(mktemp 2>/dev/null) || tempfile=/tmp/form.$$
     dialog --backtitle "$INSTALLER_TITLE" --title "Server Configuration" \
             --form "\nSet the port numbers that the MapGuide Server will listen on" 25 60 16 \
             "Server IP:"   1 1 "${DEFAULT_SERVER_IP}"   1 25 25 30 \
             "Admin Port:"  2 1 "${DEFAULT_ADMIN_PORT}"  2 25 25 30 \
             "Client Port:" 3 1 "${DEFAULT_CLIENT_PORT}" 3 25 25 30 \
-            "Site Port:"   4 1 "${DEFAULT_SITE_PORT}"   4 25 25 30 2>/tmp/form.$$
+            "Site Port:"   4 1 "${DEFAULT_SITE_PORT}"   4 25 25 30 2> $tempfile
     case $? in
       1)
         echo "Cancelled"
@@ -273,17 +292,18 @@
         echo "Cancelled"
         exit 255;;
     esac
-    set_server_vars "/tmp/form.$$"
-    rm /tmp/form.$$
+    set_server_vars $tempfile
+    rm $tempfile
 }
 
 dialog_webtier()
 {
+    tempfile=$(mktemp 2>/dev/null) || tempfile=/tmp/form.$$
     dialog --backtitle "$INSTALLER_TITLE" --title "Web Tier Configuration" \
             --form "\nSet the port numbers that Apache/Tomcat will listen on" 25 60 16 \
             "Connect to Server IP:" 1 1 "${DEFAULT_SERVER_IP}"   1 25 25 30 \
             "Apache Port:"          2 1 "${DEFAULT_HTTPD_PORT}"  2 25 25 30 \
-            "Tomcat Port:"          3 1 "${DEFAULT_TOMCAT_PORT}" 3 25 25 30 2>/tmp/form.$$
+            "Tomcat Port:"          3 1 "${DEFAULT_TOMCAT_PORT}" 3 25 25 30 2> $tempfile
     case $? in
       1)
         echo "Cancelled"
@@ -292,21 +312,21 @@
         echo "Cancelled"
         exit 255;;
     esac
-    set_webtier_vars "/tmp/form.$$"
-    rm /tmp/form.$$
+    set_webtier_vars $tempfile
+    rm $tempfile
 }
 
 dialog_coordsys()
 {
-    tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
-    trap "rm -f $tempfile" 0 1 2 5 15
+    tempfile=$(mktemp 2>/dev/null) || tempfile=/tmp/test$$
+    trap 'rm -f $tempfile' 0 1 2 5 15
 
     dialog --backtitle "$INSTALLER_TITLE" \
             --title "Coordinate System Configuration" --clear \
             --radiolist "Choose the CS-Map profile you want for this MapGuide Installation" 20 80 5 \
             "full" "Download/Install the full set of data files" ON \
             "lite" "Download/Install the lite configuration (no grid files)" off  2> $tempfile
-    csmap_choice=`cat $tempfile`
+    csmap_choice=$(cat $tempfile)
     case $? in
       1)
         echo "Cancelled"
@@ -336,16 +356,15 @@
     # Download and install Ubuntu packages for FDO
     for file in $fdo_provider_choice
     do
-        #echo "Downloading ${URL}/fdo-${file}_${FDOVER}.deb"
-        wget -N ${URL}/fdo-${file}_${FDOVER}.deb
-        #echo "Installing fdo-${file}_${FDOVER}.deb"
-        dpkg -E -G --install fdo-${file}_${FDOVER}.deb
+        download_file="${TEMPDIR}/fdo-${file}_${FDOVER}.deb"
+        wget -N -O "${download_file}" "${URL}/fdo-${file}_${FDOVER}.deb"
+        dpkg -E -G --install "${download_file}"
     done
 
     # Nuke the old providers.xml, we're rebuiding it
     providersxml=/usr/local/fdo-${FDOVER_MAJOR_MINOR_REV}/lib/providers.xml
-    echo -ne "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\" ?>" > ${providersxml}
-    echo -ne "\n<FeatureProviderRegistry>" >> ${providersxml}
+    echo "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\" ?>" > ${providersxml}
+    echo "<FeatureProviderRegistry>" >> ${providersxml}
     for file in $fdo_provider_choice
     do
         case $file in
@@ -355,15 +374,15 @@
                 continue
             fi
             echo "Registering ArcSDE Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.ArcSDE.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for ArcSDE</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read/write access to an ESRI ArcSDE-based data store, using Oracle and SQL Server</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libArcSDEProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.ArcSDE.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for ArcSDE</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read/write access to an ESRI ArcSDE-based data store, using Oracle and SQL Server</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libArcSDEProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             arcsde_registered=1
             ;;
           gdal)
@@ -372,15 +391,15 @@
                 continue
             fi
             echo "Registering GDAL Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.Gdal.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for GDAL</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>FDO Provider for GDAL</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libGRFPProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.Gdal.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for GDAL</DisplayName>" >> ${providersxml}
+            echo "    <Description>FDO Provider for GDAL</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libGRFPProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             gdal_registered=1
             ;;
           kingoracle)
@@ -389,15 +408,15 @@
                 continue
             fi
             echo "Registering King Oracle Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.KingOracle.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for Oracle</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read/write access to spatial and attribute data in Oracle Spatial</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libKingOracleProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.KingOracle.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for Oracle</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read/write access to spatial and attribute data in Oracle Spatial</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libKingOracleProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             kingoracle_registered=1
             ;;
           rdbms)
@@ -406,35 +425,35 @@
                 continue
             fi
             echo "Registering ODBC Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.ODBC.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for ODBC</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>FDO Provider for ODBC</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libFdoODBC.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.ODBC.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for ODBC</DisplayName>" >> ${providersxml}
+            echo "    <Description>FDO Provider for ODBC</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libFdoODBC.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             echo "Registering PostgreSQL Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.PostgreSQL.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for PostgreSQL</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read/write access to PostgreSQL/PostGIS-based data store. Supports spatial data types and spatial query operations</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libFdoPostgreSQL.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.PostgreSQL.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for PostgreSQL</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read/write access to PostgreSQL/PostGIS-based data store. Supports spatial data types and spatial query operations</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libFdoPostgreSQL.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             echo "Registering MySQL Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.MySQL.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for MySQL</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>FDO Provider for MySQL</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libFdoMySQL.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.MySQL.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for MySQL</DisplayName>" >> ${providersxml}
+            echo "    <Description>FDO Provider for MySQL</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libFdoMySQL.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             rdbms_registered=1
             ;;
           ogr)
@@ -443,15 +462,15 @@
                 continue
             fi
             echo "Registering OGR Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.OGR.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for OGR</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>FDO Access to OGR Data Sources</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libOGRProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.OGR.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for OGR</DisplayName>" >> ${providersxml}
+            echo "    <Description>FDO Access to OGR Data Sources</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libOGRProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             ogr_registered=1
             ;;
           sdf)
@@ -460,15 +479,15 @@
                 continue
             fi
             echo "Registering SDF Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.SDF.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for SDF</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read/write access to Autodesk's spatial database format, a file-based geodatabase that supports multiple features/attributes, spatial indexing and file-locking</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libSDFProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.SDF.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for SDF</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read/write access to Autodesk's spatial database format, a file-based geodatabase that supports multiple features/attributes, spatial indexing and file-locking</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libSDFProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             sdf_registered=1
             ;;
           shp)
@@ -477,15 +496,15 @@
                 continue
             fi
             echo "Registering SHP Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.SHP.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for SHP</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read/write access to spatial and attribute data in an ESRI SHP file</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libSHPProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.SHP.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for SHP</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read/write access to spatial and attribute data in an ESRI SHP file</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libSHPProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             shp_registered=1
             ;;
           sqlite)
@@ -494,15 +513,15 @@
                 continue
             fi
             echo "Registering SQLite Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.SQLite.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for SQLite</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read/write access to feature data in a SQLite file</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libSQLiteProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.SQLite.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for SQLite</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read/write access to feature data in a SQLite file</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libSQLiteProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             sqlite_registered=1
             ;;
           wfs)
@@ -511,15 +530,15 @@
                 continue
             fi
             echo "Registering WFS Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.WFS.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for WFS</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read access to OGC WFS-based data store</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libWFSProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.WFS.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for WFS</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read access to OGC WFS-based data store</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libWFSProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             wfs_registered=1
             ;;
           wms)
@@ -528,35 +547,34 @@
                 continue
             fi
             echo "Registering WMS Provider"
-            echo -ne "\n  <FeatureProvider>" >> ${providersxml}
-            echo -ne "\n    <Name>OSGeo.WMS.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
-            echo -ne "\n    <DisplayName>OSGeo FDO Provider for WMS</DisplayName>" >> ${providersxml}
-            echo -ne "\n    <Description>Read access to OGC WMS-based data store</Description>" >> ${providersxml}
-            echo -ne "\n    <IsManaged>False</IsManaged>" >> ${providersxml}
-            echo -ne "\n    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
-            echo -ne "\n    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
-            echo -ne "\n    <LibraryPath>libWMSProvider.so</LibraryPath>" >> ${providersxml}
-            echo -ne "\n  </FeatureProvider>" >> ${providersxml}
+            echo "  <FeatureProvider>" >> ${providersxml}
+            echo "    <Name>OSGeo.WMS.${FDOVER_MAJOR_MINOR}</Name>" >> ${providersxml}
+            echo "    <DisplayName>OSGeo FDO Provider for WMS</DisplayName>" >> ${providersxml}
+            echo "    <Description>Read access to OGC WMS-based data store</Description>" >> ${providersxml}
+            echo "    <IsManaged>False</IsManaged>" >> ${providersxml}
+            echo "    <Version>${FDOVER_MAJOR_MINOR_REV}.0</Version>" >> ${providersxml}
+            echo "    <FeatureDataObjectsVersion>${FDOVER_MAJOR_MINOR_REV}.0</FeatureDataObjectsVersion>" >> ${providersxml}
+            echo "    <LibraryPath>libWMSProvider.so</LibraryPath>" >> ${providersxml}
+            echo "  </FeatureProvider>" >> ${providersxml}
             wms_registered=1
             ;;
         esac
     done
-    echo -ne "\n</FeatureProviderRegistry>" >> ${providersxml}
+    echo "</FeatureProviderRegistry>" >> ${providersxml}
 }
 
 install_mapguide_packages()
 {
     # Download Ubuntu packages for MapGuide
     mapguide_packages="platformbase coordsys common server webextensions httpd"
-    if [ $csmap_choice = "lite" ]; then
+    if [ "$csmap_choice" = "lite" ]; then
         mapguide_packages="platformbase coordsys-lite common server webextensions httpd"
     fi
     for file in $mapguide_packages
     do
-        echo "[download]: ${URL}/mapguideopensource-${file}_${MGVER}.deb"
-        wget -N ${URL}/mapguideopensource-${file}_${MGVER}.deb
-        echo "[install]: mapguideopensource-${file}_${MGVER}.deb"
-        dpkg -E -G --install mapguideopensource-${file}_${MGVER}.deb
+        download_file="${TEMPDIR}/mapguideopensource-${file}_${MGVER}.deb"
+        wget -N -O "${download_file}" "${URL}/mapguideopensource-${file}_${MGVER}.deb"
+        dpkg -E -G --install "${download_file}"
     done
 }
 
@@ -582,25 +600,52 @@
     echo "[config]: Fixing permissions for certain folders"
     chmod 777 /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/www/TempDir
 
-    echo "[config]: Registering Services"
-    ln -s /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/mapguidectl /etc/init.d/mapguide
-    ln -s /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/apache2/bin/apachectl /etc/init.d/apache-mapguide
-    update-rc.d mapguide defaults 35 65
-    update-rc.d apache-mapguide defaults 30 70
+    if [ "$HEADLESS" = "1" ] && [ "$NO_SERVICE_INSTALL" = "1" ];
+    then
+        echo "[config]: Skipping service registration as --headless and --no-service-install specified"
+    else
+        echo "[config]: Registering Services"
+        ln -s /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/mapguidectl /etc/init.d/mapguide
+        ln -s /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/apache2/bin/apachectl /etc/init.d/apache-mapguide
+        update-rc.d mapguide defaults 35 65
+        update-rc.d apache-mapguide defaults 30 70
+    fi
     
-    echo "[install]: Starting httpd"
-    /etc/init.d/apache-mapguide start
-    echo "[install]: Starting tomcat"
-    pushd /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/tomcat/bin
-    sh ./startup.sh
-    popd
-    echo "[install]: Starting mgserver"
-    /etc/init.d/mapguide start
+    if [ "$HEADLESS" = "1" ] && [ "$NO_HTTPD_START" = "1" ];
+    then
+        echo "[install]: Skipping httpd auto-start as --headless and --no-httpd-start specified"
+    else
+        if [ -e "/etc/init.d/apache-mapguide" ]; 
+        then
+            echo "[install]: Starting httpd"
+            /etc/init.d/apache-mapguide start
+        else
+            echo "[install]: WARNING - apache-mapguide service entry not found"
+        fi
+    fi
+    if [ "$HEADLESS" = "1" ] && [ "$NO_MGSERVER_START" = "1" ];
+    then
+        echo "[install]: Skipping mgserver auto-start as --headless and --no-mgserver-start specified"
+    else
+        if [ -e "/etc/init.d/mapguide" ]; 
+        then
+            echo "[install]: Starting mgserver"
+            /etc/init.d/mapguide start
+        else
+            echo "[install]: WARNING - mgserver service entry not found"
+        fi
+    fi
+    if [ "$HEADLESS" = "1" ] && [ "$NO_TOMCAT_START" = "1" ];
+    then
+        echo "[install]: Skipping tomcat auto-start as --headless and --no-tomcat-start specified"
+    else
+        echo "[install]: Starting tomcat"
+        # This can be allowed to fail
+        sh /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/tomcat/bin/startup.sh || true
+    fi
     echo "DONE!"
 }
 
 # Create temporary download directory
 mkdir -p ${TEMPDIR}
-pushd ${TEMPDIR}
 main
-popd



More information about the mapguide-commits mailing list