diff --git a/Dockerfile b/Dockerfile index 8c55485..c92e577 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,75 +1,43 @@ -FROM ubuntu:14.04 +FROM ubuntu:16.04 -# This is where mginstallubuntu.sh downloads packages into -ENV TEMPDIR /tmp/install_mapguide -ENV URL_HOST "https://download.osgeo.org" -ENV URL_RELPATH "/mapguide/releases" -ENV FDOVER_MAJOR=4 -ENV FDOVER_MINOR=1 -ENV FDOVER_MAJOR_MINOR=${FDOVER_MAJOR}.${FDOVER_MINOR} -ENV FDOVER_POINT=0 -ENV FDOVER_MAJOR_MINOR_REV=${FDOVER_MAJOR_MINOR}.${FDOVER_POINT} -ENV FDOBUILD=7814 -ENV FDOARCH=amd64 -ENV FDOVER=${FDOVER_MAJOR_MINOR_REV}-${FDOBUILD}_${FDOARCH} -ENV MGVER_MAJOR=3 -ENV MGVER_MINOR=1 -ENV MGVER_MAJOR_MINOR=${MGVER_MAJOR}.${MGVER_MINOR} -ENV MGVER_POINT=2 -ENV MGVER_MAJOR_MINOR_REV=${MGVER_MAJOR_MINOR}.${MGVER_POINT} -ENV MGRELEASELABEL=Final -ENV MGBUILD=9484 -ENV MGARCH=amd64 -ENV MGVER=${MGVER_MAJOR_MINOR_REV}-${MGBUILD}_${MGARCH} +ENV TEMPDIR=/tmp/install_mapguide +ENV FDOVER_MAJOR_MINOR_REV=4.2.0 +ENV MGVER_MAJOR_MINOR_REV=4.0.0 ENV MG_PATH=/usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV} ENV MGLOG_PATH=${MG_PATH}/server/Logs ENV MGAPACHE_LOG=${MG_PATH}/webserverextensions/apache2/logs ENV MGTOMCAT_LOG=${MG_PATH}/webserverextensions/tomcat/logs +ENV ADMIN_USER=Administrator +ENV ADMIN_PASSWORD=admin +ENV URL_MAPGUIDE_RUN=http://download.osgeo.org/mapguide/releases/4.0.0/Preview2/mapguideopensource-4.0.0.9740-ubuntu16-install.run -ENV URL_ROOT "${URL_HOST}/${URL_RELPATH}/${MGVER_MAJOR_MINOR_REV}/${MGRELEASELABEL}" -ENV URL_PART ubuntu14_x64 -ENV URL "$URL_ROOT/$URL_PART" - -ENV DEFAULT_SERVER_IP "0.0.0.0" -ENV DEFAULT_ADMIN_PORT 2810 -ENV DEFAULT_CLIENT_PORT 2811 -ENV DEFAULT_SITE_PORT 2812 -ENV DEFAULT_HTTPD_PORT 8008 -# ENV DEFAULT_TOMCAT_PORT 8009 - -RUN mkdir -p ${TEMPDIR} WORKDIR ${TEMPDIR} -# RUN INSTALLER SCRIPT IN HEADLESS MODE -RUN apt-get update \ - && apt-get -y install wget \ - && wget ${URL}/mginstallubuntu.sh \ - && chmod +x mginstallubuntu.sh \ - && ./mginstallubuntu.sh --headless --no-service-install --no-mgserver-start \ - --no-tomcat-start --no-httpd-start --with-sdf --with-shp --with-sqlite --with-gdal \ - --with-ogr --with-wfs --admin-port ${DEFAULT_ADMIN_PORT} --client-port ${DEFAULT_CLIENT_PORT} \ - --site-port ${DEFAULT_SITE_PORT} --httpd-port ${DEFAULT_HTTPD_PORT} --server-ip ${DEFAULT_SERVER_IP} \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/lib/apt/archives/* +COPY utilities/ . +RUN apt-get update && apt-get -y install wget \ + && wget ${URL_MAPGUIDE_RUN} +RUN chmod +x mapguideopensource-4.0.0.9740-ubuntu16-install.run && apt-get update \ + && ./mapguideopensource-4.0.0.9740-ubuntu16-install.run --noexec --nox11 --target . && apt-get update \ + && ./install-with-rdbms.sh --headless --with-rdbms --no-service-install --no-mgserver-start \ + --no-tomcat-start --no-httpd-start --with-sdf --with-shp --with-sqlite --with-gdal \ + --with-ogr --with-wfs \ + && apt-get install unzip -y \ + && mkdir /usr/share/fonts/truetype/msttcorefonts && unzip msttcorefonts.zip -d /usr/share/fonts/truetype/msttcorefonts \ + && apt-get remove unzip -y \ + && apt-get install openjdk-8-jdk -y WORKDIR ${MG_PATH} -# UPDATING CONFIGURATION FILES +# SETTING UP PERMISSION RUN chmod 777 webserverextensions/www/TempDir -RUN sed -i 's/AJP\/1\.3/HTTP\/1\.1/g' webserverextensions/tomcat/conf/server.xml +RUN chmod a+rw ${MG_PATH}/webserverextensions/www/fusion/lib/tcpdf/cache/ +#REMOVE TEMP FILES RUN rm -rf ${TEMPDIR} -# Log Files -RUN ln -sf /dev/stdout ${MGLOG_PATH}/{Access,Admin,Authentication}.log; \ - ln -sf /dev/stderr ${MGLOG_PATH}/Error.log; \ - ln -sf /dev/stdout ${MGAPACHE_LOG}/{access_,mod_jk.}log; \ - ln -sf /dev/stderr ${MGAPACHE_LOG}/error_log - -COPY ./entrypoint.sh / -RUN chmod a+x /entrypoint.sh; \ - chmod a+rw ${MG_PATH}/webserverextensions/www/fusion/lib/tcpdf/cache/ +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh -EXPOSE 2810 2811 2812 8008 8009 +EXPOSE 8008 2810 2811 2812 8080 8000 -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index dcdcf12..9fc38de 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,38 @@ -Mapguide Open Source -=== -#### Versions +# Mapguide Open Source -brucepc/mapguide:latest +## Versions + +brucepc/mapguide:latest [![](https://images.microbadger.com/badges/image/brucepc/mapguide.svg)](https://microbadger.com/images/brucepc/mapguide "Get your own image badge on microbadger.com") -brucepc/mapguide:2.6 +brucepc/mapguide:2.6 [![](https://images.microbadger.com/badges/image/brucepc/mapguide:2.6.svg)](https://microbadger.com/images/brucepc/mapguide:2.6 "Get your own image badge on microbadger.com") -How to use -=== +## How to use + ```bash docker pull brucepc/mapguide:[version] docker run -ti -d brucepc/mapguide:[version] ``` -Entrypoint params -=== -+ --no-tomcat ``doesn't start tomcat server`` -+ --no-apache ``doesn't start the apache server`` + +## Entrypoint params + ++ --no-tomcat ``doesn't start tomcat server`` ++ --no-apache ``doesn't start the apache server`` + --only-mapguide ``start only mapguide server`` + --crash-time ``time to start mapguide after crash`` ++ --reset-password ``reset admin password`` ++ --no-setup-log-link ``doesn't setup link for log files`` ```bash docker run -ti brucepc/mapguide --no-tomcat ``` -Exposed ports -=== + +## Exposed ports + + 8008 Apache server + 8009 Tomcat server -Need help ??? -=== +## Need help ??? [![Join the chat at https://gitter.im/mapguide-container](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gitterHQ/gitter) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..90bf479 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '3' +services: + mapguide: + build: . + image: mg:4.0.0.9740 + container_name: mapguide + volumes: + - "mapguide4:/usr/local/mapguideopensource-4.0.0/server/Repositories/Library" + ports: + - "8008:8008" + - "8009:8009" + +volumes: + mapguide4: \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 4db77cf..bbe4e5c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,14 +4,16 @@ set -e export PATH=${MG_PATH}/server/bin:$PATH export MENTOR_DICTIONARY_PATH=${MG_PATH}/share/gis/coordsys -export LD_LIBRARY_PATH=/usr/local/fdo-${FDOVER}/lib:"$LD_LIBRARY_PATH" -export NLSPATH=/usr/local/fdo-${FDOVER}/nls/%N:"$NLSPATH" +export LD_LIBRARY_PATH=/usr/local/fdo-${FDOVER_MAJOR_MINOR_REV}/lib64:${MG_PATH}/webserverextensions/lib64:${MG_PATH}/lib64:${MG_PATH}/server/lib64:$LD_LIBRARY_PATH +export NLSPATH=/usr/local/fdo-${FDOVER_MAJOR_MINOR_REV}/nls/%N:"$NLSPATH" mkdir -p /var/lock/mgserver ln -sf ${MG_PATH}/server/bin/mapguidectl /usr/local/bin/mapguidectl SLEEPTIME=1 NO_APACHE=0 NO_TOMCAT=0 +RESET_PASSWORD=0 +NO_SETUP_LOG_LINK=0 MG_PIDFILE=/var/run/mapguide.pid start_apache(){ @@ -32,6 +34,22 @@ start_mg(){ $MG_PATH/server/bin/mapguidectl status | perl -pe 's/\D//g' | tee $MG_PIDFILE } +setup_admin_password() { + cd ${MG_PATH}/server/bin + ./mgserver setpwd ${ADMIN_USER} ${ADMIN_PASSWORD} +} + +#SETUP LINK FOR LOG +setup_log_link() { + for log_file in Access Admin Authentication; do + ln -sf /dev/stdout "${MGLOG_PATH}/${log_file}.log" + done + ln -sf /dev/stderr ${MGLOG_PATH}/Error.log + ln -sf /dev/stdout ${MGAPACHE_LOG}/access_log & + ln -sf /dev/stdout ${MGAPACHE_LOG}/mod_jk.log + ln -sf /dev/stderr ${MGAPACHE_LOG}/error_log +} + stop_all(){ if [ $NO_APACHE -eq 0 ]; then echo "Stopping Apache server..." @@ -50,12 +68,15 @@ stop_all(){ ./mapguidectl stop } -print_help(){ +print_help() { echo "Help: " - echo "" + echo "" + echo "--stop-all\t\tstop all the service" echo "--only-mapguide\t\tstart only mapguide server" echo "--no-apache\t\tdon't start apache server" echo "--no-tomcat\t\tdon't start tomcat server" + echo "--reset-password\t\treset admin password" + echo "--no-setup-log-link\t\tdon't setup link for log files" echo "--crash-time\t1\tSeconds to sleep before restart, after crash" echo "--help show this help" } @@ -79,6 +100,14 @@ while test $# -gt 0; do shift NO_TOMCAT=1 ;; + --reset-password) + shift + RESET_PASSWORD=1 + ;; + --no-setup-log-link) + shift + NO_SETUP_LOG_LINK=1 + ;; --crash-time) shift if ! [ $1 =~'^[0-9]+$' ];then @@ -100,6 +129,14 @@ trap stop_all SIGINT SIGTERM start_mg +if [ $RESET_PASSWORD -eq 1 ]; then + setup_admin_password +fi + +if [ $NO_SETUP_LOG_LINK -eq 0 ]; then + setup_log_link +fi + if [ $NO_APACHE -eq 0 ]; then start_apache fi @@ -112,7 +149,7 @@ while true; do sleep $SLEEPTIME pid=$(cat ${MG_PIDFILE}) if [ ! -e /proc/$pid -a /proc/$pid/exe ]; then - echo "Mapguide foi parado inesperadamente e sera reiniciando..." + echo "Mapguide was stopped unexpectedly and will be restarting..." start_mg fi done diff --git a/utilities/install-with-rdbms.sh b/utilities/install-with-rdbms.sh new file mode 100755 index 0000000..6383f81 --- /dev/null +++ b/utilities/install-with-rdbms.sh @@ -0,0 +1,766 @@ +#!/bin/sh + +#echo "WhereAmI?: $PWD" +#ls $PWD + + +# Set safe shell defaults +set -euf + +FDOVER_MAJOR=4 +FDOVER_MINOR=2 +FDOVER_MAJOR_MINOR=${FDOVER_MAJOR}.${FDOVER_MINOR} +FDOVER_POINT=0 +FDOVER_MAJOR_MINOR_REV=${FDOVER_MAJOR_MINOR}.${FDOVER_POINT} +MGVER_MAJOR=4 +MGVER_MINOR=0 +MGVER_MAJOR_MINOR=${MGVER_MAJOR}.${MGVER_MINOR} +MGVER_POINT=0 +MGVER_MAJOR_MINOR_REV=${MGVER_MAJOR_MINOR}.${MGVER_POINT} + +MG_INST=/usr/local/mapguideopensource-${MGVER_MAJOR_MINOR_REV} +FDO_INST=/usr/local/fdo-${FDOVER_MAJOR_MINOR_REV} + +HEADLESS=0 +NO_SERVICE_INSTALL=0 +NO_MGSERVER_START=0 +NO_TOMCAT_START=0 +NO_HTTPD_START=0 +INSTALLER_TITLE="MapGuide Open Source installer" + +DEFAULT_ENABLE_TOMCAT=N + +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 + +HAVE_TOMCAT=0 +TOMCAT_AJP_SECRET=mapguide4java +TOMCAT_AJP_LISTEN_HOST="127.0.0.1" + +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 + +fdo_provider_choice="" + +# Must have root +if ! [ "$(id -u)" = "0" ]; then + echo "You must run this script with superuser privileges" + exit 1 +fi + +while [ $# -gt 0 ]; do # Until you run out of parameters... + case "$1" in + -headless|--headless) + 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-rdbms|--with-rdbms) + fdo_provider_choice="$fdo_provider_choice rdbms" + #shift + ;; + -with-sdf|--with-sdf) + fdo_provider_choice="$fdo_provider_choice sdf" + #shift + ;; + -with-shp|--with-shp) + fdo_provider_choice="$fdo_provider_choice shp" + #shift + ;; + -with-sqlite|--with-sqlite) + fdo_provider_choice="$fdo_provider_choice sqlite" + #shift + ;; + -with-gdal|--with-gdal) + fdo_provider_choice="$fdo_provider_choice gdal" + #shift + ;; + -with-ogr|--with-ogr) + fdo_provider_choice="$fdo_provider_choice ogr" + #shift + ;; + -with-kingoracle|--with-kingoracle) + fdo_provider_choice="$fdo_provider_choice kingoracle" + #shift + ;; + -with-wfs|--with-wfs) + fdo_provider_choice="$fdo_provider_choice wfs" + #shift + ;; + -with-wms|--with-wms) + fdo_provider_choice="$fdo_provider_choice wms" + #shift + ;; + -server-ip|--server-ip) + server_ip="$2" + webtier_server_ip="$2" + shift + ;; + -admin-port|--admin-port) + admin_port=$2 + shift + ;; + -client-port|--client-port) + client_port=$2 + shift + ;; + -site-port|--site-port) + site_port=$2 + shift + ;; + -httpd-port|--httpd-port) + httpd_port=$2 + shift + ;; + -tomcat-port|--tomcat-port) + tomcat_port=$2 + shift + ;; + -with-tomcat|--with-tomcat) + HAVE_TOMCAT=1 + ;; + -help|--help) + echo "Usage: $0 (options)" + echo "Options:" + echo " --headless [Install headlessly (skip UI)]" + echo " --with-rdbms [Include PostgreSQL Provider]" + echo " --with-sdf [Include SDF Provider]" + echo " --with-shp [Include SHP Provider]" + echo " --with-sqlite [Include SQLite Provider]" + echo " --with-gdal [Include GDAL Provider]" + echo " --with-ogr [Include OGR Provider]" + echo " --with-kingoracle [Include King Oracle Provider]" + echo " --with-wfs [Include WFS Provider]" + echo " --with-wms [Include WMS Provider]" + echo " --with-tomcat [Enable Tomcat]" + echo " --server-ip [Server IP, default: 127.0.0.1]" + echo " --admin-port [Admin Server Port, default: 2810]" + echo " --client-port [Client Server Port, default: 2811]" + echo " --site-port [Site Server Port, default: 2812]" + echo " --httpd-port [HTTPD port, default: 8008]" + echo " --tomcat-port [Tomcat Port, default: 8009]" + exit + ;; + esac + shift # Check next set of parameters. +done + +echo "[install]: Installing pre-requisite packages" +if [ "$HEADLESS" != "1" ] +then + apt-get install -y dialog +fi + +DIALOG=${DIALOG=dialog} + +main() +{ + if [ "$HEADLESS" != "1" ] + then + dialog_welcome + dialog_fdo_provider + dialog_server + dialog_webtier + #dialog_coordsys + fi + dump_configuration + install_prerequisites + install_fdo + install_mapguide_packages + post_install +} + +set_server_vars() +{ + 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() +{ + vars=$(cat $1) + set $vars + webtier_server_ip=${1:-$DEFAULT_SERVER_IP} + httpd_port=${2:-$DEFAULT_HTTPD_PORT} + enable_tomcat=${3:-$DEFAULT_ENABLE_TOMCAT} + tomcat_port=${4:-$DEFAULT_TOMCAT_PORT} + case $enable_tomcat in + y*|Y*) + HAVE_TOMCAT=1 + ;; + *) + HAVE_TOMCAT=0 + ;; + esac +} + +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 " Enable Tomcat: ${HAVE_TOMCAT}" + echo "********************************************" +} + +dialog_welcome() +{ + $DIALOG --backtitle "$INSTALLER_TITLE" \ + --title "Welcome" --clear \ + --yesno "Welcome to the MapGuide Open Source installer. Would you like to proceed?" 10 30 + + case $? in + 1) + echo "Cancelled" + exit 1;; + 255) + echo "Cancelled" + exit 255;; + esac +} + +dialog_fdo_provider() +{ + 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 + $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 \ + shp "OSGeo FDO Provider for SHP" ON \ + sqlite "OSGeo FDO Provider for SQLite" ON \ + 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 \ + wfs "OSGeo FDO Provider for WFS" ON \ + wms "OSGeo FDO Provider for WMS" ON 2> $tempfile + + fdo_provider_choice=$(cat $tempfile | sed s/\"//g) + case $? in + 1) + echo "Cancelled" + exit 1;; + 255) + echo "Cancelled" + exit 255;; + esac +} + +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> $tempfile + case $? in + 1) + echo "Cancelled" + exit 1;; + 255) + echo "Cancelled" + exit 255;; + esac + set_server_vars $tempfile + rm $tempfile +} + +dialog_tomcat() +{ + tempfile=$(mktemp 2>/dev/null) || tempfile=/tmp/form.$$ + dialog --title "Enable Tomcat" \ + --yesno "Do you want to enable Tomcat to run Java MapGuide applications?" 10 40 2> $tempfile + case $? in + 0) + HAVE_TOMCAT=1 + #echo "Enable tomcat" + ;; + 1) + HAVE_TOMCAT=0 + #echo "Disable tomcat" + ;; + esac +} + +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.\n\nTomcat only needs to be enabled if you are intending to run Java MapGuide applications" 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 \ + "Enable Tomcat (Y/N)?:" 3 1 "${DEFAULT_ENABLE_TOMCAT}" 3 25 1 30 \ + "Tomcat Port:" 4 1 "${DEFAULT_TOMCAT_PORT}" 4 25 25 30 2> $tempfile + case $? in + 1) + echo "Cancelled" + exit 1;; + 255) + echo "Cancelled" + exit 255;; + esac + set_webtier_vars $tempfile +} + +dialog_coordsys() +{ + 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) + case $? in + 1) + echo "Cancelled" + exit 1;; + 255) + echo "Cancelled" + exit 255;; + esac +} + +install_prerequisites() +{ + # Only need to check for JRE. All other deps are already embedded in their respective deb package files + if [ ${HAVE_TOMCAT} = "1" ]; then + apt-get install -y default-jre + fi + # FIXME: Why did dpkg-shlibdeps not pick up libxslt1.1 as a required dependency of mapguideopensource-httpd??? + apt-get install -y libxslt1.1 +} + +install_fdo() +{ + # set initial registration state + arcsde_registered=0 + gdal_registered=0 + kingoracle_registered=0 + rdbms_registered=0 + ogr_registered=0 + sdf_registered=0 + shp_registered=0 + sqlite_registered=0 + wfs_registered=0 + wms_registered=0 + + # Include core package regardless of choice. + fdo_provider_choice="core $fdo_provider_choice" + for file in $fdo_provider_choice + do + # HACK-ish: The installer script doesn't know about the build number that is baked into these + # deb packages so we can't locate the exact package to apt-get install, but we can find it using + # an identifier that should already be unique enough + find . -type f | grep "fdo-${file}" | xargs apt-get install -y + done + + # Nuke the old providers.xml, we're rebuiding it + providersxml=${FDO_INST}/lib64/providers.xml + echo "" > ${providersxml} + echo "" >> ${providersxml} + for file in $fdo_provider_choice + do + case $file in + arcsde) + if [ $arcsde_registered -eq 1 ]; + then + continue + fi + echo "Registering ArcSDE Provider" + echo " " >> ${providersxml} + echo " OSGeo.ArcSDE.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for ArcSDE" >> ${providersxml} + echo " Read/write access to an ESRI ArcSDE-based data store, using Oracle and SQL Server" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libArcSDEProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + arcsde_registered=1 + ;; + gdal) + if [ $gdal_registered -eq 1 ]; + then + continue + fi + echo "Registering GDAL Provider" + echo " " >> ${providersxml} + echo " OSGeo.Gdal.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for GDAL" >> ${providersxml} + echo " FDO Provider for GDAL" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libGRFPProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + gdal_registered=1 + ;; + kingoracle) + if [ $kingoracle_registered -eq 1 ]; + then + continue + fi + echo "Registering King Oracle Provider" + echo " " >> ${providersxml} + echo " King.Oracle.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for Oracle" >> ${providersxml} + echo " Read/write access to spatial and attribute data in Oracle Spatial" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libKingOracleProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + kingoracle_registered=1 + # libaio is a dependency of OCI and not the provider itself + apt-get install -y libaio1 + ;; + rdbms) + if [ $rdbms_registered -eq 1 ]; + then + continue + fi + echo "Registering ODBC Provider" + echo " " >> ${providersxml} + echo " OSGeo.ODBC.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for ODBC" >> ${providersxml} + echo " FDO Provider for ODBC" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libODBCProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + echo "Registering PostgreSQL Provider" + echo " " >> ${providersxml} + echo " OSGeo.PostgreSQL.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for PostgreSQL" >> ${providersxml} + echo " Read/write access to PostgreSQL/PostGIS-based data store. Supports spatial data types and spatial query operations" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libPostgreSQLProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + echo "Registering MySQL Provider" + echo " " >> ${providersxml} + echo " OSGeo.MySQL.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for MySQL" >> ${providersxml} + echo " FDO Provider for MySQL" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libMySQLProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + rdbms_registered=1 + ;; + ogr) + if [ $ogr_registered -eq 1 ]; + then + continue + fi + echo "Registering OGR Provider" + echo " " >> ${providersxml} + echo " OSGeo.OGR.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for OGR" >> ${providersxml} + echo " FDO Access to OGR Data Sources" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libOGRProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + ogr_registered=1 + ;; + sdf) + if [ $sdf_registered -eq 1 ]; + then + continue + fi + echo "Registering SDF Provider" + echo " " >> ${providersxml} + echo " OSGeo.SDF.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for SDF" >> ${providersxml} + echo " Read/write access to Autodesk's spatial database format, a file-based geodatabase that supports multiple features/attributes, spatial indexing and file-locking" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libSDFProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + sdf_registered=1 + ;; + shp) + if [ $shp_registered -eq 1 ]; + then + continue + fi + echo "Registering SHP Provider" + echo " " >> ${providersxml} + echo " OSGeo.SHP.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for SHP" >> ${providersxml} + echo " Read/write access to spatial and attribute data in an ESRI SHP file" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libSHPProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + shp_registered=1 + ;; + sqlite) + if [ $sqlite_registered -eq 1 ]; + then + continue + fi + echo "Registering SQLite Provider" + echo " " >> ${providersxml} + echo " OSGeo.SQLite.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for SQLite" >> ${providersxml} + echo " Read/write access to feature data in a SQLite file" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libSQLiteProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + sqlite_registered=1 + ;; + wfs) + if [ $wfs_registered -eq 1 ]; + then + continue + fi + echo "Registering WFS Provider" + echo " " >> ${providersxml} + echo " OSGeo.WFS.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for WFS" >> ${providersxml} + echo " Read access to OGC WFS-based data store" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libWFSProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + wfs_registered=1 + ;; + wms) + if [ $wms_registered -eq 1 ]; + then + continue + fi + echo "Registering WMS Provider" + echo " " >> ${providersxml} + echo " OSGeo.WMS.${FDOVER_MAJOR_MINOR}" >> ${providersxml} + echo " OSGeo FDO Provider for WMS" >> ${providersxml} + echo " Read access to OGC WMS-based data store" >> ${providersxml} + echo " False" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " ${FDOVER_MAJOR_MINOR_REV}.0" >> ${providersxml} + echo " libWMSProvider.so" >> ${providersxml} + echo " " >> ${providersxml} + wms_registered=1 + ;; + esac + done + echo "" >> ${providersxml} +} + +install_mapguide_packages() +{ + mapguide_packages="coordsys common server webextensions httpd" + for file in $mapguide_packages + do + # HACK-ish: The installer script doesn't know about the build number that is baked into these + # deb packages so we can't locate the exact package to apt-get install, but we can find it using + # an identifier that should already be unique enough + find . -type f | grep "mapguideopensource-${file}" | xargs apt-get install -y + done +} + +post_install() +{ + echo "[config]: Updating serverconfig.ini with configuration choices" + sed -i 's/MachineIp.*= '"${DEFAULT_SERVER_IP}"'/MachineIp = '"${server_ip}"'/g' ${MG_INST}/server/bin/serverconfig.ini + sed -i 's/IpAddress.*= '"${DEFAULT_SERVER_IP}"'/IpAddress = '"${server_ip}"'/g' ${MG_INST}/server/bin/serverconfig.ini + sed -i 's/Port.*= '"${DEFAULT_ADMIN_PORT}"'/Port = '"${admin_port}"'/g' ${MG_INST}/server/bin/serverconfig.ini + sed -i 's/Port.*= '"${DEFAULT_CLIENT_PORT}"'/Port = '"${client_port}"'/g' ${MG_INST}/server/bin/serverconfig.ini + sed -i 's/Port.*= '"${DEFAULT_SITE_PORT}"'/Port = '"${site_port}"'/g' ${MG_INST}/server/bin/serverconfig.ini + echo "[config]: Updating webconfig.ini with configuration choices" + sed -i 's/IpAddress.*= '"${DEFAULT_SERVER_IP}"'/IpAddress = '"${webtier_server_ip}"'/g' ${MG_INST}/webserverextensions/www/webconfig.ini + sed -i 's/Port.*= '"${DEFAULT_ADMIN_PORT}"'/Port = '"${admin_port}"'/g' ${MG_INST}/webserverextensions/www/webconfig.ini + sed -i 's/Port.*= '"${DEFAULT_CLIENT_PORT}"'/Port = '"${client_port}"'/g' ${MG_INST}/webserverextensions/www/webconfig.ini + sed -i 's/Port.*= '"${DEFAULT_SITE_PORT}"'/Port = '"${site_port}"'/g' ${MG_INST}/webserverextensions/www/webconfig.ini + echo "[config]: Updating httpd.conf with configuration choices" + sed -i 's/Listen '"${DEFAULT_HTTPD_PORT}"'/Listen '"${httpd_port}"'/g' ${MG_INST}/webserverextensions/apache2/conf/httpd.conf + + if [ ${HAVE_TOMCAT} = "1" ]; then + echo "[config]: Writing workers.properties for mod_jk" + cat << EOF > ${MG_INST}/webserverextensions/apache2/conf/workers.properties +# Define 1 real worker using ajp13 +worker.list=worker1 +# Set properties for worker1 (ajp13) +worker.worker1.type=ajp13 +worker.worker1.host=${TOMCAT_AJP_LISTEN_HOST} +worker.worker1.port=${tomcat_port} +worker.worker1.lbfactor=50 +worker.worker1.cachesize=10 +worker.worker1.cache_timeout=600 +worker.worker1.socket_keepalive=1 +worker.worker1.recycle_timeout=300 +worker.worker1.secret=${TOMCAT_AJP_SECRET} +EOF + echo "[config]: Updating tomcat configs with configuration choices" + sed -i "s|||g" ${MG_INST}/webserverextensions/tomcat/conf/server.xml + else + echo "[config]: Skipping tomcat configuration" + fi + + echo "[config]: Ensuring key directories exist" + mkdir -p ${MG_INST}/webserverextensions/apache2/logs + mkdir -p ${MG_INST}/webserverextensions/Temp + mkdir -p ${MG_INST}/webserverextensions/www/fusion/lib/tcpdf/cache + + echo "[config]: Fixing permissions for certain folders" + chmod 770 ${MG_INST}/webserverextensions/Temp + # daemon is the default user/group the bundled httpd will use + chown daemon:daemon ${MG_INST}/webserverextensions/Temp + chown daemon:daemon ${MG_INST}/webserverextensions/www/fusion/lib/tcpdf/cache + + 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 ${MG_INST}/server/bin/mapguidectl /etc/init.d/mapguide + ln -s ${MG_INST}/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 + + 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 [ "$HAVE_TOMCAT" = "0" ]; + then + echo "[install]: Skipping tomcat auto-start" + else + echo "[install]: Tomcat service script" + cat << EOF > /etc/init.d/tomcat-mapguide +#!/bin/bash +# +# tomcat +# +# chkconfig: 35 +# description: Start up the Tomcat servlet engine. +# processname: tomcat + +RETVAL=\$? +CATALINA_HOME="${MG_INST}/webserverextensions/tomcat" + +case "\$1" in + start) + if [ -f \$CATALINA_HOME/bin/startup.sh ]; + then + echo \$"Starting Tomcat" + \$CATALINA_HOME/bin/startup.sh + fi +;; + stop) + if [ -f \$CATALINA_HOME/bin/shutdown.sh ]; + then + echo \$"Stopping Tomcat" + \$CATALINA_HOME/bin/shutdown.sh + fi +;; + *) + echo \$"Usage: \$0 {start|stop}" +exit 1 +;; +esac + +exit \$RETVAL +EOF + chmod +x /etc/init.d/tomcat-mapguide + if [ "$HEADLESS" = "1" ] && [ "$NO_TOMCAT_START" = "1" ]; + then + echo "[install]: Skipping tomcat auto-start as --headless and --no-tomcat-start specified" + else + # FIXME: Tomcat doesn't want to start from within this + # script (ps -A does not show a running java process) but starts + # fine without problems afterwards??? + echo "You can start tomcat by running: " + echo "/etc/init.d/tomcat-mapguide start" + fi + fi + echo "DONE!" +} + +main diff --git a/utilities/msttcorefonts.zip b/utilities/msttcorefonts.zip new file mode 100644 index 0000000..44d620b Binary files /dev/null and b/utilities/msttcorefonts.zip differ