Adding latest additions/edits to the script.
authorChris Sharp <csharp@georgialibraries.org>
Thu, 29 May 2014 11:41:40 +0000 (07:41 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 29 May 2014 11:41:40 +0000 (07:41 -0400)
pines-ubuntu.sh

index 8130656..a8c0ab1 100755 (executable)
@@ -19,7 +19,7 @@
 # A program to install and configure the Evergreen Staff Client on Ubuntu Linux.
 
 # http://gapines.org/updates/clients/2.5.1pines.0_i686.tar.bz2
-_VERSION="0.4"
+_VERSION="0.08"
 export WORKDIR=`pwd`
 ARCH=`uname -p`
 export CLIENT="2.5.1pines.0_$ARCH.tar.bz2"
@@ -31,6 +31,7 @@ DE="$DESKTOP_SESSION"
 EPSON_URL="https://pos.epson.com/developers/LicenseAgreement.htm?AssetId=28724"
 export DOWNLOAD_DIR="$HOME/Downloads"
 export EPSON_ARCHIVE="tmx-cups-2.0.0.0.zip"
+export EPSON_UNZIP_DIR="tmx-cups-2.0.0.0"
 EPSON_DIR="tmx-cups"
 export PRG_NAME="Evergreen Staff Client Setup"
 TERM_SET="-bg white -fg blue -fn 10x20"
@@ -42,8 +43,8 @@ wget --progress=bar:force  "$CLIENT_URL_BASE/$CLIENT" 2>&1 | zenity --width=350
 mkdir -p "$CLIENT_DIR"
 cd $CLIENT_DIR || {
 zenity --title="$PRG_NAME" --height="50" --width="350" --no-wrap --error --text="Could not change to $CLIENT_DIR."
-exit 1;
 cd $WORKDIR
+exit 1;
 }
 xterm $TERM_SET -e "echo extracting client...; tar jxvf $WORKDIR/$CLIENT"
 }
@@ -86,13 +87,33 @@ StartupNotify=false
 EOF
 }
 
-DownloadEpson() { ### Download and install the Epson TM-V receipt printer driver.
+Download_Driver () { ### Prompt about driver download and open a web browser with URL of driver download.
 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME Epson Driver Download" --height="50" --width="360" --no-wrap --info --text="Epson *requires* you to accept a license agreement to download the TM88-V printer driver."
 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Setup will now open a browser window where you can download\nthe Epson TM88-V receipt printer driver.  Please choose to save\nthe file, then close the browser to continue."
+if pgrep firefox; then
+    zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Setup detected an open web browser.  Please close \n all your broswer windows then press OK"
+    while pgrep firefox; do
+       zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="A web browser is still running.  Please close \n all your broswer windows then press OK"
+    done
+fi
 sensible-browser $EPSON_URL
+}
+
+DownloadEpson() { ### Download and install the Epson TM-V receipt printer driver.
+if [ -e $DOWNLOAD_DIR/$EPSON_ARCHIVE ]; then
+    zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --question --text="Epson driver exists in $DOWNLOAD_DIR/$EPSON_ARCHIVE, \n would you like to download the driver again?";RE_DOWNLOAD_DRIVER="$?"
+    if [ "$RE_DOWNLOAD_DRIVER" = "0" ]; then
+       rm "$DOWNLOAD_DIR/$EPSON_ARCHIVE"
+       Download_Driver
+    fi
+else
+    Download_Driver
+fi
+
 if [ -e $DOWNLOAD_DIR/$EPSON_ARCHIVE ]; then
     cd $HOME
-    xterm $TERM_SET -e "unzip $DOWNLOAD_DIR/$EPSON_ARCHIVE"
+    [ -e "$EPSON_DIR" ] && rm -rf "$EPSON_DIR"
+    xterm $TERM_SET -e "echo;echo Unzipping Epson Driver $DOWNLOAD_DIR/$EPSON_ARCHIVE;echo;sleep 2;unzip $DOWNLOAD_DIR/$EPSON_ARCHIVE && mv $EPSON_UNZIP_DIR/$EPSON_DIR . "
     cd $EPSON_DIR || {
     zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --error --text="Could not change to $EPSON_DIR."
     zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="3" --no-wrap --error --text="Exiting Setup..."
@@ -101,14 +122,16 @@ if [ -e $DOWNLOAD_DIR/$EPSON_ARCHIVE ]; then
     echo
     echo
     zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="2" --no-wrap --info --text="Starting Epson installer."
-    if [ "$ARCH" = "i386" ]; then
+    if [ "$ARCH" = "i386" ] || [ "$ARCH" = "i686" ]; then
        zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Choose Ubuntu 12.04 (32-bit) when prompted by the installer script."
-    elif [ "$ARCH" = "x86_64" ]; then
+    elif [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
        zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Choose Ubuntu 12.04 (64-bit) when prompted by the installer script."
     else
        zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="System architecture not detected.  Please choose Ubuntu 12.04 for\nyour system's architecture when prompted by the installer script"
     fi
-    xterm $TERM_SET "./install.sh && zenity --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Epson installation complete.""
+    chmod 755 $HOME/$EPSON_DIR/install.sh
+    xterm $TERM_SET -e "echo Installing Epson Driver;echo;echo;echo Keystrokes will not be displayed when typing your password;./install.sh && echo Installation Complete;sleep 2"
+    zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="3" --no-wrap --info --text="Exiting Setup..."
 else
     zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --error --text="Epson driver package not downloaded to expected location.\nPlease download and install the Epson driver manually."
     zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="3" --no-wrap --info --text="Exiting Setup..."