[mapguide-commits] r8134 - branches/2.6/vagrant/scripts

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri May 16 09:11:21 PDT 2014


Author: jng
Date: 2014-05-16 09:11:21 -0700 (Fri, 16 May 2014)
New Revision: 8134

Added:
   branches/2.6/vagrant/scripts/csmap_optimize.sh
Modified:
   branches/2.6/vagrant/scripts/dpkgmapguide.sh
   branches/2.6/vagrant/scripts/mginstallubuntu.sh
   branches/2.6/vagrant/scripts/mguninstallubuntu.sh
Log:
Linux build script updates:
 - #1736: Produce a coordsys-lite package which contains only the CSD files, OSTN binary files and NameMapper.csv
 - Update the Ubuntu installer script to support:
    - Configuration of server IP
    - Configuration of server listening ports
    - Configuration of httpd/tomcat listening ports
    - Choice of CS-Map (full or lite) to download and install

Added: branches/2.6/vagrant/scripts/csmap_optimize.sh
===================================================================
--- branches/2.6/vagrant/scripts/csmap_optimize.sh	                        (rev 0)
+++ branches/2.6/vagrant/scripts/csmap_optimize.sh	2014-05-16 16:11:21 UTC (rev 8134)
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# csmap_optimize.sh
+#
+# This script optimizes the size of CS-Map dictionary files by removing references
+# to all country-specific grid files which represents the bulk of the distribution
+# size
+#
+# This script is meant to be called from within dpkgmapguide.sh
+
+EXCLUDEFILE=
+PACKAGENAME=mapguideopensource-coordsys-lite
+PACKAGEDIR=mapguidecoordsyslite
+ROOT=${BUILDROOT}/debian/mapguidecoordsyslite
+TREE=${BUILDROOT}/debian
+CPROOT=${ROOT}/${MGINST}
+DIRLIST="share"
+REMOVELIST="\.a\$ \.la\$ \.c\$ \.o\$ \.mak\$ \.nmk\$"
+STRIPLIST="\.so\$"
+CSMAP_OUT=/tmp/csmap_build_area/share/gis/coordsys
+
+if [ ! -d /tmp/csmap_build_area ]; then
+    mkdir -p ~/tmp/csmap_build_area
+fi
+
+comment_gdc()
+{
+    GDCFILE=$1
+    sed -i 's/.\\Australia/#.\\Australia/g' $GDCFILE
+    sed -i 's/.\\Canada/#.\\Canada/g' $GDCFILE
+    sed -i 's/.\\France/#.\\France/g' $GDCFILE
+    sed -i 's/.\\Germany/#.\\Germany/g' $GDCFILE
+    sed -i 's/.\\Japan/#.\\Japan/g' $GDCFILE
+    sed -i 's/.\\NewZealand/#.\\NewZealand/g' $GDCFILE
+    sed -i 's/.\\Spain/#.\\Spain/g' $GDCFILE
+    sed -i 's/.\\Switzerland/#.\\Switzerland/g' $GDCFILE
+    sed -i 's/.\\Usa/#.\\Usa/g' $GDCFILE
+    sed -i 's/.\\WW15MGH.GRD/#.\\WW15MGH.GRD/g' $GDCFILE
+    echo "Commented out grid file references in $GDCFILE"
+}
+
+# Copy CS-Map files to build area. We rely on the fact that the MapGuide build system
+# also leaves a copy of the CS_Comp executable in this directory which we'll use to 
+# re-compile our dictionary files after some modifications
+cp -R /${MGINST}/share/gis/coordsys/* ~/csmap_build_area
+pushd ~/csmap_build_area
+    # Comment out grid file entries in all gdc files
+    for gdcf in *.gdc
+    do
+        comment_gdc $gdcf
+    done
+    # Re-compile
+    ./CS_Comp -b . .
+    if [ ! -d $CSMAP_OUT ]; then
+        mkdir -p $CSMAP_OUT
+    fi
+    # Copy output
+    cp *.CSD $CSMAP_OUT
+    cp NameMapper.csv $CSMAP_OUT
+    cp OSTN02._02 $CSMAP_OUT
+    cp OSTN97._nt $CSMAP_OUT
+popd
+MGINST=tmp/csmap_build_area
+source ./dpkgbuild.sh
+rm -rf /tmp/csmap_build_area

Modified: branches/2.6/vagrant/scripts/dpkgmapguide.sh
===================================================================
--- branches/2.6/vagrant/scripts/dpkgmapguide.sh	2014-05-15 17:07:34 UTC (rev 8133)
+++ branches/2.6/vagrant/scripts/dpkgmapguide.sh	2014-05-16 16:11:21 UTC (rev 8134)
@@ -5,6 +5,12 @@
 #   control - generated all packages control file with subst params
 #   changelog - generated changelog file
 #   substvars - subst params created by dpkg-shlibdeps
+#   mapguideplatformbase/ - packaging directory for common MapGuide components
+#     usr/local/mapguideopensource-2.6.0/ - copied tree for common components
+#     DEBIAN/
+#       control - control file generated from dpkg-gencontrol
+#       symbols - symbols file generated from dpkg-gensymbols
+#
 #   mapguidecommon/ - packaging directory for common MapGuide components
 #     usr/local/mapguideopensource-2.6.0/ - copied tree for common components
 #     DEBIAN/
@@ -17,6 +23,12 @@
 #       control - control file generated from dpkg-gencontrol
 #       symbols - symbols file generated from dpkg-gensymbols
 #
+#   mapguidecoordsyslite/ - packaging directory for CS-Map coordinate system dictionaries
+#     usr/local/mapguideopensource-2.6.0/ - copied tree for common components
+#     DEBIAN/
+#       control - control file generated from dpkg-gencontrol
+#       symbols - symbols file generated from dpkg-gensymbols
+#
 #   mapguideserver/ - packaging directory for MapGuide Server
 #     usr/local/mapguideopensource-2.6.0/ - copied tree for Server
 #     DEBIAN/
@@ -34,9 +46,7 @@
 #     DEBIAN/
 #       control - control file generated from dpkg-gencontrol
 #       symbols - symbols file generated from dpkg-gensymbols
-# 
 #
-# Make sure setvars.sh is called first before running this script
 
 BUILDROOT=`pwd`
 MGBUILD=2.6.0
@@ -116,6 +126,13 @@
 Depends: \${mapguidecoordsys:Depends}
 Description:  CS-Map Coordinate System Dictionary data files
 
+Package: mapguideopensource-coordsys-lite
+Architecture: ${ARCH}
+Section: msic
+Priority: optional
+Depends: \${mapguidecoordsys:Depends}
+Description:  CS-Map Coordinate System Dictionary data files. Lite version. Excludes country-specific grid files
+
 Package: mapguideopensource-server
 Architecture: ${ARCH}
 Section: misc
@@ -194,6 +211,8 @@
 
 source ./dpkgbuild.sh
 
+source ./csmap_optimize.sh
+
 MGINST=usr/local/mapguideopensource-${MGBUILD}/server
 ROOT=${BUILDROOT}/debian/mapguideserver
 TREE=${BUILDROOT}/debian

Modified: branches/2.6/vagrant/scripts/mginstallubuntu.sh
===================================================================
--- branches/2.6/vagrant/scripts/mginstallubuntu.sh	2014-05-15 17:07:34 UTC (rev 8133)
+++ branches/2.6/vagrant/scripts/mginstallubuntu.sh	2014-05-16 16:11:21 UTC (rev 8134)
@@ -12,7 +12,29 @@
 MGBUILD=0
 MGARCH=i386
 MGVER=${MGVER_MAJOR_MINOR_REV}-${MGBUILD}_${MGARCH}
+INSTALLER_TITLE="MapGuide Open Source Ubuntu installer"
 
+DEFAULT_SERVER_IP="127.0.0.1"
+
+DEFAULT_ADMIN_PORT=2810
+DEFAULT_CLIENT_PORT=2811
+DEFAULT_SITE_PORT=2812
+
+DEFAULT_HTTPD_PORT=8008
+DEFAULT_TOMCAT_PORT=8009
+
+csmap_choice="full"
+
+server_ip="127.0.0.1"
+webtier_server_ip="127.0.0.1"
+
+admin_port=2810
+client_port=2811
+site_port=2812
+
+httpd_port=8008
+tomcat_port=8009
+
 # Must have root
 if [[ $EUID -ne 0 ]]; then
 	echo "You must run this script with superuser privileges"
@@ -28,14 +50,59 @@
 {
 	dialog_welcome
 	dialog_fdo_provider
-	start_install
+    dialog_server
+    dialog_webtier
+    dialog_coordsys
+    #dump_configuration
+	install_fdo
 	install_mapguide_packages
 	post_install
 }
 
+set_server_vars()
+{
+    set -- $(<$1)
+    server_ip=$1
+    admin_port=$2
+    client_port=$3
+    site_port=$4
+}
+
+set_webtier_vars()
+{
+    set -- $(<$1)
+    webtier_server_ip=$1
+    httpd_port=$2
+    tomcat_port=$3
+}
+
+dump_configuration()
+{
+    echo "********* Configuration Summary ************"
+    echo " Default Ports (Server)"
+    echo "  Admin: ${DEFAULT_ADMIN_PORT}"
+    echo "  Client: ${DEFAULT_CLIENT_PORT}"
+    echo "  Site: ${DEFAULT_SITE_PORT}"
+    echo " Default Ports (WebTier)"
+    echo "  Apache: ${DEFAULT_HTTPD_PORT}"
+    echo "  Tomcat: ${DEFAULT_TOMCAT_PORT}"
+    echo " Configured Ports (Server)"
+    echo "  Admin: ${admin_port}"
+    echo "  Client: ${client_port}"
+    echo "  Site: ${site_port}"
+    echo " Configured Ports (WebTier)"
+    echo "  Apache: ${httpd_port}"
+    echo "  Tomcat: ${tomcat_port}"
+    echo " Other choices"
+    echo "  FDO: ${fdo_provider_choice}"
+    echo "  CS-Map: ${csmap_choice}"
+    echo "  Server IP: ${server_ip}"
+    echo "********************************************"
+}
+
 dialog_welcome()
 {
-	$DIALOG --backtitle "MapGuide Open Source Ubuntu installer" \
+	$DIALOG --backtitle "$INSTALLER_TITLE" \
 	        --title "Welcome" --clear \
         	--yesno "Welcome to the MapGuide Open Source Ubuntu installer. Would you like to proceed?" 10 30
 
@@ -56,7 +123,7 @@
 
 	#arcsde    	"OSGeo FDO Provider for ArcSDE" off \
 	# Disable RDBMS provider selection by default
-	$DIALOG --backtitle "MapGuide Open Source Ubuntu installer" \
+	$DIALOG --backtitle "$INSTALLER_TITLE" \
 			--title "FDO Providers" --clear \
 		    --checklist "Check the FDO Providers you want to install" 20 61 5 \
 		    sdf  		"OSGeo FDO Provider for SDF" ON \
@@ -65,11 +132,11 @@
 		    gdal    	"OSGeo FDO Provider for GDAL" ON \
    		    ogr    		"OSGeo FDO Provider for OGR" ON \
    		    kingoracle  "OSGeo FDO Provider for Oracle" off \
-		    rdbms	"RDBMS FDO Providers (ODBC, MySQL, PostgreSQL)" off \
+		    rdbms	    "RDBMS FDO Providers (ODBC, MySQL, PostgreSQL)" off \
    		    wfs    		"OSGeo FDO Provider for WFS" ON \
 		    wms   		"OSGeo FDO Provider for WMS" ON  2> $tempfile
 
-	choice=`cat $tempfile | sed s/\"//g`
+	fdo_provider_choice=`cat $tempfile | sed s/\"//g`
 	case $? in
 	  1)
 		echo "Cancelled"
@@ -80,8 +147,68 @@
 	esac
 }
 
-start_install()
+dialog_server()
 {
+    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.$$
+    case $? in
+      1)
+	    echo "Cancelled"
+	    exit 1;;
+      255)
+	    echo "Cancelled"
+	    exit 255;;
+    esac
+    set_server_vars "/tmp/form.$$"
+    rm /tmp/form.$$
+}
+
+dialog_webtier()
+{
+    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.$$
+    case $? in
+      1)
+	    echo "Cancelled"
+	    exit 1;;
+      255)
+	    echo "Cancelled"
+	    exit 255;;
+    esac
+    set_webtier_vars "/tmp/form.$$"
+    rm /tmp/form.$$
+}
+
+dialog_coordsys()
+{
+    tempfile=`tempfile 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`
+    case $? in
+      1)
+        echo "Cancelled"
+        exit 1;;
+      255)
+        echo "Cancelled"
+        exit 255;;
+    esac
+}
+
+install_fdo()
+{
 	# set initial registration state
 	arcsde_registered=0
 	gdal_registered=0
@@ -95,9 +222,9 @@
 	wms_registered=0
 
 	# Include core and rdbms packages regardless of choice.
-	choice="core rdbms $choice"
+	fdo_provider_choice="core rdbms $fdo_provider_choice"
 	# Download and install Ubuntu packages for FDO
-	for file in $choice
+	for file in $fdo_provider_choice
 	do
 	  #echo "Downloading ${URL}/fdo-${file}_${FDOVER}.deb"
 	  wget -N ${URL}/fdo-${file}_${FDOVER}.deb
@@ -109,7 +236,7 @@
 	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}
-	for file in $choice
+	for file in $fdo_provider_choice
 	do
 		case $file in
 		  arcsde)
@@ -310,17 +437,38 @@
 install_mapguide_packages()
 {
 	# Download Ubuntu packages for MapGuide
-	for file in platformbase coordsys common server webextensions httpd
+    mapguide_packages="platformbase coordsys common server webextensions httpd"
+    if [ $csmap_choice = "lite" ]; then
+        mapguide_packages="platformbase coordsys-lite common server webextensions httpd"
+    fi
+	for file in $mapguide_packages
 	do
-	  echo "Downloading: ${URL}/mapguideopensource-${file}_${MGVER}.deb"
+	  echo "[download]: ${URL}/mapguideopensource-${file}_${MGVER}.deb"
 	  wget -N ${URL}/mapguideopensource-${file}_${MGVER}.deb
- 	  echo "Installing: mapguideopensource-${file}_${MGVER}.deb"
+ 	  echo "[install]: mapguideopensource-${file}_${MGVER}.deb"
    	  dpkg -E -G --install mapguideopensource-${file}_${MGVER}.deb
 	done
 }
 
 post_install()
 {
+    echo "[config]: Updating serverconfig.ini with configuration choices"
+    sed -i 's/MachineIp.*= '"${DEFAULT_SERVER_IP}"'/MachineIp = '"${server_ip}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/serverconfig.ini
+    sed -i 's/IpAddress.*= '"${DEFAULT_SERVER_IP}"'/IpAddress = '"${server_ip}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/serverconfig.ini
+    sed -i 's/Port.*= '"${DEFAULT_ADMIN_PORT}"'/Port = '"${admin_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/serverconfig.ini
+    sed -i 's/Port.*= '"${DEFAULT_CLIENT_PORT}"'/Port = '"${client_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/serverconfig.ini
+    sed -i 's/Port.*= '"${DEFAULT_SITE_PORT}"'/Port = '"${site_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin/serverconfig.ini
+    echo "[config]: Updating webconfig.ini with configuration choices"
+    sed -i 's/IpAddress.*= '"${DEFAULT_SERVER_IP}"'/IpAddress = '"${webtier_server_ip}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/www/webconfig.ini
+    sed -i 's/Port.*= '"${DEFAULT_ADMIN_PORT}"'/Port = '"${admin_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/www/webconfig.ini
+    sed -i 's/Port.*= '"${DEFAULT_CLIENT_PORT}"'/Port = '"${client_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/www/webconfig.ini
+    sed -i 's/Port.*= '"${DEFAULT_SITE_PORT}"'/Port = '"${site_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/www/webconfig.ini
+    echo "[config]: Updating httpd.conf with configuration choices"
+    sed -i 's/Listen '"${DEFAULT_HTTPD_PORT}"'/Listen '"${httpd_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/apache2/conf/httpd.conf
+    sed -i 's/worker.worker1.port='"${DEFAULT_TOMCAT_PORT}"'/worker.worker1.port='"${tomcat_port}"'/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/apache2/conf/workers.properties
+    sed -i 's/Connector port=\"'"${DEFAULT_TOMCAT_PORT}"'\"/Connector port=\"'"${tomcat_port}"'\"/g' /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/tomcat/conf/server.xml
+    echo "[config]: Updating tomcat configs with configuration choices"
+
 	echo "Creating lock file directory for MapGuide Server"
 	# Create lock file directory for Server
 	if [ ! -d /var/lock/mgserver ]; then
@@ -330,6 +478,10 @@
 	pushd /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/apache2/bin
 	./apachectl start
 	popd
+    echo "Starting tomcat"
+	pushd /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/webserverextensions/tomcat/bin
+    sh ./startup.sh
+	popd
 	echo "Starting mgserver"
 	pushd /usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV}/server/bin
 	./mgserverd.sh
@@ -341,4 +493,4 @@
 mkdir -p ${TEMPDIR}
 pushd ${TEMPDIR}
 main
-popd
\ No newline at end of file
+popd

Modified: branches/2.6/vagrant/scripts/mguninstallubuntu.sh
===================================================================
--- branches/2.6/vagrant/scripts/mguninstallubuntu.sh	2014-05-15 17:07:34 UTC (rev 8133)
+++ branches/2.6/vagrant/scripts/mguninstallubuntu.sh	2014-05-16 16:11:21 UTC (rev 8134)
@@ -7,7 +7,7 @@
 fi
 
 # Remove Ubuntu packages for MapGuide
-for file in server webextensions httpd coordsys common platformbase
+for file in server webextensions httpd coordsys coordsys-lite common platformbase
 do
   dpkg --remove mapguideopensource-${file}
 done



More information about the mapguide-commits mailing list