Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Move non-essentials (documentation, etc) into separate RPM (#1754)
Browse files Browse the repository at this point in the history
  • Loading branch information
tst-lsavoie authored Jun 17, 2020
1 parent 93a248f commit ec8fb04
Show file tree
Hide file tree
Showing 41 changed files with 764 additions and 143 deletions.
542 changes: 444 additions & 98 deletions earth_enterprise/rpms/build.gradle

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions earth_enterprise/rpms/opengee-extra/snippets/post-install.sh
Original file line number Diff line number Diff line change
@@ -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 $@
47 changes: 47 additions & 0 deletions earth_enterprise/rpms/opengee-extra/snippets/pre-uninstall.sh
Original file line number Diff line number Diff line change
@@ -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 <https://wiki.debian.org/MaintainerScripts>.)
if [ "$1" = "0" ] || [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
main_preuninstall $@
fi
Original file line number Diff line number Diff line change
@@ -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 %>
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<END
The geconfigureassetroot utility has failed while attempting
to add the volume 'opt:$BASEINSTALLDIR_OPT/share/tutorials'.
This is probably because a volume named 'opt' already exists.
END
fi
add_fusion_tutorial_volume
fi
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<%= new File("${project.buildDir}/shared/install-utils.sh").text %>
<%= new File("${project.buildDir}/shared/fusiontutorial.sh").text %>
<%= new File(thisTemplateFile.parent, '../snippets/post-install.sh').text %>
Original file line number Diff line number Diff line change
Expand Up @@ -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"
#-----------------------------------------------------------------

#-----------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<%= new File("${project.buildDir}/shared/install-utils.sh").text %>
<%= new File(thisTemplateFile.parent, '../snippets/pre-uninstall.sh').text %>
36 changes: 36 additions & 0 deletions earth_enterprise/rpms/shared/snippets/fusiontutorial.sh
Original file line number Diff line number Diff line change
@@ -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 <<END
The geconfigureassetroot utility has failed while attempting
to add the volume 'opt:${FUSION_TUTORIAL_DIR}'.
This is probably because a volume named 'opt' already exists.
END
fi
fi
}
20 changes: 20 additions & 0 deletions earth_enterprise/rpms/shared/snippets/install-utils-main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ BASEINSTALLDIR_OPT="/opt/google"
BASEINSTALLDIR_ETC="/etc/opt/google"
BASEINSTALLDIR_VAR="/var/opt/google"

PGSQL_DATA="/var/opt/google/pgsql/data"
PGSQL_LOGS="/var/opt/google/pgsql/logs"
PGSQL_PROGRAM="/opt/google/bin/pg_ctl"

SEARCH_EX_SCRIPT="/opt/google/share/searchexample/searchexample"

# Derived directories:
SYSTEMRC="$BASEINSTALLDIR_ETC/systemrc"
MIN_ASSET_ROOT_VOLUME_SIZE_IN_KB=1048576
FUSION_TUTORIAL_DIR="$BASEINSTALLDIR_OPT/share/tutorials"
SQLDIR="$BASEINSTALLDIR_OPT/share/opengee-server/sql"

# Configuration values:
ASSET_ROOT="/gevol/assets"
Expand Down Expand Up @@ -80,3 +88,15 @@ xml_file_get_xpath()
# Skip the first and the last line:
tail -n +2 | head -n -1
}

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
}
28 changes: 28 additions & 0 deletions earth_enterprise/rpms/shared/snippets/searchexample.sh
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= new File(thisTemplateFile.parent, '../snippets/fusiontutorial.sh').text %>
1 change: 1 addition & 0 deletions earth_enterprise/rpms/shared/src/searchexample.sh.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= new File(thisTemplateFile.parent, '../snippets/searchexample.sh').text %>
21 changes: 18 additions & 3 deletions earth_enterprise/src/fusion/fusionui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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&)));
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions earth_enterprise/src/fusion/fusionui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class MainWindow : public MainWindowBase {

private:
void saveScreenLayout();
QString getManualPath();

PlacemarkManager* placemark_manager_;

Expand Down
4 changes: 3 additions & 1 deletion earth_enterprise/src/fusion/fusionui/mainwindowbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
</item>
<item text="&amp;Help" name="help_menu">
<action name="helpmanual"/>
<separator/>
<action name="helpAction"/>
</item>
</menubar>
Expand Down Expand Up @@ -879,6 +878,9 @@
<property name="menuText">
<string>&amp;Contents</string>
</property>
<property name="visible">
<bool>false</bool>
</property>
</action>
<action>
<property name="name">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<a href="javascript:void(0)" onclick="gees.tools.launch.glcDisassembly();gees.admin.settingsDropdown()">Glc Disassembly</a>
<a href="/cutter/" onclick="gees.admin.settingsDropdown()" target="new">Launch Cutter</a>
<div class="SettingsLabel">Support</div>
<a href="/shared_assets/docs/manual/" target="new">Documentation</a>
<a href="/shared_assets/docs/manual/" id="DocumentationItem" style="display:none" target="new">Documentation</a>
<!-- The following is not working and is temporarily disabled
<a href="javascript:void(0)" onclick="gees.tools.launch.apacheLogs();gees.admin.settingsDropdown()">Apache logs</a>
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,13 +525,25 @@ 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';
// Default mode. Options: DASHBOARD, DATABASE, SEARCH, SNIPPET.
this.mode = this.modes.database;
// Determine if cutter is enabled or disabled.
this.getCutterStatus();
// Determine if docs are installed
this.getDocStatus();
return this;
},

Expand Down
2 changes: 1 addition & 1 deletion earth_enterprise/src/server/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Loading

0 comments on commit ec8fb04

Please sign in to comment.