From 374a063a7c416b5e7dcda48a925908d9374f3189 Mon Sep 17 00:00:00 2001
From: Bruce Allen <bdallen@nps.edu>
Date: Sat, 23 Mar 2024 20:42:57 -0700
Subject: [PATCH] add Gryphon launcher for the Ubuntu configuration

---
 install_mp.bash | 64 +++++++++++++++++++++++++++++++------------------
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/install_mp.bash b/install_mp.bash
index e6a2f85..bced996 100755
--- a/install_mp.bash
+++ b/install_mp.bash
@@ -5,14 +5,25 @@ set -e
 mp_gryphon_path=${HOME}/mp_gryphon
 cat <<EOF
 ********************************************************************************
-               Configure Linux/Mac to support Monterey Phoenix
+          Configure Linux/Mac to support Monterey Phoenix - Gryphon
 ********************************************************************************
-Usage: ./install_mp.bash <your OS name>
-This script installs packages required by MP Gryphon and installs
-MP Gryphon packages under ${mp_gryphon_path}:
-    * Trace generator
-    * Gryphon
-    * Preloaded examples
+Usage: ./install_mp.bash <configuration>
+Configuration options are:
+
+    * ubuntu - Installs:
+               trace-generator and required system packages,
+               Gryphon and required pip packages,
+               preloaded examples
+
+    * ubuntu_server - Installs:
+               trace-generator and required system packages,
+               Gryphon and required pip packages,
+
+    * macos - Installs:
+               Gryphon and required pip packages,
+               preloaded examples
+
+The trace generator, Gryphon, and preloaded examples are installed under ${mp_gryphon_path}.
 
 EOF
 
@@ -20,7 +31,7 @@ EOF
 if [ "$1" != "" ]; then
   target_os=$1
 else
-  echo An OS name is required.  Aborting.
+  echo A configuration option is required.  Aborting.
   exit
 fi
 echo "Press enter to continue..."
@@ -69,13 +80,24 @@ install_preloaded_examples() {
   fi
 }
 
-install_mp_gryphon() {
-  install_trace_generator
-  install_gryphon
-  install_preloaded_examples
+install_ubuntu_gryphon_launcher() {
+  echo "Adding Gryphon launcher to desktop..."
+  launcher_path="${HOME}/Desktop/Gryphon.desktop"
+  cat <<EOF > ${launcher_path}
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=Gryphon
+Comment=
+Exec=python3 mp.py
+Icon=${mp_gryphon_path}/gryphon/python/resources/icons/MP-logo-small-blue.png
+Path=${mp_gryphon_path}/gryphon/python
+Terminal=false
+EOF
+  chmod a+x ${launcher_path}
 }
 
-# install
+# install a configuration on a target OS
 case $target_os in
 ubuntu_server)
   echo "Updating existing packages..."
@@ -101,7 +123,10 @@ ubuntu)
   pip3 install PySide6
   pip3 install pyqtdarktheme
   pip3 install pyspellchecker
-  install_mp_gryphon
+  install_trace_generator
+  install_gryphon
+  install_preloaded_examples
+  install_ubuntu_gryphon_launcher
   ;;
 
 macos)
@@ -114,17 +139,10 @@ macos)
   install_preloaded_examples
   ;;
 
-gryphon_only)
-  echo "Installing Gryphon only..."
-  install_gryphon
-  install_preloaded_examples
-  ;;
-
 *)
-  echo Installer for ${target_os} not detected.  Packages not installed.
+  echo Error: Configuration ${target_os} is not recognized.  Aborting.
   exit 1
 esac
 
-echo "Installation complete."
-echo "Monterey Phoenix is now installed and current."
+echo "Monterey Phoenix - Gryphon ${target_os} Installation complete."
 
-- 
GitLab