UNPKG

1.93 kBapplication/x-shView Raw
1#!/usr/bin/env bash
2
3# run using: source install_gtm_only.sh
4
5# Acknowledgement: KS Bhaskar for GT.M installation logic
6
7# run as normal user, eg ubuntu
8
9if [ -d "/usr/lib/fis-gtm" ]; then
10
11 echo "GT.M appears to have already been installed - aborting"
12
13else
14
15 # Prepare
16
17 echo 'Preparing environment'
18
19 sudo apt-get update
20 sudo apt-get install -y build-essential libssl-dev
21 sudo apt-get install -y wget gzip openssh-server curl python-minimal libelf1
22
23 # GT.M
24
25 echo 'Installing GT.M'
26
27 mkdir /tmp/tmp # Create a temporary directory for the installer
28 cd /tmp/tmp # and change to it. Next command is to download the GT.M installer
29 wget https://sourceforge.net/projects/fis-gtm/files/GT.M%20Installer/v0.13/gtminstall
30 chmod +x gtminstall # Make the file executable
31
32 # Thanks to KS Bhaskar for the following enhancement:
33
34 gtmroot=/usr/lib/fis-gtm
35 gtmcurrent=$gtmroot/current
36 if [ -e "$gtmcurrent"] ; then
37 mv -v $gtmcurrent $gtmroot/previous_`date -u +%Y-%m-%d:%H:%M:%S`
38 fi
39 sudo mkdir -p $gtmcurrent # make sure directory exists for links to current GT.M
40
41 # download and install GT.M including UTF-8 mode
42 sudo -E ./gtminstall --utf8 default --verbose --linkenv $gtmcurrent --linkexec $gtmcurrent
43
44 echo 'Configuring GT.M'
45
46 gtmprof=$gtmcurrent/gtmprofile
47 gtmprofcmd="source $gtmprof"
48 $gtmprofcmd
49 tmpfile=`mktemp`
50 if [ `grep -v "$gtmprofcmd" ~/.profile | grep $gtmroot >$tmpfile`] ; then
51 echo "Warning: existing commands referencing $gtmroot in ~/.profile may interfere with setting up environment"
52 cat $tmpfile
53 fi
54
55 echo 'copying ' $gtmprofcmd ' to profile...'
56 echo $gtmprofcmd >> ~/.profile
57
58 rm $tmpfile
59 unset tmpfile gtmprofcmd gtmprof gtmcurrent gtmroot
60
61 echo 'GT.M has been installed and configured, ready for use'
62 echo 'Enter the GT.M shell by typing the command: gtm Exit it by typing the command H'
63
64 # --- End of KS Bhaskar enhancement
65
66 cd ~
67
68fi