3 # Copyright (C) 2014-2016 Georgia Public Library Service
4 # Chris Sharp <csharp@georgialibraries.org>
5 # Andy Witter <awitter@georgialibraries.org>
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # A program to install and configure the Evergreen Staff Client on Ubuntu Linux.
22 # http://gapines.org/updates/clients/2.5.1pines.0_i686.tar.bz2
26 export CLIENT="2.7.2pines.0_$ARCH.tar.bz2"
27 export CLIENT_URL_BASE="http://gapines.org/updates/clients"
28 export CLIENT_DIR="$HOME/Evergreen_Staff_Client"
29 UBUNTU_VERSION=`lsb_release -r | cut -d':' -f2 | sed 's/\t//g'`
30 DESKTOP="$HOME/Desktop"
32 EPSON_URL="https://ftp.epson.com/drivers/pos/tmx-cups-2.0.0.0.zip"
33 export DOWNLOAD_DIR="$HOME/Downloads"
34 export EPSON_ARCHIVE="tmx-cups-2.0.0.0.zip"
35 export EPSON_UNZIP_DIR="tmx-cups-2.0.0.0"
37 export PRG_NAME="Evergreen Staff Client Setup"
38 TERM_SET="-bg white -fg blue -fn 10x20"
40 zenity --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="This program will install and configure \n the Evergreen Staff Client on Ubuntu Linux."
42 GetClient () { ### Run the process to download and extract the Evergreen Staff Client.
43 wget --progress=bar:force "$CLIENT_URL_BASE/$CLIENT" 2>&1 | zenity --width=350 --title="Downloading staff client..." --progress --auto-close --auto-kill
44 mkdir -p "$CLIENT_DIR"
46 zenity --title="$PRG_NAME" --height="50" --width="350" --no-wrap --error --text="Could not change to $CLIENT_DIR."
50 xterm $TERM_SET -e "echo extracting client...; tar jxvf $WORKDIR/$CLIENT"
54 DownloadExtract() { ### Download and extract the Evergreen Staff Client.
55 if [ ! -d "$CLIENT_DIR" ]; then
58 zenity --title="$PRG_NAME" --height="50" --width="350" --no-wrap --question --text="Client Directory Exists, Would you like Setup to download and extract the client again?";RE_DOWNLOAD="$?"
59 if [ "$RE_DOWNLOAD" = "0" ]; then
67 ConfigureLubuntu() { ### Install Imagemagick and configure client desktop icon.
68 zenity --title="$PRG_NAME" --height="50" --width="350" --timeout="2" --no-wrap --info --text="Configuring for Lubuntu..."
70 if dpkg -l | grep 'imagemagick[[:blank:]]' | grep -q ii ; then
71 zenity --title="$PRG_NAME" --height="50" --width="350" --no-wrap --timeout="3" --info --text="ImageMagick is already installed"
73 xterm $TERM_SET -e "echo;echo Installing Imagemagick.;echo;echo;echo;echo Keystrokes will not be displayed when typing your password;sudo apt-get update && sudo apt-get -y install imagemagick"
76 convert $CLIENT_DIR/evergreen.ico $CLIENT_DIR/evergreen.png
78 cat <<EOF > $DESKTOP/Evergreen
82 Name=Evergreen Staff Client
83 Name[en_US]=Evergreen Staff Client
84 Icon=$CLIENT_DIR/evergreen-0.png
85 Exec=$CLIENT_DIR/evergreen
86 Comment[en_US]=Evergreen Staff Client
91 Download_Driver () { ### Prompt about driver download and open a web browser with URL of driver download.
92 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."
93 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."
94 if pgrep firefox; then
95 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"
96 while pgrep firefox; do
97 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"
100 sensible-browser $EPSON_URL
103 DownloadEpson() { ### Download and install the Epson TM-V receipt printer driver.
104 if [ -e $DOWNLOAD_DIR/$EPSON_ARCHIVE ]; then
105 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="$?"
106 if [ "$RE_DOWNLOAD_DRIVER" = "0" ]; then
107 rm "$DOWNLOAD_DIR/$EPSON_ARCHIVE"
114 if [ -e $DOWNLOAD_DIR/$EPSON_ARCHIVE ]; then
116 [ -e "$EPSON_DIR" ] && rm -rf "$EPSON_DIR"
117 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 . "
119 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."
120 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="3" --no-wrap --error --text="Exiting Setup..."
125 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="2" --no-wrap --info --text="Starting Epson installer."
126 if [ "$ARCH" = "i386" ] || [ "$ARCH" = "i686" ]; then
127 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Choose Ubuntu 14.04 (32-bit) when prompted by the installer script."
128 elif [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
129 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --no-wrap --info --text="Choose Ubuntu 14.04 (64-bit) when prompted by the installer script."
131 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 14.04 for\nyour system's architecture when prompted by the installer script"
133 chmod 755 $HOME/$EPSON_DIR/install.sh
134 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"
135 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="3" --no-wrap --info --text="Exiting Setup..."
137 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."
138 zenity --window-icon="$CLIENT_DIR/evergreen-0.png" --title="$PRG_NAME" --height="50" --width="350" --timeout="3" --no-wrap --info --text="Exiting Setup..."
145 if [ "$DE" = "Lubuntu" ]; then