From ec8fb042341a9eb885d74b12caff5b7f0974d87b Mon Sep 17 00:00:00 2001 From: Lee Savoie Date: Wed, 17 Jun 2020 09:40:49 -0700 Subject: [PATCH] Move non-essentials (documentation, etc) into separate RPM (#1754) --- earth_enterprise/rpms/build.gradle | 542 ++++++++++++++---- .../opengee-extra/snippets/post-install.sh | 39 ++ .../opengee-extra/snippets/pre-uninstall.sh | 47 ++ .../src/post-install.sh.template | 7 + .../src/pre-uninstall.sh.template | 0 .../snippets/post-install.sh | 13 +- .../snippets/post-uninstall.sh | 0 .../snippets/pre-install.sh | 0 .../snippets/pre-uninstall.sh | 0 .../etc/opt/google/fusion_version.template | 0 .../src/install/etc/opt/google/systemrc | 0 .../src/post-install.sh.template | 1 + .../src/post-uninstall.sh.template | 0 .../src/pre-install.sh.template | 0 .../src/pre-uninstall.sh.template | 0 .../snippets/post-install.sh | 25 +- .../snippets/post-uninstall.sh | 0 .../snippets/pre-install.sh | 0 .../snippets/pre-uninstall.sh | 0 .../src/post-install.sh.template | 1 + .../src/post-uninstall.sh.template | 0 .../src/pre-install.sh.template | 0 .../src/pre-uninstall.sh.template | 2 + .../rpms/shared/snippets/fusiontutorial.sh | 36 ++ .../shared/snippets/install-utils-main.sh | 20 + .../rpms/shared/snippets/searchexample.sh | 28 + .../shared/src/fusiontutorial.sh.template | 1 + .../rpms/shared/src/searchexample.sh.template | 1 + .../src/fusion/fusionui/MainWindow.cpp | 21 +- .../src/fusion/fusionui/MainWindow.h | 1 + .../src/fusion/fusionui/mainwindowbase.ui | 4 +- .../cutter/htdocs/admin/index.html | 2 +- .../cutter/htdocs/admin/js/admin_tools.js | 12 + earth_enterprise/src/server/SConscript | 2 +- earth_enterprise/src/server/examplesearch.sql | 33 ++ .../src/server/examplesearch_delete.sql | 19 + earth_enterprise/src/server/geresetpgdb | 8 +- .../src/server/gesearch_tables.sql | 3 +- .../src/third_party/mod_wsgi/SConscript | 4 + .../mod_wsgi/conf.d/mod_wsgi-ge-extra.conf.in | 25 + .../mod_wsgi/conf.d/mod_wsgi-ge.conf.in | 10 +- 41 files changed, 764 insertions(+), 143 deletions(-) create mode 100644 earth_enterprise/rpms/opengee-extra/snippets/post-install.sh create mode 100644 earth_enterprise/rpms/opengee-extra/snippets/pre-uninstall.sh create mode 100644 earth_enterprise/rpms/opengee-extra/src/post-install.sh.template rename earth_enterprise/rpms/{opengee-server => opengee-extra}/src/pre-uninstall.sh.template (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/snippets/post-install.sh (93%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/snippets/post-uninstall.sh (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/snippets/pre-install.sh (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/snippets/pre-uninstall.sh (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/src/install/etc/opt/google/fusion_version.template (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/src/install/etc/opt/google/systemrc (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/src/post-install.sh.template (67%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/src/post-uninstall.sh.template (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/src/pre-install.sh.template (100%) rename earth_enterprise/rpms/{opengee-fusion => opengee-fusion-core}/src/pre-uninstall.sh.template (100%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/snippets/post-install.sh (93%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/snippets/post-uninstall.sh (100%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/snippets/pre-install.sh (100%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/snippets/pre-uninstall.sh (100%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/src/post-install.sh.template (82%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/src/post-uninstall.sh.template (100%) rename earth_enterprise/rpms/{opengee-server => opengee-server-core}/src/pre-install.sh.template (100%) create mode 100644 earth_enterprise/rpms/opengee-server-core/src/pre-uninstall.sh.template create mode 100644 earth_enterprise/rpms/shared/snippets/fusiontutorial.sh create mode 100644 earth_enterprise/rpms/shared/snippets/searchexample.sh create mode 100644 earth_enterprise/rpms/shared/src/fusiontutorial.sh.template create mode 100644 earth_enterprise/rpms/shared/src/searchexample.sh.template create mode 100644 earth_enterprise/src/server/examplesearch.sql create mode 100644 earth_enterprise/src/server/examplesearch_delete.sql create mode 100644 earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge-extra.conf.in diff --git a/earth_enterprise/rpms/build.gradle b/earth_enterprise/rpms/build.gradle index 44deea8831..f737c2281a 100644 --- a/earth_enterprise/rpms/build.gradle +++ b/earth_enterprise/rpms/build.gradle @@ -1,4 +1,4 @@ -// Copyright 2017, 2018 the Open GEE Contributors +// Copyright 2017 - 2020 the Open GEE Contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -125,15 +125,12 @@ def getOsPackageBuildFromOpenGeeVersionFile(file) { def stagedInstallDir = new File(stagedInstall_path) -def stagedInstallDir_common = new File(stagedInstallDir, 'common') def stagedInstallDir_common_opt = new File(stagedInstallDir, 'common/opt') def stagedInstallDir_common_user_magic = new File(stagedInstallDir, 'common/user_magic') def stagedInstallDir_manual = new File(stagedInstallDir, 'manual') def stagedInstallDir_server_opt = new File(stagedInstallDir, 'server/opt') def stagedInstallDir_server_etc = new File(stagedInstallDir, 'server/etc') -def stagedInstallDir_server_apachesupport = - new File(stagedInstallDir, 'server/AppacheSupport/') def stagedInstallDir_server_searchexample = new File(stagedInstallDir, 'searchexample/opt/google/share/searchexample') def stagedInstallDir_server_geplaces = @@ -254,7 +251,7 @@ task openGeePostGisRpm(type: GeeRpm) { permissionGroup = 'root' packageGroup = 'Application/Productivity' summary = 'Post GIS extension for Postgre SQL server used by Open GEE' - packageDescription = 'Post GIS extension for Postgre SQL server used by Open GEE.' + packageDescription = 'Post GIS extension for Postgre SQL server used by Open GEE' license = 'GPLv2' url = 'https://github.com/google/earthenterprise/tree/master/earth_enterprise/third_party/postgis' type = BINARY @@ -294,6 +291,7 @@ task openGeePostGisDeb(type: GeeDeb) { type = BINARY requires('opengee-common', ospackage.version, GREATER | EQUAL) + requires('proj-devel') from (stagedInstallDir_postgis_opt) { into new File(packageInstallRootDir, 'opt') @@ -344,7 +342,7 @@ task openGeeCommonRpm(type: GeeRpm, dependsOn: openGeeCommonInitScripts) { user = 'root' permissionGroup = 'root' packageGroup = 'Application/Productivity' - summary = 'Third-party libraries bundled with Open GEE' + summary = 'Shared Open GEE code and third-party libraries bundled with Open GEE' packageDescription = '''Currently this package includes: @@ -371,6 +369,7 @@ task openGeeCommonRpm(type: GeeRpm, dependsOn: openGeeCommonInitScripts) { * Setup Tools: PSF 2 or ZPL * Skia: Skia 5.1.2 * Tornado: Apache 2.0 +* Various Open GEE Libraries ''' license = 'ASL 2.0 and ' + @@ -418,14 +417,21 @@ task openGeeCommonRpm(type: GeeRpm, dependsOn: openGeeCommonInitScripts) { from (stagedInstallDir_common_opt) { into new File(packageInstallRootDir, 'opt') + + // Included in opengee-extra + exclude '**/doc' + exclude '**/man' + exclude '**/Readme.txt' + exclude '**/gehttpd/examples' + exclude 'google/lib/openjpeg-2.3' // Contains makefiles - not needed for production + exclude '**/protobuf/internal/*test*.py' } from (stagedInstallDir_common_user_magic) { into packageInstallRootDir - } - from(stagedInstallDir_manual) { - into packageInstallRootDir + // Included in opengee-extra + exclude '**/ldap.conf.default' } from(file('opengee-common/src/install')) { @@ -475,14 +481,21 @@ task openGeeCommonDeb (type: GeeDeb, dependsOn: openGeeCommonInitScripts) { from (stagedInstallDir_common_opt) { into new File(packageInstallRootDir, 'opt') + + // Included in opengee-extra + exclude '**/doc' + exclude '**/man' + exclude '**/Readme.txt' + exclude '**/gehttpd/examples' + exclude 'google/lib/openjpeg-2.3' // Contains makefiles - not needed for production + exclude '**/protobuf/internal/*test*.py' } from (stagedInstallDir_common_user_magic) { into packageInstallRootDir - } - from(stagedInstallDir_manual) { - into packageInstallRootDir + // Included in opengee-extra + exclude '**/ldap.conf.default' } from(file('opengee-common/src/install')) { @@ -495,9 +508,9 @@ if (project.hasProperty('buildOpenGee')) { openGeeCommonDeb.dependsOn stageOpenGeeInstall } -task openGeeServerInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { - from(file('opengee-server/src')) - into "${buildDir}/opengee-server" +task openGeeServerCoreInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { + from(file('opengee-server-core/src')) + into "${buildDir}/opengee-server-core" CopySpecTemplates.expand(delegate, [ 'openGeeVersion': ospackage.version, @@ -506,10 +519,10 @@ task openGeeServerInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { ]) } -task openGeeServerRpm(type: GeeRpm, dependsOn: openGeeServerInitScripts) { +task openGeeServerCoreRpm(type: GeeRpm, dependsOn: openGeeServerCoreInitScripts) { mustRunAfter stageOpenGeeInstall - packageName = 'opengee-server' + packageName = 'opengee-server-core' version = ospackage.version release = ospackage.release user = 'root' @@ -523,6 +536,14 @@ task openGeeServerRpm(type: GeeRpm, dependsOn: openGeeServerInitScripts) { autoFindProvides = true autoFindRequires = true + // This replaces the opengee-server package from 5.3.4.1 and before + obsoletes('opengee-server', "5.3.4.1", LESS | EQUAL) + + // State that this provides opengee-server in case other software depends + // on it. The actual opengee-server RPM is a convenience RPM for a full + // install. + provides('opengee-server', ospackage.version) + requires('opengee-common', ospackage.version, GREATER | EQUAL) requiresPre('opengee-common', ospackage.version, GREATER | EQUAL) requires('opengee-postgis', '2.3.9', GREATER | EQUAL) @@ -547,10 +568,10 @@ task openGeeServerRpm(type: GeeRpm, dependsOn: openGeeServerInitScripts) { // Don't specify install scripts as single files. It doesn't work for // RPMs: - preInstall = file("${buildDir}/opengee-server/pre-install.sh") - postInstall = file("${buildDir}/opengee-server/post-install.sh") - preUninstall = file("${buildDir}/opengee-server/pre-uninstall.sh") - postUninstall = file("${buildDir}/opengee-server/post-uninstall.sh") + preInstall = file("${buildDir}/opengee-server-core/pre-install.sh") + postInstall = file("${buildDir}/opengee-server-core/post-install.sh") + preUninstall = file("${buildDir}/opengee-server-core/pre-uninstall.sh") + postUninstall = file("${buildDir}/opengee-server-core/post-uninstall.sh") directory('/opt/google/install', 0700) directory('/opt/google/gehttpd/logs', 0755) @@ -581,6 +602,18 @@ task openGeeServerRpm(type: GeeRpm, dependsOn: openGeeServerInitScripts) { // libpq is in the opengee-postgis package: exclude 'google/lib/libpq.*' + // Included in opengee-extra + exclude '**/manual' + exclude '**/search/plugin/example*' + exclude '**/search/plugin/custom*' + exclude '**/maps/example*' + exclude '**/original' + exclude '**/ExampleSearch.conf' + exclude '**/doc' + exclude '**/mod_wsgi-ge-extra.conf' + exclude '**/examplesearch*.sql' + exclude '**/readme.txt' + into new File(packageInstallRootDir, 'opt') } @@ -596,41 +629,36 @@ task openGeeServerRpm(type: GeeRpm, dependsOn: openGeeServerInitScripts) { into new File(packageInstallRootDir, 'opt/google/share/geplaces') } - from(stagedInstallDir_server_searchexample) { - into new File(packageInstallRootDir, 'opt/google/share/searchexample') - } - - from(stagedInstallDir_server_apachesupport) { - into packageInstallRootDir - } - // Create links link('/opt/google/etc', '/etc/opt/google') link('/opt/google/log', '/var/opt/google/log') link('/opt/google/run', '/var/opt/google/run') - link('/opt/google/gehttpd/htdocs/shared_assets/docs', '/opt/google/share/doc') } -task openGeeServerDeb (type: GeeDeb, dependsOn: openGeeServerInitScripts) { +task openGeeServerCoreDeb (type: GeeDeb, dependsOn: openGeeServerCoreInitScripts) { mustRunAfter stageOpenGeeInstall - packageName = openGeeServerRpm.packageName + packageName = openGeeServerCoreRpm.packageName version = ospackage.version release = ospackage.release - user = openGeeServerRpm.user - permissionGroup = openGeeServerRpm.permissionGroup + user = openGeeServerCoreRpm.user + permissionGroup = openGeeServerCoreRpm.permissionGroup packageGroup = 'misc' - summary = openGeeServerRpm.summary - packageDescription = openGeeServerRpm.packageDescription - license = openGeeServerRpm.license - url = openGeeServerRpm.url + summary = openGeeServerCoreRpm.summary + packageDescription = openGeeServerCoreRpm.packageDescription + license = openGeeServerCoreRpm.license + url = openGeeServerCoreRpm.url + + // This replaces the opengee-server package from 5.3.4.1 and before + obsoletes('opengee-server', "5.3.4.1", LESS | EQUAL) requires('opengee-common', ospackage.version, GREATER | EQUAL) requires('opengee-postgis', '2.3.9', GREATER | EQUAL) conflicts('opengee-postgis', '2.0', LESS ) conflicts('opengee-postgis', '2.4', GREATER | EQUAL) - - requires('python-pil') + requires('python-unittest2') + // The WMS Service requires PIL, which is not automatically detected: + requires('python-imaging') requires('python-lxml') requiresCommands( @@ -645,10 +673,10 @@ task openGeeServerDeb (type: GeeDeb, dependsOn: openGeeServerInitScripts) { // Specify a single file for each install script. Otherwise, OSPackage // wraps the code in extra statements that, e.g., only run the // post-install script on a new install, and not on upgrade: - preInstallFile file("${buildDir}/opengee-server/pre-install.sh") - postInstallFile file("${buildDir}/opengee-server/post-install.sh") - preUninstallFile file("${buildDir}/opengee-server/pre-uninstall.sh") - postUninstallFile file("${buildDir}/opengee-server/post-uninstall.sh") + preInstallFile file("${buildDir}/opengee-server-core/pre-install.sh") + postInstallFile file("${buildDir}/opengee-server-core/post-install.sh") + preUninstallFile file("${buildDir}/opengee-server-core/pre-uninstall.sh") + postUninstallFile file("${buildDir}/opengee-server-core/post-uninstall.sh") directory('/opt/google/install', 0700) directory('/opt/google/gehttpd/logs', 0755) @@ -658,20 +686,20 @@ task openGeeServerDeb (type: GeeDeb, dependsOn: openGeeServerInitScripts) { directory('/var/opt/google/pgsql/logs') filesMatching( - '/etc/init.d/geserver' - ) { + '/etc/init.d/geserver') + { it.mode = 0755 } // since these are "sourced" they cannot be exec... filesMatching( - '/etc/profile.d/ge-server.csh' - ) { + '/etc/profile.d/ge-server.csh') + { it.mode = 0644 } filesMatching( - '/etc/profile.d/ge-server.sh' - ) { + '/etc/profile.d/ge-server.sh') + { it.mode = 0644 } @@ -679,6 +707,18 @@ task openGeeServerDeb (type: GeeDeb, dependsOn: openGeeServerInitScripts) { // libpq is in the opengee-postgis package: exclude 'google/lib/libpq.*' + // Included in opengee-extra + exclude '**/manual' + exclude '**/search/plugin/example*' + exclude '**/search/plugin/custom*' + exclude '**/maps/example*' + exclude '**/original' + exclude '**/ExampleSearch.conf' + exclude '**/doc' + exclude '**/mod_wsgi-ge-extra.conf' + exclude '**/examplesearch*.sql' + exclude '**/readme.txt' + into new File(packageInstallRootDir, 'opt') } @@ -694,30 +734,21 @@ task openGeeServerDeb (type: GeeDeb, dependsOn: openGeeServerInitScripts) { into new File(packageInstallRootDir, 'opt/google/share/geplaces') } - from(stagedInstallDir_server_searchexample) { - into new File(packageInstallRootDir, 'opt/google/share/searchexample') - } - - from(stagedInstallDir_server_apachesupport) { - into packageInstallRootDir - } - // Create links link('/opt/google/etc', '/etc/opt/google') link('/opt/google/log', '/var/opt/google/log') link('/opt/google/run', '/var/opt/google/run') - link('/opt/google/gehttpd/htdocs/shared_assets/docs', '/opt/google/share/doc') } if (project.hasProperty('buildOpenGee')) { - openGeeServerRpm.dependsOn stageOpenGeeInstall - openGeeServerDeb.dependsOn stageOpenGeeInstall + openGeeServerCoreRpm.dependsOn stageOpenGeeInstall + openGeeServerCoreDeb.dependsOn stageOpenGeeInstall } -task openGeeFusionInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { - from(file('opengee-fusion/src')) - into "${buildDir}/opengee-fusion" +task openGeeFusionCoreInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { + from(file('opengee-fusion-core/src')) + into "${buildDir}/opengee-fusion-core" CopySpecTemplates.expand(delegate, [ 'openGeeVersion': ospackage.version, @@ -726,10 +757,10 @@ task openGeeFusionInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { } -task openGeeFusionRpm (type: GeeRpm, dependsOn: openGeeFusionInitScripts) { +task openGeeFusionCoreRpm (type: GeeRpm, dependsOn: openGeeFusionCoreInitScripts) { mustRunAfter stageOpenGeeInstall - packageName = 'opengee-fusion' + packageName = 'opengee-fusion-core' version = ospackage.version release = ospackage.release user = 'root' @@ -748,6 +779,9 @@ built from raster, vector, and location properties data. autoFindProvides = true autoFindRequires = true + // This replaces the opengee-fusion package from 5.3.4.1 and before + obsoletes('opengee-fusion', "5.3.4.1", LESS | EQUAL) + requires('opengee-common', ospackage.version, GREATER | EQUAL) requires('proj-devel') /* This dependency is not being picked up automatically by GeeRpm task */ requires('/etc/rc.d/init.d/functions') @@ -763,12 +797,11 @@ built from raster, vector, and location properties data. // Don't specify install scripts as single files. It doesn't work for // RPMs: - preInstall = file("${buildDir}/opengee-fusion/pre-install.sh") - postInstall = file("${buildDir}/opengee-fusion/post-install.sh") - preUninstall = file("${buildDir}/opengee-fusion/pre-uninstall.sh") - postUninstall = file("${buildDir}/opengee-fusion/post-uninstall.sh") + preInstall = file("${buildDir}/opengee-fusion-core/pre-install.sh") + postInstall = file("${buildDir}/opengee-fusion-core/post-install.sh") + preUninstall = file("${buildDir}/opengee-fusion-core/pre-uninstall.sh") + postUninstall = file("${buildDir}/opengee-fusion-core/post-uninstall.sh") - directory('/opt/google/share/tutorials', 0755) directory('/var/opt/google/run', 0775) directory('/var/opt/google/log', 0775) @@ -792,13 +825,13 @@ built from raster, vector, and location properties data. from(stagedInstallDir_fusion) { into packageInstallRootDir - } - from(stagedInstallDir_tutorial) { - into packageInstallRootDir + // Included in opengee-extra + exclude '**/doc' + exclude '**/taskrules' } - from(file('opengee-fusion/src/install')) { + from(file('opengee-fusion-core/src/install')) { into packageInstallRootDir CopySpecTemplates.expand(delegate, [ @@ -810,24 +843,26 @@ built from raster, vector, and location properties data. link('/opt/google/etc', '/etc/opt/google') link('/opt/google/log', '/var/opt/google/log') link('/opt/google/run', '/var/opt/google/run') - link('/opt/google/gehttpd/htdocs/shared_assets/docs', '/opt/google/share/doc') } -task openGeeFusionDeb (type: GeeDeb, dependsOn: openGeeFusionInitScripts) { +task openGeeFusionCoreDeb (type: GeeDeb, dependsOn: openGeeFusionCoreInitScripts) { mustRunAfter stageOpenGeeInstall - packageName = openGeeFusionRpm.packageName + packageName = openGeeFusionCoreRpm.packageName version = ospackage.version release = ospackage.release - user = openGeeFusionRpm.user - permissionGroup = openGeeFusionRpm.permissionGroup + user = openGeeFusionCoreRpm.user + permissionGroup = openGeeFusionCoreRpm.permissionGroup packageGroup = 'misc' - summary = openGeeFusionRpm.summary - packageDescription = openGeeFusionRpm.packageDescription - license = openGeeFusionRpm.license - url = openGeeFusionRpm.url + summary = openGeeFusionCoreRpm.summary + packageDescription = openGeeFusionCoreRpm.packageDescription + license = openGeeFusionCoreRpm.license + url = openGeeFusionCoreRpm.url type = BINARY + // This replaces the opengee-fusion package from 5.3.4.1 and before + obsoletes('opengee-fusion', "5.3.4.1", LESS | EQUAL) + requires('opengee-common', ospackage.version, GREATER | EQUAL) requires('dpkg') requires('lsb-base') @@ -836,12 +871,11 @@ task openGeeFusionDeb (type: GeeDeb, dependsOn: openGeeFusionInitScripts) { // Specify a single file for each install script. Otherwise, OSPackage // wraps the code in extra statements that, e.g., only run the // post-install script on a new install, and not on upgrade: - preInstallFile file("${buildDir}/opengee-fusion/pre-install.sh") - postInstallFile file("${buildDir}/opengee-fusion/post-install.sh") - preUninstallFile file("${buildDir}/opengee-fusion/pre-uninstall.sh") - postUninstallFile file("${buildDir}/opengee-fusion/post-uninstall.sh") + preInstallFile file("${buildDir}/opengee-fusion-core/pre-install.sh") + postInstallFile file("${buildDir}/opengee-fusion-core/post-install.sh") + preUninstallFile file("${buildDir}/opengee-fusion-core/pre-uninstall.sh") + postUninstallFile file("${buildDir}/opengee-fusion-core/post-uninstall.sh") - directory('/opt/google/share/tutorials', 0755) directory('/var/opt/google/run', 0775) directory('/var/opt/google/log', 0775) @@ -865,13 +899,13 @@ task openGeeFusionDeb (type: GeeDeb, dependsOn: openGeeFusionInitScripts) { from(stagedInstallDir_fusion) { into packageInstallRootDir - } - from(stagedInstallDir_tutorial) { - into packageInstallRootDir + // Included in opengee-extra + exclude '**/doc' + exclude '**/taskrules' } - from(file('opengee-fusion/src/install')) { + from(file('opengee-fusion-core/src/install')) { into packageInstallRootDir CopySpecTemplates.expand(delegate, [ @@ -883,7 +917,318 @@ task openGeeFusionDeb (type: GeeDeb, dependsOn: openGeeFusionInitScripts) { link('/opt/google/etc', '/etc/opt/google') link('/opt/google/log', '/var/opt/google/log') link('/opt/google/run', '/var/opt/google/run') +} + +if (project.hasProperty('buildOpenGee')) { + openGeeFusionCoreRpm.dependsOn stageOpenGeeInstall + openGeeFusionCoreDeb.dependsOn stageOpenGeeInstall +} + +task openGeeExtraInitScripts(type: Copy, dependsOn: openGeeSharedFiles) { + from(file('opengee-extra/src')) + into "${buildDir}/opengee-extra" + + CopySpecTemplates.expand(delegate, [ + 'openGeeVersion': ospackage.version, + 'project': project + ]) +} + +task openGeeExtraRpm(type: GeeRpm, dependsOn: openGeeExtraInitScripts) { + mustRunAfter stageOpenGeeInstall + + packageName = 'opengee-extra' + version = ospackage.version + release = ospackage.release + user = 'root' + permissionGroup = 'root' + packageGroup = 'Application/Productivity' + summary = 'Documentation, samples, examples, and tutorials for Open Google Earth Enterprise' + packageDescription = + 'Documentation, samples, examples, and tutorials for Open Google Earth Enterprise' + license = 'ASL 2.0' + url = 'https://github.com/google/earthenterprise' + autoFindProvides = true + autoFindRequires = true + + autoFindRequiresFilter = rpmCapabilityFilter + requiresCommandFilter = rpmCommandFilter + + // This package contains files that were in opengee-server and + // opengee-fusion in versions 5.3.4.1 and before. + conflicts('opengee-server', "5.3.4.1", LESS | EQUAL) + conflicts('opengee-fusion', "5.3.4.1", LESS | EQUAL) + + postInstall = file("${buildDir}/opengee-extra/post-install.sh") + preUninstall = file("${buildDir}/opengee-extra/pre-uninstall.sh") + + // ----------------------------------------------------------------------- + // Common Extras + // ----------------------------------------------------------------------- + + from (stagedInstallDir_common_opt) { + into new File(packageInstallRootDir, 'opt') + include '**/doc/**' + include '**/man/**' + include '**/Readme.txt' + include '**/gehttpd/examples/**' + } + + from(stagedInstallDir_manual) { + into packageInstallRootDir + } + + from (stagedInstallDir_common_user_magic) { + into packageInstallRootDir + include '**/ldap.conf.default' + } + + filesMatching( + '/opt/google/share/searchexample/searchexample' + ) { + it.mode = 0755 + } + + + // ----------------------------------------------------------------------- + // Server Extras + // ----------------------------------------------------------------------- + + from(stagedInstallDir_server_opt) { + include '**/manual/**' + include '**/search/plugin/example*' + include '**/search/plugin/custom*' + include '**/maps/example*' + include '**/original/**' + include '**/ExampleSearch.conf' + include '**/doc/**' + include '**/mod_wsgi-ge-extra.conf' + include '**/examplesearch*.sql' + include '**/readme.txt' + + into new File(packageInstallRootDir, 'opt') + } + + from(stagedInstallDir_server_searchexample) { + into new File(packageInstallRootDir, 'opt/google/share/searchexample') + } + link('/opt/google/gehttpd/htdocs/shared_assets/docs', '/opt/google/share/doc') + + // ----------------------------------------------------------------------- + // Fusion Extras + // ----------------------------------------------------------------------- + + directory('/opt/google/share/tutorials', 0755) + + from(stagedInstallDir_fusion) { + into packageInstallRootDir + include '**/doc/**' + include '**/taskrules/**' + } + + from(stagedInstallDir_tutorial) { + into packageInstallRootDir + } + + filesMatching( + '/opt/google/share/tutorials/fusion/download_tutorial.sh' + ) { + it.mode = 0755 + } +} + +task openGeeExtraDeb(type: GeeDeb, dependsOn: openGeeExtraInitScripts) { + mustRunAfter stageOpenGeeInstall + + packageName = openGeeExtraRpm.packageName + version = ospackage.version + release = ospackage.release + user = openGeeExtraRpm.user + permissionGroup = openGeeExtraRpm.permissionGroup + packageGroup = openGeeExtraRpm.packageGroup + summary = openGeeExtraRpm.summary + packageDescription = openGeeExtraRpm.packageDescription + license = openGeeExtraRpm.license + url = openGeeExtraRpm.url + + // This package contains files that were in opengee-server and + // opengee-fusion in versions 5.3.4.1 and before. + conflicts('opengee-server', "5.3.4.1", LESS | EQUAL) + conflicts('opengee-fusion', "5.3.4.1", LESS | EQUAL) + + postInstallFile file("${buildDir}/opengee-extra/post-install.sh") + preUninstallFile file("${buildDir}/opengee-extra/pre-uninstall.sh") + + // ----------------------------------------------------------------------- + // Common Extras + // ----------------------------------------------------------------------- + + from (stagedInstallDir_common_opt) { + into new File(packageInstallRootDir, 'opt') + include '**/doc/**' + include '**/man/**' + include '**/Readme.txt' + include '**/gehttpd/examples/**' + } + + from(stagedInstallDir_manual) { + into packageInstallRootDir + } + + from (stagedInstallDir_common_user_magic) { + into packageInstallRootDir + include '**/ldap.conf.default' + } + + filesMatching( + '/opt/google/share/searchexample/searchexample' + ) { + it.mode = 0755 + } + + + // ----------------------------------------------------------------------- + // Server Extras + // ----------------------------------------------------------------------- + + from(stagedInstallDir_server_opt) { + include '**/manual/**' + include '**/search/plugin/example*' + include '**/search/plugin/custom*' + include '**/maps/example*' + include '**/original/**' + include '**/ExampleSearch.conf' + include '**/doc/**' + include '**/mod_wsgi-ge-extra.conf' + include '**/examplesearch*.sql' + include '**/readme.txt' + + into new File(packageInstallRootDir, 'opt') + } + + from(stagedInstallDir_server_searchexample) { + into new File(packageInstallRootDir, 'opt/google/share/searchexample') + } + + link('/opt/google/gehttpd/htdocs/shared_assets/docs', '/opt/google/share/doc') + + // ----------------------------------------------------------------------- + // Fusion Extras + // ----------------------------------------------------------------------- + + directory('/opt/google/share/tutorials', 0755) + + from(stagedInstallDir_fusion) { + into packageInstallRootDir + include '**/doc/**' + include '**/taskrules/**' + } + + from(stagedInstallDir_tutorial) { + into packageInstallRootDir + } + + filesMatching( + '/opt/google/share/tutorials/fusion/download_tutorial.sh' + ) { + it.mode = 0755 + } +} + +if (project.hasProperty('buildOpenGee')) { + openGeeExtraRpm.dependsOn stageOpenGeeInstall + openGeeExtraDeb.dependsOn stageOpenGeeInstall +} + +// Convenience package that installs opengee-server-core + opengee-extra +task openGeeServerRpm (type: GeeRpm) { + mustRunAfter stageOpenGeeInstall + + packageName = 'opengee-server' + version = ospackage.version + release = ospackage.release + user = 'root' + permissionGroup = 'root' + packageGroup = 'Application/Productivity' + summary = 'Full Open Google Earth Enterprise 3D globe and 2D map tile server' + packageDescription = + 'Full install of the OpenGEE Server Daemons (Apache, PostGRE SQL) and command-line tools.' + + license = 'ASL 2.0' + url = 'https://github.com/google/earthenterprise' + type = BINARY + autoFindProvides = true + autoFindRequires = true + + requires('opengee-server-core', ospackage.version, GREATER | EQUAL) + requires('opengee-extra', ospackage.version, GREATER | EQUAL) +} + +task openGeeServerDeb (type: GeeDeb) { + mustRunAfter stageOpenGeeInstall + + packageName = openGeeServerRpm.packageName + version = ospackage.version + release = ospackage.release + user = openGeeServerRpm.user + permissionGroup = openGeeServerRpm.permissionGroup + packageGroup = openGeeServerRpm.packageGroup + summary = openGeeServerRpm.summary + packageDescription = openGeeServerRpm.packageDescription + license = openGeeServerRpm.license + url = openGeeServerRpm.url + type = BINARY + + requires('opengee-server-core', ospackage.version, GREATER | EQUAL) + requires('opengee-extra', ospackage.version, GREATER | EQUAL) +} + +if (project.hasProperty('buildOpenGee')) { + openGeeServerRpm.dependsOn stageOpenGeeInstall + openGeeServerDeb.dependsOn stageOpenGeeInstall +} + +// Convenience package that installs opengee-fusion-core + opengee-extra +task openGeeFusionRpm (type: GeeRpm) { + mustRunAfter stageOpenGeeInstall + + packageName = 'opengee-fusion' + version = ospackage.version + release = ospackage.release + user = 'root' + permissionGroup = 'root' + packageGroup = 'Application/Productivity' + summary = 'Full Open GEE Fusion UI and Command-line Utilities' + packageDescription ='Full install of the Open GEE Fusion UI and Command-line Utilities' + + license = 'ASL 2.0' + url = 'https://github.com/google/earthenterprise' + type = BINARY + autoFindProvides = true + autoFindRequires = true + + requires('opengee-fusion-core', ospackage.version, GREATER | EQUAL) + requires('opengee-extra', ospackage.version, GREATER | EQUAL) +} + +task openGeeFusionDeb (type: GeeDeb) { + mustRunAfter stageOpenGeeInstall + + packageName = openGeeFusionRpm.packageName + version = ospackage.version + release = ospackage.release + user = openGeeFusionRpm.user + permissionGroup = openGeeFusionRpm.permissionGroup + packageGroup = openGeeFusionRpm.packageGroup + summary = openGeeFusionRpm.summary + packageDescription = openGeeFusionRpm.packageDescription + license = openGeeFusionRpm.license + url = openGeeFusionRpm.url + type = BINARY + + requires('opengee-fusion-core', ospackage.version, GREATER | EQUAL) + requires('opengee-extra', ospackage.version, GREATER | EQUAL) } if (project.hasProperty('buildOpenGee')) { @@ -891,17 +1236,18 @@ if (project.hasProperty('buildOpenGee')) { openGeeFusionDeb.dependsOn stageOpenGeeInstall } - task openGeeRpms( dependsOn: [ - 'openGeeServerRpm', 'openGeeFusionRpm', 'openGeeCommonRpm', - 'openGeePostGisRpm' + 'openGeeServerCoreRpm', 'openGeeServerRpm', + 'openGeeFusionCoreRpm', 'openGeeFusionRpm', + 'openGeeCommonRpm', 'openGeePostGisRpm', 'openGeeExtraRpm' ]) task openGeeDebs( dependsOn: [ - 'openGeeServerDeb', 'openGeeFusionDeb', 'openGeeCommonDeb', - 'openGeePostGisDeb' + 'openGeeServerCoreDeb', 'openGeeServerDeb', + 'openGeeFusionCoreDeb', 'openGeeFusionDeb', + 'openGeeCommonDeb', 'openGeePostGisDeb', 'openGeeExtraDeb' ]) task osPackage(dependsOn: org.opengee.os.Platform.osId == 'ubuntu' ? openGeeDebs : openGeeRpms) { diff --git a/earth_enterprise/rpms/opengee-extra/snippets/post-install.sh b/earth_enterprise/rpms/opengee-extra/snippets/post-install.sh new file mode 100644 index 0000000000..d2511bf908 --- /dev/null +++ b/earth_enterprise/rpms/opengee-extra/snippets/post-install.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright 2020 The Open GEE Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +umask 002 + +main_postinstall() +{ + if [ -f "/etc/init.d/geserver" ]; then + install_searchexample_database + + # Set up the ExampleSearch plugin. The opengee-server-core RPM does + # this by calling geresetpgdb, but there's no need to do a full reset + # here. + "$BASEINSTALLDIR_OPT/bin/psql" -q -d gesearch geuser -f "$SQLDIR/examplesearch.sql" + + service geserver restart + fi + + if [ -f "/etc/init.d/gefusion" ]; then + service gefusion stop + add_fusion_tutorial_volume + service gefusion start + fi +} + +main_postinstall $@ diff --git a/earth_enterprise/rpms/opengee-extra/snippets/pre-uninstall.sh b/earth_enterprise/rpms/opengee-extra/snippets/pre-uninstall.sh new file mode 100644 index 0000000000..85517aefb9 --- /dev/null +++ b/earth_enterprise/rpms/opengee-extra/snippets/pre-uninstall.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Copyright 2020 The Open GEE Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +main_preuninstall() +{ + # If the server is still installed then we need to remove the ExampleSearch + # database entries. If the server has been uninstalled, the database is + # already gone. + if [ -f "/etc/init.d/geserver" ]; then + echo "Deleting SearchExample Database" + run_as_user "$GEPGUSER" "/opt/google/share/searchexample/searchexample delete" + "$BASEINSTALLDIR_OPT/bin/psql" -q -d gesearch geuser -f "$SQLDIR/examplesearch_delete.sql" + service geserver restart + fi + + # If Fusion is still installed then we need to remove the tutorial source + # volume. If fusion is no longer installed then there's nothing to do. + if [ -f "/etc/init.d/gefusion" ]; then + sudo service gefusion stop + echo "Removing Tutorial Source Volume" + "$BASEINSTALLDIR_OPT/bin/geconfigureassetroot" --noprompt --nochown \ + --assetroot "$ASSET_ROOT" --removevolume opt + sudo service gefusion start + fi +} + +# On Red Hat this script could be called as part of an upgrade. The first +# argument to the script will be 0 if this is a full uninstall. +# On Debian systems the first parameter is "upgrade", "remove" or "purge". +# (See .) +if [ "$1" = "0" ] || [ "$1" = "remove" ] || [ "$1" = "purge" ]; then + main_preuninstall $@ +fi diff --git a/earth_enterprise/rpms/opengee-extra/src/post-install.sh.template b/earth_enterprise/rpms/opengee-extra/src/post-install.sh.template new file mode 100644 index 0000000000..6e8b8d1eb8 --- /dev/null +++ b/earth_enterprise/rpms/opengee-extra/src/post-install.sh.template @@ -0,0 +1,7 @@ +<%= + // Prefix variable definitions to install script: + new File("${project.buildDir}/shared/install-utils.sh").text +%> +<%= new File("${project.buildDir}/shared/searchexample.sh").text %> +<%= new File("${project.buildDir}/shared/fusiontutorial.sh").text %> +<%= new File(thisTemplateFile.parent, '../snippets/post-install.sh').text %> diff --git a/earth_enterprise/rpms/opengee-server/src/pre-uninstall.sh.template b/earth_enterprise/rpms/opengee-extra/src/pre-uninstall.sh.template similarity index 100% rename from earth_enterprise/rpms/opengee-server/src/pre-uninstall.sh.template rename to earth_enterprise/rpms/opengee-extra/src/pre-uninstall.sh.template diff --git a/earth_enterprise/rpms/opengee-fusion/snippets/post-install.sh b/earth_enterprise/rpms/opengee-fusion-core/snippets/post-install.sh similarity index 93% rename from earth_enterprise/rpms/opengee-fusion/snippets/post-install.sh rename to earth_enterprise/rpms/opengee-fusion-core/snippets/post-install.sh index 88d984e455..9984b42c06 100644 --- a/earth_enterprise/rpms/opengee-fusion/snippets/post-install.sh +++ b/earth_enterprise/rpms/opengee-fusion-core/snippets/post-install.sh @@ -184,18 +184,7 @@ final_assetroot_configuration() "$BASEINSTALLDIR_OPT/bin/geselectassetroot" --role slave --assetroot "$ASSET_ROOT" else "$BASEINSTALLDIR_OPT/bin/geselectassetroot" --assetroot "$ASSET_ROOT" - - RET_VAL=0 - - "$BASEINSTALLDIR_OPT/bin/geconfigureassetroot" --addvolume \ - "opt:$BASEINSTALLDIR_OPT/share/tutorials" --noprompt --nochown || RET_VAL=$? - if [ "$RET_VAL" -eq "255" ]; then - cat < +<%= new File("${project.buildDir}/shared/fusiontutorial.sh").text %> <%= new File(thisTemplateFile.parent, '../snippets/post-install.sh').text %> diff --git a/earth_enterprise/rpms/opengee-fusion/src/post-uninstall.sh.template b/earth_enterprise/rpms/opengee-fusion-core/src/post-uninstall.sh.template similarity index 100% rename from earth_enterprise/rpms/opengee-fusion/src/post-uninstall.sh.template rename to earth_enterprise/rpms/opengee-fusion-core/src/post-uninstall.sh.template diff --git a/earth_enterprise/rpms/opengee-fusion/src/pre-install.sh.template b/earth_enterprise/rpms/opengee-fusion-core/src/pre-install.sh.template similarity index 100% rename from earth_enterprise/rpms/opengee-fusion/src/pre-install.sh.template rename to earth_enterprise/rpms/opengee-fusion-core/src/pre-install.sh.template diff --git a/earth_enterprise/rpms/opengee-fusion/src/pre-uninstall.sh.template b/earth_enterprise/rpms/opengee-fusion-core/src/pre-uninstall.sh.template similarity index 100% rename from earth_enterprise/rpms/opengee-fusion/src/pre-uninstall.sh.template rename to earth_enterprise/rpms/opengee-fusion-core/src/pre-uninstall.sh.template diff --git a/earth_enterprise/rpms/opengee-server/snippets/post-install.sh b/earth_enterprise/rpms/opengee-server-core/snippets/post-install.sh similarity index 93% rename from earth_enterprise/rpms/opengee-server/snippets/post-install.sh rename to earth_enterprise/rpms/opengee-server-core/snippets/post-install.sh index 95d887dabb..2142ba90fe 100755 --- a/earth_enterprise/rpms/opengee-server/snippets/post-install.sh +++ b/earth_enterprise/rpms/opengee-server-core/snippets/post-install.sh @@ -21,9 +21,6 @@ umask 002 PUBLISHER_ROOT="/gevol/published_dbs" INITSCRIPTUPDATE="/usr/sbin/update-rc.d" PGSQL="/var/opt/google/pgsql" -PGSQL_DATA="/var/opt/google/pgsql/data" -PGSQL_LOGS="/var/opt/google/pgsql/logs" -PGSQL_PROGRAM="/opt/google/bin/pg_ctl" #----------------------------------------------------------------- #----------------------------------------------------------------- @@ -78,18 +75,6 @@ main_postinstall() # Post-install Functions #----------------------------------------------------------------- -run_as_user() -{ - local use_su=`su $1 -c 'echo -n 1' 2> /dev/null || echo -n 0` - if [ "$use_su" -eq 1 ] ; then - >&2 echo "cd / ;su $1 -c \"$2\"" - ( cd / ;su $1 -c "$2" ) - else - >&2 echo "cd / ;sudo -u $1 $2" - ( cd / ;sudo -u $1 $2 ) - fi -} - configure_publish_root() { # Update PUBLISHER_ROOT if geserver already installed @@ -160,7 +145,12 @@ fix_postinstall_filepermissions() # Tutorial and Share find /opt/google/share -type d -exec chmod 755 {} \; find /opt/google/share -type f -exec chmod 644 {} \; - chmod ugo+x /opt/google/share/searchexample/searchexample + if [ -f "${SEARCH_EX_SCRIPT}" ]; then + chmod 0755 "${SEARCH_EX_SCRIPT}" + fi + if [ -f /opt/google/share/tutorials/fusion/download_tutorial.sh ]; then + chmod ugo+x /opt/google/share/tutorials/fusion/download_tutorial.sh + fi chmod ugo+x /opt/google/share/geplaces/geplaces chmod ugo+x /opt/google/share/support/geecheck/geecheck.pl chmod ugo+x /opt/google/share/support/geecheck/convert_to_kml.pl @@ -216,9 +206,8 @@ install_search_databases() # b) Install GEPlaces Database run_as_user "$GEPGUSER" "/opt/google/share/geplaces/geplaces create" - echo "# c) Install SearchExample Database " # c) Install SearchExample Database - run_as_user "$GEPGUSER" "/opt/google/share/searchexample/searchexample create" + install_searchexample_database # d) Stop the PSQL Server echo "# d) Stop the PSQL Server" diff --git a/earth_enterprise/rpms/opengee-server/snippets/post-uninstall.sh b/earth_enterprise/rpms/opengee-server-core/snippets/post-uninstall.sh similarity index 100% rename from earth_enterprise/rpms/opengee-server/snippets/post-uninstall.sh rename to earth_enterprise/rpms/opengee-server-core/snippets/post-uninstall.sh diff --git a/earth_enterprise/rpms/opengee-server/snippets/pre-install.sh b/earth_enterprise/rpms/opengee-server-core/snippets/pre-install.sh similarity index 100% rename from earth_enterprise/rpms/opengee-server/snippets/pre-install.sh rename to earth_enterprise/rpms/opengee-server-core/snippets/pre-install.sh diff --git a/earth_enterprise/rpms/opengee-server/snippets/pre-uninstall.sh b/earth_enterprise/rpms/opengee-server-core/snippets/pre-uninstall.sh similarity index 100% rename from earth_enterprise/rpms/opengee-server/snippets/pre-uninstall.sh rename to earth_enterprise/rpms/opengee-server-core/snippets/pre-uninstall.sh diff --git a/earth_enterprise/rpms/opengee-server/src/post-install.sh.template b/earth_enterprise/rpms/opengee-server-core/src/post-install.sh.template similarity index 82% rename from earth_enterprise/rpms/opengee-server/src/post-install.sh.template rename to earth_enterprise/rpms/opengee-server-core/src/post-install.sh.template index 19c4056b1e..12c296572f 100644 --- a/earth_enterprise/rpms/opengee-server/src/post-install.sh.template +++ b/earth_enterprise/rpms/opengee-server-core/src/post-install.sh.template @@ -6,4 +6,5 @@ // Add geresetpgdb script: new File(stagedInstallDir_server_opt, 'google/bin/gepgcommon').text %> +<%= new File("${project.buildDir}/shared/searchexample.sh").text %> <%= new File(thisTemplateFile.parent, '../snippets/post-install.sh').text %> diff --git a/earth_enterprise/rpms/opengee-server/src/post-uninstall.sh.template b/earth_enterprise/rpms/opengee-server-core/src/post-uninstall.sh.template similarity index 100% rename from earth_enterprise/rpms/opengee-server/src/post-uninstall.sh.template rename to earth_enterprise/rpms/opengee-server-core/src/post-uninstall.sh.template diff --git a/earth_enterprise/rpms/opengee-server/src/pre-install.sh.template b/earth_enterprise/rpms/opengee-server-core/src/pre-install.sh.template similarity index 100% rename from earth_enterprise/rpms/opengee-server/src/pre-install.sh.template rename to earth_enterprise/rpms/opengee-server-core/src/pre-install.sh.template diff --git a/earth_enterprise/rpms/opengee-server-core/src/pre-uninstall.sh.template b/earth_enterprise/rpms/opengee-server-core/src/pre-uninstall.sh.template new file mode 100644 index 0000000000..1d752cda17 --- /dev/null +++ b/earth_enterprise/rpms/opengee-server-core/src/pre-uninstall.sh.template @@ -0,0 +1,2 @@ +<%= new File("${project.buildDir}/shared/install-utils.sh").text %> +<%= new File(thisTemplateFile.parent, '../snippets/pre-uninstall.sh').text %> diff --git a/earth_enterprise/rpms/shared/snippets/fusiontutorial.sh b/earth_enterprise/rpms/shared/snippets/fusiontutorial.sh new file mode 100644 index 0000000000..fc6ccd7d61 --- /dev/null +++ b/earth_enterprise/rpms/shared/snippets/fusiontutorial.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright 2020 The Open GEE Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +add_fusion_tutorial_volume() +{ + # The tutorial directory can't be added as a source volume until + # opengee-fusion-core and opengee-extra are both installed. Both RPMs call + # this function, but only the second one will actually add the volume. + + CONFIG_ASSET_ROOT="${BASEINSTALLDIR_OPT}/bin/geconfigureassetroot" + if [[ -d "${FUSION_TUTORIAL_DIR}" && -f "${CONFIG_ASSET_ROOT}" ]]; then + RET_VAL=0 + "${CONFIG_ASSET_ROOT}" --addvolume \ + "opt:${FUSION_TUTORIAL_DIR}" --noprompt --nochown || RET_VAL=$? + if [ "$RET_VAL" -eq "255" ]; then + cat < /dev/null || echo -n 0` + if [ "$use_su" -eq 1 ] ; then + >&2 echo "cd / ;su $1 -c \"$2\"" + ( cd / ;su $1 -c "$2" ) + else + >&2 echo "cd / ;sudo -u $1 $2" + ( cd / ;sudo -u $1 $2 ) + fi +} diff --git a/earth_enterprise/rpms/shared/snippets/searchexample.sh b/earth_enterprise/rpms/shared/snippets/searchexample.sh new file mode 100644 index 0000000000..63ffc19ecd --- /dev/null +++ b/earth_enterprise/rpms/shared/snippets/searchexample.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Copyright 2020 The Open GEE Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +install_searchexample_database() +{ + # The search example database can only be installed after opengee-server-core + # (which provides postgresql) and opengee-extra (which provides searchexample) + # are both installed. Both RPMs call this function and the second one will + # run the install. + + if [[ -f "${PGSQL_PROGRAM}" && -f "${SEARCH_EX_SCRIPT}" ]]; then + echo "Installing SearchExample Database" + run_as_user "$GEPGUSER" "/opt/google/share/searchexample/searchexample create" + fi +} diff --git a/earth_enterprise/rpms/shared/src/fusiontutorial.sh.template b/earth_enterprise/rpms/shared/src/fusiontutorial.sh.template new file mode 100644 index 0000000000..2f420728ca --- /dev/null +++ b/earth_enterprise/rpms/shared/src/fusiontutorial.sh.template @@ -0,0 +1 @@ +<%= new File(thisTemplateFile.parent, '../snippets/fusiontutorial.sh').text %> diff --git a/earth_enterprise/rpms/shared/src/searchexample.sh.template b/earth_enterprise/rpms/shared/src/searchexample.sh.template new file mode 100644 index 0000000000..bd9164efbe --- /dev/null +++ b/earth_enterprise/rpms/shared/src/searchexample.sh.template @@ -0,0 +1 @@ +<%= new File(thisTemplateFile.parent, '../snippets/searchexample.sh').text %> diff --git a/earth_enterprise/src/fusion/fusionui/MainWindow.cpp b/earth_enterprise/src/fusion/fusionui/MainWindow.cpp index 81d16dceda..553ac4e110 100644 --- a/earth_enterprise/src/fusion/fusionui/MainWindow.cpp +++ b/earth_enterprise/src/fusion/fusionui/MainWindow.cpp @@ -147,6 +147,11 @@ void MainWindow::Init() { updatePlaceMarks(); updateImageLayers(); + // enable the help menu item if docs are installed + if (!getManualPath().isEmpty()) { + helpmanual->setVisible(TRUE); + } + // handle drop events connect(gfxview, SIGNAL(dropFile(const QString&)), this, SLOT(fileDragOpen(const QString&))); @@ -276,15 +281,25 @@ void MainWindow::previewProjectionActivated(int choice) { } } -void MainWindow::launchHelpManual() { - // find manual +QString MainWindow::getManualPath() { QString doc = khComposePath( kGESharePath, "doc/manual/index.html"); if (!khExists(doc.latin1())) { + return QString(); + } + else { + return doc; + } +} + +void MainWindow::launchHelpManual() { + // find manual + QString doc = getManualPath(); + if (doc.isEmpty()) { QMessageBox::critical( this, "Error", - tr("Unable to find manual. Please re-install fusion to correct this."), + tr("Unable to find manual."), tr("OK"), 0, 0, 0); return; } diff --git a/earth_enterprise/src/fusion/fusionui/MainWindow.h b/earth_enterprise/src/fusion/fusionui/MainWindow.h index d03f99666d..f0702826f2 100644 --- a/earth_enterprise/src/fusion/fusionui/MainWindow.h +++ b/earth_enterprise/src/fusion/fusionui/MainWindow.h @@ -120,6 +120,7 @@ class MainWindow : public MainWindowBase { private: void saveScreenLayout(); + QString getManualPath(); PlacemarkManager* placemark_manager_; diff --git a/earth_enterprise/src/fusion/fusionui/mainwindowbase.ui b/earth_enterprise/src/fusion/fusionui/mainwindowbase.ui index 80378f442a..6ea295a269 100644 --- a/earth_enterprise/src/fusion/fusionui/mainwindowbase.ui +++ b/earth_enterprise/src/fusion/fusionui/mainwindowbase.ui @@ -107,7 +107,6 @@ - @@ -879,6 +878,9 @@ &Contents + + false + diff --git a/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/index.html b/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/index.html index 026afe9096..cd012ed85e 100644 --- a/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/index.html +++ b/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/index.html @@ -60,7 +60,7 @@ Glc Disassembly Launch Cutter
Support
- Documentation + diff --git a/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/js/admin_tools.js b/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/js/admin_tools.js index f59158df5b..6c47576142 100755 --- a/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/js/admin_tools.js +++ b/earth_enterprise/src/fusion/portableglobe/cutter/htdocs/admin/js/admin_tools.js @@ -525,6 +525,16 @@ gees.admin = { }); }, + getDocStatus: function() { + // Show documentation link if docs are installed + $.ajax({ + url: GEE_BASE_URL + '/shared_assets/docs/manual/', + success: function(e) { + gees.dom.show('DocumentationItem'); + } + }); + }, + setAdminDefaults: function() { // Status globals for UI. this.cutterStatus = 'On'; @@ -532,6 +542,8 @@ gees.admin = { this.mode = this.modes.database; // Determine if cutter is enabled or disabled. this.getCutterStatus(); + // Determine if docs are installed + this.getDocStatus(); return this; }, diff --git a/earth_enterprise/src/server/SConscript b/earth_enterprise/src/server/SConscript index c12b26a0ce..822c97858e 100644 --- a/earth_enterprise/src/server/SConscript +++ b/earth_enterprise/src/server/SConscript @@ -28,7 +28,7 @@ env.install('httpdconf', ['.htpasswd']) # Install the postgres init script along with the sql files. env.install('server_bin', ['geresetpgdb', 'gepgcommon']) -env.install('server_sql', ['gestream_tables.sql', +env.install('server_sql', ['examplesearch.sql', 'gestream_tables.sql', 'gestream_tables_upgrade_to_3_1.sql', 'gesearch_tables.sql', 'geendsnippet_tables.sql']) env.install('httpd', ['gehttpd_init'], 'bin') diff --git a/earth_enterprise/src/server/examplesearch.sql b/earth_enterprise/src/server/examplesearch.sql new file mode 100644 index 0000000000..fea6418364 --- /dev/null +++ b/earth_enterprise/src/server/examplesearch.sql @@ -0,0 +1,33 @@ +-- +-- Copyright 2020 The Open GEE Contributors +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +SET CLIENT_MIN_MESSAGES TO WARNING; + +-- Function to install the example search definition. This function calls the +-- upsert_searchdef_content function that was created in gesearch_tables.sql. + +CREATE OR REPLACE FUNCTION run_examplesearch_upsert() +RETURNS VOID AS $$ +DECLARE + searchDefName VARCHAR := 'ExampleSearch'; + searchDefContents VARCHAR := + '{"additional_config_param": null, "label": "Example search", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "/gesearch/ExampleSearch", "result_type": "KML", "html_transform_url": "about:blank", "kml_transform_url": "about:blank", "suggest_server": "about:blank", "fields": [{"key": "q", "suggestion": "San Francisco neighborhoods", "label": null}]}'; +BEGIN + PERFORM upsert_searchdef_content(searchDefName, searchDefContents); +END; +$$ LANGUAGE plpgsql; + +SELECT run_examplesearch_upsert(); diff --git a/earth_enterprise/src/server/examplesearch_delete.sql b/earth_enterprise/src/server/examplesearch_delete.sql new file mode 100644 index 0000000000..97703b67bf --- /dev/null +++ b/earth_enterprise/src/server/examplesearch_delete.sql @@ -0,0 +1,19 @@ +-- +-- Copyright 2020 The Open GEE Contributors +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +SET CLIENT_MIN_MESSAGES TO WARNING; + +DELETE FROM search_def_table WHERE search_def_name = 'ExampleSearch'; diff --git a/earth_enterprise/src/server/geresetpgdb b/earth_enterprise/src/server/geresetpgdb index a379a84629..397c084ae6 100755 --- a/earth_enterprise/src/server/geresetpgdb +++ b/earth_enterprise/src/server/geresetpgdb @@ -294,7 +294,10 @@ elif [ "$type" != "backup" ]; then "$BINDIR/createdb" --owner=geuser -U geuser gesearch "$BINDIR/psql" -q -d gesearch geuser -f "$SQLDIR/gesearch_tables.sql" - + if [ -f "$SQLDIR/examplesearch.sql" ]; then + "$BINDIR/psql" -q -d gesearch geuser -f "$SQLDIR/examplesearch.sql" + fi + "$BINDIR/createdb" -U geuser --owner=geuser gepoi "$BINDIR/psql" -U geuser -d gepoi -c "CREATE EXTENSION postgis" @@ -331,6 +334,9 @@ if [ "$type" == "upgrade" -o "$type" == "restore" ]; then # Update tables/records of gesearch databases. "$BINDIR/psql" -q -d gesearch geuser -f "$SQLDIR/gesearch_tables.sql" + if [ -f "$SQLDIR/examplesearch.sql" ]; then + "$BINDIR/psql" -q -d gesearch geuser -f "$SQLDIR/examplesearch.sql" + fi # Update tables/records of gestream databases. "$BINDIR/psql" -q -d gestream geuser -f "$SQLDIR/gestream_tables.sql" diff --git a/earth_enterprise/src/server/gesearch_tables.sql b/earth_enterprise/src/server/gesearch_tables.sql index 45afc42540..c495d4765f 100644 --- a/earth_enterprise/src/server/gesearch_tables.sql +++ b/earth_enterprise/src/server/gesearch_tables.sql @@ -136,13 +136,12 @@ $$ LANGUAGE plpgsql; CREATE OR REPLACE FUNCTION run_searchdef_upsert() RETURNS VOID AS $$ DECLARE - searchDefNames VARCHAR[6] := ARRAY['POISearch','GeocodingFederated', 'Coordinate', 'Places', 'ExampleSearch', 'SearchGoogle']; + searchDefNames VARCHAR[6] := ARRAY['POISearch', 'GeocodingFederated', 'Coordinate', 'Places', 'SearchGoogle']; searchDefContents VARCHAR[6] := ARRAY[ '{"additional_config_param": null, "label": "POI", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "POISearch", "result_type": "KML", "html_transform_url": "about:blank", "kml_transform_url": "about:blank", "suggest_server": "about:blank", "fields": [{"key": "q", "suggestion": "Point of interest", "label": null}]}', '{"additional_config_param": null, "label": "Places or coordinates", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "/gesearch/FederatedSearch", "result_type": "KML", "html_transform_url": "about:blank", "kml_transform_url": "about:blank", "suggest_server": "about:blank", "fields": [{"key": "q", "suggestion": "City, country or lat, lng (e.g., 23.47, -132.67)", "label": null}]}', '{"additional_config_param": null, "label": "Coordinates", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "/gesearch/CoordinateSearch", "result_type": "KML", "html_transform_url": "about:blank", "kml_transform_url": "about:blank", "suggest_server": "about:blank", "fields": [{"key": "q", "suggestion": "Latitude, longitude (e.g., 23.47, -132.67)", "label": null}]}', '{"additional_config_param": null, "label": "Places", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "/gesearch/PlacesSearch", "result_type": "KML", "html_transform_url": "about:blank", "kml_transform_url": "about:blank", "suggest_server": "about:blank", "fields": [{"key": "q", "suggestion": "City, country", "label": null}]}', - '{"additional_config_param": null, "label": "Example search", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "/gesearch/ExampleSearch", "result_type": "KML", "html_transform_url": "about:blank", "kml_transform_url": "about:blank", "suggest_server": "about:blank", "fields": [{"key": "q", "suggestion": "San Francisco neighborhoods", "label": null}]}', '{"additional_config_param": null, "label": "Search Google", "additional_query_param": "flyToFirstElement=true&displayKeys=location", "service_url": "/gesearch/SearchGoogle", "result_type": "XML", "html_transform_url": "https://www.google.com/earth/client/unifiedsearch/syndication_to_html_$[hl].xsl", "kml_transform_url": "https://www.google.com/earth/client/unifiedsearch/syndication_to_kml_$[hl].xsl", "suggest_server": "http://maps.google.com/maps/suggest", "fields": [{"key": "q", "suggestion": "5520 Quebec Place Washington", "label": null}]}' ]; diff --git a/earth_enterprise/src/third_party/mod_wsgi/SConscript b/earth_enterprise/src/third_party/mod_wsgi/SConscript index 024b7649d6..d8e3578e10 100644 --- a/earth_enterprise/src/third_party/mod_wsgi/SConscript +++ b/earth_enterprise/src/third_party/mod_wsgi/SConscript @@ -119,9 +119,12 @@ install_root_doc = '%s/opt/google/share/doc/packages/%s' % ( mod_wsgi_target = '%s/.install' % current_dir mod_wsgi_conf_dir = Dir('#third_party/mod_wsgi/conf.d').abspath mod_wsgi_conf = 'mod_wsgi-ge.conf' +mod_wsgi_extra_conf = 'mod_wsgi-ge-extra.conf' source_conf = '%s/%s.in' % (mod_wsgi_conf_dir, mod_wsgi_conf) target_conf = '%s/gehttpd/conf.d/%s' % (install_root_opt, mod_wsgi_conf) +source_extra_conf = '%s/%s.in' % (mod_wsgi_conf_dir, mod_wsgi_extra_conf) +target_extra_conf = '%s/gehttpd/conf.d/%s' % (install_root_opt, mod_wsgi_extra_conf) mod_wsgi_install = mod_wsgi_env.Command( mod_wsgi_target, mod_wsgi_build, [mod_wsgi_env.MultiCommand('\n'.join([ @@ -135,6 +138,7 @@ mod_wsgi_install = mod_wsgi_env.Command( 'install -m755 %s %s' % (source_conf, target_conf), "sed -i -e 's/@PYTHON_VERSION@/%s/' -e 's/@PYTHON_MAJOR_VERSION@/%s/' %s" % (mod_wsgi_env['python_version'], mod_wsgi_env['python_major_version'], target_conf), "sed -i -e 's&@PYTHON_HOME_DIR@&%s&' %s" % (mod_wsgi_env['python_home'], target_conf), + 'install -m755 %s %s' % (source_extra_conf, target_extra_conf), 'touch %s' % mod_wsgi_target]))]) # [5] Install these into various directories as required for build diff --git a/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge-extra.conf.in b/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge-extra.conf.in new file mode 100644 index 0000000000..f2d28fe2e0 --- /dev/null +++ b/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge-extra.conf.in @@ -0,0 +1,25 @@ +# Copyright 2020 The Open GEE Contributors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + + # Load the WSGI module if it hasn't been loaded yet + LoadModule wsgi_module modules/mod_wsgi.so + + + + # --Handles Example search requests. + WSGIScriptAlias /gesearch/ExampleSearch /opt/google/gehttpd/wsgi-bin/search/plugin/example_search_app.py process-group=ge_search_serve + # --Handles Custom POI search requests. + WSGIScriptAlias /gesearch/CustomPOISearch /opt/google/gehttpd/wsgi-bin/search/plugin/custom_POI_search_app.py process-group=ge_search_serve + diff --git a/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge.conf.in b/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge.conf.in index 27045de675..064b730309 100644 --- a/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge.conf.in +++ b/earth_enterprise/src/third_party/mod_wsgi/conf.d/mod_wsgi-ge.conf.in @@ -12,7 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -LoadModule wsgi_module modules/mod_wsgi.so + + # Load the WSGI module if it hasn't been loaded yet + LoadModule wsgi_module modules/mod_wsgi.so + WSGIRestrictEmbedded On @@ -45,14 +48,9 @@ LoadModule wsgi_module modules/mod_wsgi.so WSGIScriptAlias /gesearch/CoordinateSearch /opt/google/gehttpd/wsgi-bin/search/plugin/coordinate_search_app.py process-group=ge_search_serve # --Handles Federated search requests. WSGIScriptAlias /gesearch/FederatedSearch /opt/google/gehttpd/wsgi-bin/search/plugin/federated_search_app.py process-group=ge_search_serve - # --Handles Example search requests. - WSGIScriptAlias /gesearch/ExampleSearch /opt/google/gehttpd/wsgi-bin/search/plugin/example_search_app.py process-group=ge_search_serve # --Handles POI search requests. WSGIScriptAlias /POISearch /opt/google/gehttpd/wsgi-bin/search/plugin/poi_search_app.py process-group=ge_search_serve - # --Handles Custom POI search requests. - WSGIScriptAlias /gesearch/CustomPOISearch /opt/google/gehttpd/wsgi-bin/search/plugin/custom_POI_search_app.py process-group=ge_search_serve - # --Handles Google Search requests. WSGIScriptAlias /gesearch/SearchGoogle /opt/google/gehttpd/wsgi-bin/search/plugin/search_google_app.py process-group=ge_search_serve