| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. - |
| 2 | ################################################################# |
| 3 | # # |
| 4 | # Copyright (c) 2014-2021 Fidelity National Information # |
| 5 | # Services, Inc. and/or its subsidiaries. All rights reserved. # |
| 6 | # # |
| 7 | # This source code contains the intellectual property # |
| 8 | # of its copyright holder(s), and is made available # |
| 9 | # under a license. If you do not know the terms of # |
| 10 | # the license, please stop and do not read further. # |
| 11 | # # |
| 12 | ################################################################# |
| 13 | |
| 14 | # This script automates the installation of GT.M as much as possible, |
| 15 | # to the extent of attempting to download the distribution file. |
| 16 | # Current limitation is GNU/Linux on x86 (32- & 64-bit) architectures |
| 17 | # and root installation, but it is intended to relax this in the future. |
| 18 | |
| 19 | # NOTE: This script requires the GNU wget program to download |
| 20 | # distribution files that are not on the local file system. |
| 21 | |
| 22 | # Revision history |
| 23 | # |
| 24 | # 2011-02-15 0.01 K.S. Bhaskar - Initial version for internal use |
| 25 | # 2011-02-20 0.02 K.S. Bhaskar - Mostly usable with enough features for first Beta test |
| 26 | # 2011-02-21 0.03 K.S. Bhaskar - Deal with case of no group bin, bug fixes, download from FTP site, other platforms |
| 27 | # 2011-02-28 0.04 K.S. Bhaskar - Use which to get locations of id and grep, more bug fixes |
| 28 | # 2011-03-05 0.05 K.S. Bhaskar - Through V5.4-001 group only needed if execution restricted to a group |
| 29 | # 2011-03-08 0.06 K.S. Bhaskar - Make it work when bundled with GT.M V5.4-002 |
| 30 | # 2011-03-10 0.10 K.S. Bhaskar - Incorporate review comments to bundle with V5.4-002 distribution |
| 31 | # 2011-05-03 0.11 K.S. Bhaskar - Allow for letter suffix releases |
| 32 | # 2011-10-25 0.12 K.S. Bhaskar - Support option to delete .o files on shared library platforms |
| 33 | # 2014-08-13 0.13 K.S. Bhaskar - Add verbosity around getting latest version and tarball, if requested |
| 34 | # 2015-10-13 0.14 GT.M Staff - Fix a few minor bugs |
| 35 | # 2017-06-05 0.15 GT.M Staff - GT.M install script should set RemoveIPC no in systemd linux distributions |
| 36 | # 2017-09-19 0.16 GT.M Staff - Treat i686 as i586; Fix an interaction bug in gtminstall resulting from the above change |
| 37 | # 2019-07-14 0.17 GT.M Staff - Add an option (--filename) to pass the file name of GT.M distribution tarball |
| 38 | |
| 39 | # Turn on debugging if set |
| 40 | if [scip-shell system . . `[`. "Y" = "$gtm_debug" ] ; then set -x ; fi |
| 41 | |
| 42 | # Initialization |
| 43 | timestamp=`datescip-shell system . . date. +%Y%m%d%H%M%S` |
| 44 | gtm_id=`command -v id` |
| 45 | gtm_grep=`command -v grep` |
| 46 | if [scip-shell system . . `[`. -z "$USER" ] ; then USER=`$gtm_id -un` ; fi |
| 47 | |
| 48 | # Functions |
| 49 | dump_infoscip-shell shell fis-gtm 7.1-008-1 dump_info().() |
| 50 | { |
| 51 | set +x |
| 52 | if [scip-shell system . . `[`. -n "$gtm_arch" ] ; then echoscip-shell system . . echo. gtm_arch " : " $gtm_arch ; fi |
| 53 | if [scip-shell system . . `[`. -n "$gtm_buildtype" ] ; then echoscip-shell system . . echo. gtm_buildtype " : " $gtm_buildtype ; fi |
| 54 | if [scip-shell system . . `[`. -n "$gtm_configure_in" ] ; then echoscip-shell system . . echo. gtm_configure_in " : " $gtm_configure_in ; fi |
| 55 | if [scip-shell system . . `[`. -n "$gtm_copyenv" ] ; then echoscip-shell system . . echo. gtm_copyenv " : " $gtm_copyenv ; fi |
| 56 | if [scip-shell system . . `[`. -n "$gtm_copyexec" ] ; then echoscip-shell system . . echo. gtm_copyexec " : " $gtm_copyexec ; fi |
| 57 | if [scip-shell system . . `[`. -n "$gtm_debug" ] ; then echoscip-shell system . . echo. gtm_debug " : " $gtm_debug ; fi |
| 58 | if [scip-shell system . . `[`. -n "$gtm_dist" ] ; then echoscip-shell system . . echo. gtm_dist " : " $gtm_dist ; fi |
| 59 | if [scip-shell system . . `[`. -n "$gtm_distrib" ] ; then echoscip-shell system . . echo. gtm_distrib " : " $gtm_distrib ; fi |
| 60 | if [scip-shell system . . `[`. -n "$gtm_dryrun" ] ; then echoscip-shell system . . echo. gtm_dryrun " : " $gtm_dryrun ; fi |
| 61 | if [scip-shell system . . `[`. -n "$gtm_filename" ] ; then echoscip-shell system . . echo. gtm_filename " : " $gtm_filename ; fi |
| 62 | if [scip-shell system . . `[`. -n "$gtm_flavor" ] ; then echoscip-shell system . . echo. gtm_flavor " : " $gtm_flavor ; fi |
| 63 | if [scip-shell system . . `[`. -n "$gtm_ftp_dirname" ] ; then echoscip-shell system . . echo. gtm_ftp_dirname " : " $gtm_ftp_dirname ; fi |
| 64 | if [scip-shell system . . `[`. -n "$gtm_group" ] ; then echoscip-shell system . . echo. gtm_group " : " $gtm_group ; fi |
| 65 | if [scip-shell system . . `[`. -n "$gtm_group_already" ] ; then echoscip-shell system . . echo. gtm_group_already " : " $gtm_group_already ; fi |
| 66 | if [scip-shell system . . `[`. -n "$gtm_group_restriction" ] ; then echoscip-shell system . . echo. gtm_group_restriction " : " $gtm_group_restriction ; fi |
| 67 | if [scip-shell system . . `[`. -n "$gtm_hostos" ] ; then echoscip-shell system . . echo. gtm_hostos " : " $gtm_hostos ; fi |
| 68 | if [scip-shell system . . `[`. -n "$gtm_install_utf8" ] ; then echoscip-shell system . . echo. gtm_install_utf8 " : " $gtm_install_utf8 ; fi |
| 69 | if [scip-shell system . . `[`. -n "$gtm_install_flavor" ] ; then echoscip-shell system . . echo. gtm_install_flavor " : " $gtm_install_flavor ; fi |
| 70 | if [scip-shell system . . `[`. -n "$gtm_installdir" ] ; then echoscip-shell system . . echo. gtm_installdir " : " $gtm_installdir ; fi |
| 71 | if [scip-shell system . . `[`. -n "$gtm_keep_obj" ] ; then echoscip-shell system . . echo. gtm_keep_obj " : " $gtm_keep_obj ; fi |
| 72 | if [scip-shell system . . `[`. -n "$gtm_lcase_utils" ] ; then echoscip-shell system . . echo. gtm_lcase_utils " : " $gtm_lcase_utils ; fi |
| 73 | if [scip-shell system . . `[`. -n "$gtm_linkenv" ] ; then echoscip-shell system . . echo. gtm_linkenv " : " $gtm_linkenv ; fi |
| 74 | if [scip-shell system . . `[`. -n "$gtm_linkexec" ] ; then echoscip-shell system . . echo. gtm_linkexec " : " $gtm_linkexec ; fi |
| 75 | if [scip-shell system . . `[`. -n "$gtm_overwrite_existing" ] ; then echoscip-shell system . . echo. gtm_overwrite_existing " : " $gtm_overwrite_existing ; fi |
| 76 | if [scip-shell system . . `[`. -n "$gtm_prompt_for_group" ] ; then echoscip-shell system . . echo. gtm_prompt_for_group " : " $gtm_prompt_for_group ; fi |
| 77 | if [scip-shell system . . `[`. -n "$gtm_prompt_for_sys_reconfig" ] ; then echoscip-shell system . . echo. gtm_prompt_for_sys_reconfig " : " $gtm_prompt_for_sys_reconfig ; fi |
| 78 | if [scip-shell system . . `[`. -n "$gtm_sf_dirname" ] ; then echoscip-shell system . . echo. gtm_sf_dirname " : " $gtm_sf_dirname ; fi |
| 79 | if [scip-shell system . . `[`. -n "$gtm_tmp" ] ; then echoscip-shell system . . echo. gtm_tmp " : " $gtm_tmp ; fi |
| 80 | if [scip-shell system . . `[`. -n "$gtm_user" ] ; then echoscip-shell system . . echo. gtm_user " : " $gtm_user ; fi |
| 81 | if [scip-shell system . . `[`. -n "$gtm_verbose" ] ; then echoscip-shell system . . echo. gtm_verbose " : " $gtm_verbose ; fi |
| 82 | if [scip-shell system . . `[`. -n "$gtm_version" ] ; then echoscip-shell system . . echo. gtm_version " : " $gtm_version ; fi |
| 83 | if [scip-shell system . . `[`. -n "$gtmroutines" ] ; then echoscip-shell system . . echo. gtmroutines " : " $gtmroutines ; fi |
| 84 | if [scip-shell system . . `[`. -n "$timestamp" ] ; then echoscip-shell system . . echo. timestamp " : " $timestamp ; fi |
| 85 | if [scip-shell system . . `[`. "Y" = "$gtm_debug" ] ; then set -x ; fi |
| 86 | } |
| 87 | |
| 88 | err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit().() |
| 89 | { |
| 90 | set +x |
| 91 | echoscip-shell system . . echo. "gtminstall [option] ... [version]" |
| 92 | echoscip-shell system . . echo. "Options are:" |
| 93 | echoscip-shell system . . echo. "--build-type buildtype - * type of GT.M build, default is pro" |
| 94 | echoscip-shell system . . echo. "--copyenv dirname - copy gtmprofile and gtmcshrc files to dirname; incompatible with linkenv" |
| 95 | echoscip-shell system . . echo. "--copyexec dirname - copy gtm script to dirname; incompatible with linkexec" |
| 96 | echoscip-shell system . . echo. "--debug - * turn on debugging with set -x" |
| 97 | echoscip-shell system . . echo. "--distrib dirname or URL - source directory for GT.M distribution tarball, local or remote" |
| 98 | echoscip-shell system . . echo. "--filename filename - name of GT.M distribution tarball" |
| 99 | echoscip-shell system . . echo. "--dry-run - do everything short of installing GT.M, including downloading the distribution" |
| 100 | echoscip-shell system . . echo. "--group group - group that should own the GT.M installation" |
| 101 | echoscip-shell system . . echo. "--group-restriction - limit execution to a group; defaults to unlimited if not specified" |
| 102 | echoscip-shell system . . echo. "--help - print this usage information" |
| 103 | echoscip-shell system . . echo. "--installdir dirname - directory where GT.M is to be installed; defaults to /usr/lib/fis-gtm/version_platform" |
| 104 | m1="--keep-obj - keep .o files" |
| 105 | m1="$m1"" of M routines (normally deleted on platforms with GT.M support for routines in shared libraries)" |
| 106 | echoscip-shell system . . echo. "$m1" |
| 107 | echoscip-shell system . . echo. "--linkenv dirname - create link in dirname to gtmprofile and gtmcshrc files; incompatible with copyenv" |
| 108 | echoscip-shell system . . echo. "--linkexec dirname - create link in dirname to gtm script; incompatible with copyexec" |
| 109 | echoscip-shell system . . echo. "--noprompt-for-sys-cfg - do not prompt to adjust OS configuration files" |
| 110 | echoscip-shell system . . echo. "--overwrite-existing - install into an existing directory, overwriting contents; defaults to requiring new directory" |
| 111 | m1="--prompt-for-group - * GT.M installation " |
| 112 | m1="$m1""script will prompt for group; default is yes for production releases V5.4-002 or later, no for all others" |
| 113 | echoscip-shell system . . echo. "$m1" |
| 114 | echoscip-shell system . . echo. "--ucaseonly-utils -- install only upper case utility program names; defaults to both if not specified" |
| 115 | echoscip-shell system . . echo. "--user username - user who should own GT.M installation; default is root" |
| 116 | echoscip-shell system . . echo. "--utf8 - install UTF-8 support" |
| 117 | echoscip-shell system . . echo. "--verbose - * output diagnostic information as the script executes; default is to run quietly" |
| 118 | echoscip-shell system . . echo. "options that take a value (e.g, --group) can be specified as either --option=value or --option value" |
| 119 | echoscip-shell system . . echo. "options marked with * are likely to be of interest primarily to GT.M developers" |
| 120 | echoscip-shell system . . echo. "version is defaulted from mumps file if one exists in the same directory as the installer" |
| 121 | echoscip-shell system . . echo. "This version must run as root." |
| 122 | exit 1 |
| 123 | } |
| 124 | |
| 125 | mktmpdirscip-shell shell fis-gtm 7.1-008-1 mktmpdir().() |
| 126 | { |
| 127 | tmpdirname="/tmp/gtminstall_${timestamp}" |
| 128 | mkdirscip-shell system . . mkdir. $tmpdirname |
| 129 | mkdirstatus=$? |
| 130 | while [scip-shell system . . `[`. 0 -ne $mkdirstatus ] ; do |
| 131 | let i++ |
| 132 | tmpdirname="/tmp/gtminstall_${timestamp}_$i" |
| 133 | mkdirscip-shell system . . mkdir. $tmpdirname |
| 134 | mkdirstatus=$? |
| 135 | |
| 136 | done |
| 137 | echoscip-shell system . . echo. $tmpdirname |
| 138 | } |
| 139 | |
| 140 | read_yes_noscip-shell shell fis-gtm 7.1-008-1 read_yes_no().() |
| 141 | { |
| 142 | read resp |
| 143 | response=`echoscip-shell system . . echo. $resp | trscip-shell system . . tr. '[a-z]' '[A-Z]'` |
| 144 | if [scip-shell system . . `[`. "Y" = "$response" -o "YES" = "$response" ] ; then |
| 145 | echoscip-shell system . . echo. "yes" |
| 146 | else |
| 147 | echoscip-shell system . . echo. "no" |
| 148 | fi |
| 149 | } |
| 150 | |
| 151 | # Defaults that can be over-ridden by command line options to follow |
| 152 | if [scip-shell system . . `[`. -z "$gtm_buildtype" ] ; then gtm_buildtype="pro" ; fi |
| 153 | if [scip-shell system . . `[`. -z "$gtm_keep_obj" ] ; then gtm_keep_obj="N" ; fi |
| 154 | if [scip-shell system . . `[`. -z "$gtm_dryrun" ] ; then gtm_dryrun="N" ; fi |
| 155 | if [scip-shell system . . `[`. -z "$gtm_group_restriction" ] ; then gtm_group_restriction="N" ; fi |
| 156 | if [scip-shell system . . `[`. -z "$gtm_lcase_utils" ] ; then gtm_lcase_utils="Y" ; fi |
| 157 | if [scip-shell system . . `[`. -z "$gtm_overwrite_existing" ] ; then gtm_overwrite_existing="N" ; fi |
| 158 | if [scip-shell system . . `[`. -z "$gtm_prompt_for_group" ] ; then gtm_prompt_for_group="N" ; fi |
| 159 | if [scip-shell system . . `[`. -z "$gtm_prompt_for_sys_reconfig" ] ; then gtm_prompt_for_sys_reconfig="Y" ; fi |
| 160 | if [scip-shell system . . `[`. -z "$gtm_verbose" ] ; then gtm_verbose="N" ; fi |
| 161 | |
| 162 | # Initializing internal flags |
| 163 | gtm_group_already="N" |
| 164 | |
| 165 | # Process command line |
| 166 | while [scip-shell system . . `[`. $# -gt 0 ] ; do |
| 167 | case "$1" in |
| 168 | --build-type*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 169 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_buildtype=$tmp |
| 170 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_buildtype=$2 ; shift |
| 171 | else echoscip-shell system . . echo. "--buildtype needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 172 | fi |
| 173 | fi |
| 174 | shift ;; |
| 175 | --copyenv*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 176 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_copyenv=$tmp |
| 177 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_copyenv=$2 ; shift |
| 178 | else echoscip-shell system . . echo. "--copyenv needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 179 | fi |
| 180 | fi |
| 181 | unset gtm_linkenv |
| 182 | shift ;; |
| 183 | --copyexec*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 184 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_copyexec=$tmp |
| 185 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_copyexec=$2 ; shift |
| 186 | else echoscip-shell system . . echo. "--copyexec needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 187 | fi |
| 188 | fi |
| 189 | unset gtm_linkexec |
| 190 | shift ;; |
| 191 | --debug) gtm_debug="Y" ; set -x ; shift ;; |
| 192 | --distrib*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 193 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_distrib=$tmp |
| 194 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_distrib=$2 ; shift |
| 195 | else echoscip-shell system . . echo. "--distrib needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 196 | fi |
| 197 | fi |
| 198 | shift ;; |
| 199 | --filename) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 200 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_filename=$tmp |
| 201 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_filename=$2 ; shift |
| 202 | else echoscip-shell system . . echo. "--filename needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 203 | fi |
| 204 | fi |
| 205 | shift ;; |
| 206 | --dry-run) gtm_dryrun="Y" ; shift ;; |
| 207 | --group-restriction) gtm_group_restriction="Y" ; shift ;; # must come before group* |
| 208 | --group*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 209 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_group=$tmp |
| 210 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_group=$2 ; shift |
| 211 | else echoscip-shell system . . echo. "--group needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 212 | fi |
| 213 | fi |
| 214 | shift ;; |
| 215 | --help) err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). ;; |
| 216 | --installdir*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 217 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_installdir=$tmp |
| 218 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_installdir=$2 ; shift |
| 219 | else echoscip-shell system . . echo. "--installdir needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 220 | fi |
| 221 | fi |
| 222 | shift ;; |
| 223 | --keep-obj) gtm_keep_obj="Y" ; shift ;; |
| 224 | --linkenv*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 225 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_linkenv=$tmp |
| 226 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_linkenv=$2 ; shift |
| 227 | else echoscip-shell system . . echo. "--linkenv needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 228 | fi |
| 229 | fi |
| 230 | unset gtm_copyenv |
| 231 | shift ;; |
| 232 | --linkexec*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 233 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_linkexec=$tmp |
| 234 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_linkexec=$2 ; shift |
| 235 | else echoscip-shell system . . echo. "--linkexec needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 236 | fi |
| 237 | fi |
| 238 | unset gtm_copyexec |
| 239 | shift ;; |
| 240 | --noprompt-for-sys-cfg) gtm_prompt_for_sys_reconfig="N" ; shift ;; |
| 241 | --overwrite-existing) gtm_overwrite_existing="Y" ; shift ;; |
| 242 | --prompt-for-group) gtm_prompt_for_group="Y" ; shift ;; |
| 243 | --ucaseonly-utils) gtm_lcase_utils="N" ; shift ;; |
| 244 | --user*) tmp=`echoscip-shell system . . echo. $1 | cutscip-shell system . . cut. -s -d = -f 2-` |
| 245 | if [scip-shell system . . `[`. -n "$tmp" ] ; then gtm_user=$tmp |
| 246 | else if [scip-shell system . . `[`. 1 -lt "$#" ] ; then gtm_user=$2 ; shift |
| 247 | else echoscip-shell system . . echo. "--user needs a value" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 248 | fi |
| 249 | fi |
| 250 | shift ;; |
| 251 | --utf8*) gtm_install_utf8="Y" ; shift ;; |
| 252 | --verbose) gtm_verbose="Y" ; shift ;; |
| 253 | -*) echoscip-shell system . . echo. Unrecognized option "$1" ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). ;; |
| 254 | *) if [scip-shell system . . `[`. -n "$gtm_version" ] ; then echoscip-shell system . . echo. Nothing must follow the GT.M version ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 255 | else gtm_version=$1 ; shift ; fi |
| 256 | esac |
| 257 | done |
| 258 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Processed command line ; dump_infoscip-shell shell fis-gtm 7.1-008-1 dump_info(). ; fi |
| 259 | |
| 260 | # Set environment variables according to machine architecture |
| 261 | gtm_arch=`unamescip-shell system . . uname. -m | trscip-shell system . . tr. -d _` |
| 262 | case $gtm_arch in |
| 263 | sun*) gtm_arch="sparc" ;; |
| 264 | esac |
| 265 | gtm_hostos=`unamescip-shell system . . uname. -s | trscip-shell system . . tr. A-Z a-z` |
| 266 | case $gtm_hostos in |
| 267 | gnu/linux) gtm_hostos="linux" ;; |
| 268 | hp-ux) gtm_hostos="hpux" ;; |
| 269 | sun*) gtm_hostos="solaris" ;; |
| 270 | esac |
| 271 | gtm_shlib_support="Y" |
| 272 | case ${gtm_hostos}_${gtm_arch} in |
| 273 | aix*) # no Source Forge dirname |
| 274 | gtm_arch="rs6000" # uname -m is not useful on AIX |
| 275 | gtm_ftp_dirname="aix" |
| 276 | gtm_flavor="rs6000" |
| 277 | gtm_install_flavor="RS6000" ;; |
| 278 | hpux_ia64) # no Source Forge dirname |
| 279 | gtm_ftp_dirname="hpux_ia64" |
| 280 | gtm_flavor="ia64" |
| 281 | gtm_install_flavor="IA64" ;; |
| 282 | linux_i586) gtm_sf_dirname="GT.M-x86-Linux" |
| 283 | gtm_ftp_dirname="linux" |
| 284 | gtm_flavor="i586" |
| 285 | gtm_install_flavor="x86" |
| 286 | gtm_shlib_support="N" ;; |
| 287 | linux_i686) gtm_sf_dirname="GT.M-x86-Linux" |
| 288 | gtm_ftp_dirname="linux" |
| 289 | gtm_flavor="i586" |
| 290 | gtm_install_flavor="x86" |
| 291 | gtm_shlib_support="N" ;; |
| 292 | linux_ia64) # no Source Forge dirname |
| 293 | gtm_ftp_dirname="linux_ia64" |
| 294 | gtm_flavor="ia64" |
| 295 | gtm_install_flavor="IA" ;; |
| 296 | linux_s390x) # no Source Forge dirname |
| 297 | gtm_ftp_dirname="linux_s390x" |
| 298 | gtm_flavor="s390x" |
| 299 | gtm_install_flavor="S390X" ;; |
| 300 | linux_x8664) gtm_sf_dirname="GT.M-amd64-Linux" |
| 301 | gtm_ftp_dirname="linux_x8664" |
| 302 | gtm_flavor="x8664" |
| 303 | gtm_install_flavor="x86_64" ;; |
| 304 | solaris_sparc) # no Source Forge dirname |
| 305 | gtm_ftp_dirname="sun" |
| 306 | gtm_flavor="sparc" |
| 307 | gtm_install_flavor="SPARC" ;; |
| 308 | default) echoscip-shell system . . echo. Architecture `unamescip-shell system . . uname. -o` on `unamescip-shell system . . uname. -m` not supported by this script ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). ;; |
| 309 | esac |
| 310 | |
| 311 | # GT.M version is required - first see if gtminstall and mumps are bundled |
| 312 | if [scip-shell system . . `[`. -z "$gtm_version" ] ; then |
| 313 | tmp=`dirnamescip-shell system . . dirname. $0` |
| 314 | if [scip-shell system . . `[`. -e "$tmp/mumps" -a -e "$tmp/_XCMD.m" ] ; then |
| 315 | gtm_distrib=$tmp |
| 316 | gtm_dist=$tmp ; export gtm_dist |
| 317 | chmodscip-shell system . . chmod. +x $gtm_dist/mumps |
| 318 | tmp=`mktmpdirscip-shell shell fis-gtm 7.1-008-1 mktmpdir().` |
| 319 | gtmroutines="$tmp($gtm_dist)" ; export gtmroutines |
| 320 | gtm_version=`$gtm_dist/mumps -run %XCMD 'write $piece($zversion," ",2)'` |
| 321 | rmscip-shell system . . rm. -rf $tmp |
| 322 | fi |
| 323 | fi |
| 324 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then |
| 325 | echoscip-shell system . . echo. Determined architecture, OS and GT.M version ; dump_infoscip-shell shell fis-gtm 7.1-008-1 dump_info(). |
| 326 | wget_flags="-P" |
| 327 | else wget_flags="-qP" |
| 328 | fi |
| 329 | |
| 330 | # See if GT.M version can be determined from meta data |
| 331 | if [scip-shell system . . `[`. -z "$gtm_distrib" ] ; then |
| 332 | gtm_distrib=http://sourceforge.net/projects/fis-gtm |
| 333 | fi |
| 334 | gtm_tmp=`mktmpdirscip-shell shell fis-gtm 7.1-008-1 mktmpdir().` |
| 335 | mkdirscip-shell system . . mkdir. $gtm_tmp/tmp |
| 336 | if [scip-shell system . . `[`. -z "$gtm_version" -o "latest" = "`echoscip-shell system . . echo. "$gtm_version" | trscip-shell system . . tr. LATES lates`" ] ; then |
| 337 | case $gtm_distrib in |
| 338 | http://sourceforge.net/projects/fis-gtm | https://sourceforge.net/projects/fis-gtm) |
| 339 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then |
| 340 | echoscip-shell system . . echo. wget ${gtm_distrib}/files/${gtm_sf_dirname}/latest to determine latest version |
| 341 | echoscip-shell system . . echo. Check proxy settings if wget hangs |
| 342 | fi |
| 343 | if { wget $wget_flags $gtm_tmp ${gtm_distrib}/files/${gtm_sf_dirname}/latest 2>&1 1>${gtm_tmp}/wget_latest.log ; } ; then |
| 344 | gtm_version=`catscip-shell system . . cat. ${gtm_tmp}/latest` |
| 345 | else echoscip-shell system . . echo. Unable to determine GT.M version ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 346 | fi ;; |
| 347 | ftp://*) |
| 348 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then |
| 349 | echoscip-shell system . . echo. wget $gtm_tmp ${gtm_distrib}/${gtm_ftp_dirname}/latest to determine latest version |
| 350 | echoscip-shell system . . echo. Check proxy settings if wget hangs |
| 351 | fi |
| 352 | if { wget $wget_flags $gtm_tmp ${gtm_distrib}/${gtm_ftp_dirname}/latest 2>&1 1>${gtm_tmp}/wget_latest.log ; } ; then |
| 353 | gtm_version=`catscip-shell system . . cat. ${gtm_tmp}/latest` |
| 354 | else echoscip-shell system . . echo. Unable to determine GT.M version ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 355 | fi ;; |
| 356 | *) |
| 357 | if [scip-shell system . . `[`. -f ${gtm_distrib}/latest ] ; then |
| 358 | gtm_version=`catscip-shell system . . cat. ${gtm_distrib}/latest` |
| 359 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Version is $gtm_version ; fi |
| 360 | else echoscip-shell system . . echo. Unable to determine GT.M version ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 361 | fi ;; |
| 362 | esac |
| 363 | fi |
| 364 | if [scip-shell system . . `[`. -z "$gtm_version" ] ; then |
| 365 | echoscip-shell system . . echo. GT.M version to install is required ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 366 | fi |
| 367 | |
| 368 | # Get GT.M distribution if gtminstall is not bundled with distribution |
| 369 | if [scip-shell system . . `[`. -f "${gtm_distrib}/mumps" ] ; then gtm_tmp=$gtm_distrib |
| 370 | else |
| 371 | tmp=`echoscip-shell system . . echo. $gtm_version | trscip-shell system . . tr. -d .-` |
| 372 | if [scip-shell system . . `[`. -z "$gtm_filename" ] ; then |
| 373 | gtm_filename=gtm_${tmp}_${gtm_hostos}_${gtm_flavor}_${gtm_buildtype}.tar.gz |
| 374 | fi |
| 375 | case $gtm_distrib in |
| 376 | http://sourceforge.net/projects/fis-gtm | https://sourceforge.net/projects/fis-gtm) |
| 377 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then |
| 378 | echoscip-shell system . . echo. wget ${gtm_distrib}/files/${gtm_sf_dirname}/${gtm_version}/${gtm_filename} to download tarball |
| 379 | echoscip-shell system . . echo. Check proxy settings if wget hangs |
| 380 | fi |
| 381 | if { ! wget $wget_flags $gtm_tmp ${gtm_distrib}/files/${gtm_sf_dirname}/${gtm_version}/${gtm_filename} \ |
| 382 | 2>&1 1>${gtm_tmp}/wget_dist.log ; } ; then |
| 383 | echoscip-shell system . . echo. Unable to download GT.M distribution $gtm_filename ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 384 | fi ;; |
| 385 | ftp://*) |
| 386 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then |
| 387 | echoscip-shell system . . echo. wget ${gtm_distrib}/${gtm_ftp_dirname}/${tmp}/${gtm_filename} to download tarball |
| 388 | echoscip-shell system . . echo. Check proxy settings if wget hangs |
| 389 | fi |
| 390 | if { ! wget $wget_flags $gtm_tmp ${gtm_distrib}/${gtm_ftp_dirname}/${tmp}/${gtm_filename} \ |
| 391 | 2>&1 1>${gtm_tmp}/wget_dist.log ; } ; then |
| 392 | echoscip-shell system . . echo. Unable to download GT.M distribution $gtm_filename ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 393 | fi ;; |
| 394 | *) |
| 395 | if [scip-shell system . . `[`. -f ${gtm_distrib}/${gtm_filename} ] ; then |
| 396 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. tarball is ${gtm_distrib}/${gtm_filename} ; fi |
| 397 | lnscip-shell system . . ln. -s ${gtm_distrib}/${gtm_filename} $gtm_tmp |
| 398 | else echoscip-shell system . . echo. Unable to locate GT.M distribution file ${gtm_distrib}/${gtm_filename} ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 399 | fi ;; |
| 400 | esac |
| 401 | ( cd $gtm_tmp/tmp ; gzipscip-shell system . . gzip. -d < ${gtm_tmp}/${gtm_filename} | tarscip-shell system . . tar. xf - 2>&1 1>${gtm_tmp}/tar.log ) |
| 402 | fi |
| 403 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Downloaded and unpacked GT.M distribution ; dump_infoscip-shell shell fis-gtm 7.1-008-1 dump_info(). ; fi |
| 404 | |
| 405 | # Check installation settings & provide defaults as needed |
| 406 | tmp=`$gtm_id -un` |
| 407 | if [scip-shell system . . `[`. -z "$gtm_user" ] ; then gtm_user=$tmp |
| 408 | else if [scip-shell system . . `[`. "$gtm_user" != "`$gtm_id -un $gtm_user`" ] ; then |
| 409 | echoscip-shell system . . echo. $gtm_user is a non-existent user ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 410 | fi |
| 411 | fi |
| 412 | if [scip-shell system . . `[`. "root" = $tmp ] ; then |
| 413 | if [scip-shell system . . `[`. -z "$gtm_group" ] ; then gtm_group=`$gtm_id -gn` |
| 414 | else if [scip-shell system . . `[`. "root" != "$gtm_user" -a "$gtm_group" != "`$gtm_id -Gn $gtm_user | xargsscip-shell system . . xargs. -n 1 | $gtm_grep $gtm_group`" ] ; then |
| 415 | echoscip-shell system . . echo. $gtm_user is not a member of $gtm_group ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 416 | fi |
| 417 | fi |
| 418 | else |
| 419 | echoscip-shell system . . echo. Non-root installations not currently supported |
| 420 | if [scip-shell system . . `[`. "N" = "$gtm_dryrun" ] ; then err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 421 | else echoscip-shell system . . echo. "Continuing because --dry-run selected" |
| 422 | fi |
| 423 | fi |
| 424 | if [scip-shell system . . `[`. -z "$gtm_installdir" ] ; then gtm_installdir=/usr/lib/fis-gtm/${gtm_version}_${gtm_install_flavor} ; fi |
| 425 | if [scip-shell system . . `[`. -d "$gtm_installdir" -a "Y" != "$gtm_overwrite_existing" ] ; then |
| 426 | echoscip-shell system . . echo. $gtm_installdir exists and --overwrite-existing not specified ; err_exitscip-shell shell fis-gtm 7.1-008-1 err_exit(). |
| 427 | fi |
| 428 | |
| 429 | issystemd=`command -v systemctl` |
| 430 | if [scip-shell system . . `[`. -n "$issystemd" ] ; then |
| 431 | # It is a systemd installation |
| 432 | logindconf="/etc/systemd/logind.confscip-shell filesystem . . `/etc/systemd/logind.conf`." |
| 433 | removeipcopt=`awkscip-shell system . . awk. -F = '/^RemoveIPC/ {opt=$2} END{print opt}scip-shell filesystem . . `/^RemoveIPC/ {opt=$2} END{print opt}`.' $logindconf` |
| 434 | if [scip-shell system . . `[`. "no" != "$removeipcopt" ] ; then |
| 435 | # RemoveIPC=no is NOT the final settings in the file |
| 436 | ipcissue1="If RemoveIPC=yes is configured for systemd, ipcs (database shm & sem)" |
| 437 | ipcissue1="$ipcissue1 are removed for a non-system user's processes when that user logs out." |
| 438 | ipcissue2="That can cause database operations to fail with mysterious errors." |
| 439 | |
| 440 | ipcline1="# GT.M : Override systemd default of RemoveIPC=yes to prevent automatic ipc removal of" |
| 441 | ipcline1="$ipcline1 Shared Memory Segments and Semaphore Arrays of orphaned databases" |
| 442 | ipcline2="RemoveIPC=no" |
| 443 | ipccmd="systemctl restart systemd-logind" |
| 444 | |
| 445 | echoscip-shell system . . echo. "$ipcissue1" |
| 446 | echoscip-shell system . . echo. "$ipcissue2" |
| 447 | echoscip-shell system . . echo. "The installation would like to add the below two lines to $logindconf" |
| 448 | echoscip-shell system . . echo. " $ipcline1" |
| 449 | echoscip-shell system . . echo. " $ipcline2" |
| 450 | echoscip-shell system . . echo. "And issue the below command to restart systemd-logind" |
| 451 | echoscip-shell system . . echo. " $ipccmd" |
| 452 | if [scip-shell system . . `[`. "N" != "$gtm_prompt_for_sys_reconfig" ]; then |
| 453 | echoscip-shell system . . echo. -n "Do you wish to proceed (Y/N)? " |
| 454 | answer=`read_yes_noscip-shell shell fis-gtm 7.1-008-1 read_yes_no().` |
| 455 | if [scip-shell system . . `[`. "yes" != "$answer" ] ; then |
| 456 | echoscip-shell system . . echo. "Will abort installation" |
| 457 | echoscip-shell system . . echo. $ipcissue1 |
| 458 | echoscip-shell system . . echo. $ipcissue2 |
| 459 | echoscip-shell system . . echo. "Please add the below two lines to $logindconf" |
| 460 | echoscip-shell system . . echo. " $ipcline1" |
| 461 | echoscip-shell system . . echo. " $ipcline2" |
| 462 | echoscip-shell system . . echo. "and restart systemd-logind using the below command, for example or by rebooting the system" |
| 463 | echoscip-shell system . . echo. " $ipccmd" |
| 464 | echoscip-shell system . . echo. "and retry GT.M installation" |
| 465 | exit 1 |
| 466 | fi |
| 467 | echoscip-shell system . . echo. $ipcline1 >> $logindconf |
| 468 | echoscip-shell system . . echo. $ipcline2 >> $logindconf |
| 469 | $ipccmd |
| 470 | else |
| 471 | echoscip-shell system . . echo. "===============================================================" |
| 472 | echoscip-shell system . . echo. "Installation directed to not change systemd configuration files" |
| 473 | echoscip-shell system . . echo. "===============================================================" |
| 474 | fi |
| 475 | fi |
| 476 | fi |
| 477 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Finished checking options and assigning defaults ; dump_infoscip-shell shell fis-gtm 7.1-008-1 dump_info(). ; fi |
| 478 | |
| 479 | # Prepare input to GT.M configure script |
| 480 | gtm_configure_in=${gtm_tmp}/configure_${timestamp}.in |
| 481 | if { ! $gtm_id -gn bin 2>/dev/nullscip-shell filesystem . . `/dev/null`. 1>/dev/nullscip-shell filesystem . . `/dev/null`. ; } then |
| 482 | if [scip-shell system . . `[`. "N" = "$gtm_prompt_for_group" -o 54002 -gt `echoscip-shell system . . echo. $gtm_version | cutscip-shell system . . cut. -s -d V -f 2- | trscip-shell system . . tr. -d A-Za-z.-` ] ; then |
| 483 | echoscip-shell system . . echo. y >>$gtm_configure_in |
| 484 | echoscip-shell system . . echo. root >>$gtm_configure_in |
| 485 | echoscip-shell system . . echo. $gtm_group_restriction >>$gtm_configure_in |
| 486 | gtm_group_already="Y" |
| 487 | fi |
| 488 | fi |
| 489 | echoscip-shell system . . echo. $gtm_user >>$gtm_configure_in |
| 490 | if [scip-shell system . . `[`. "Y" = "$gtm_prompt_for_group" -o 54002 -le `echoscip-shell system . . echo. $gtm_version | cutscip-shell system . . cut. -s -d V -f 2- | trscip-shell system . . tr. -d A-Za-z.-` ] ; then |
| 491 | echoscip-shell system . . echo. $gtm_group >>$gtm_configure_in |
| 492 | fi |
| 493 | if [scip-shell system . . `[`. "N" = "$gtm_group_already" ] ; then |
| 494 | echoscip-shell system . . echo. $gtm_group_restriction >>$gtm_configure_in |
| 495 | fi |
| 496 | echoscip-shell system . . echo. $gtm_installdir >>$gtm_configure_in |
| 497 | echoscip-shell system . . echo. y >>$gtm_configure_in |
| 498 | if [scip-shell system . . `[`. -z "$gtm_install_utf8" ] ; then echoscip-shell system . . echo. n >>$gtm_configure_in |
| 499 | else echoscip-shell system . . echo. y >>$gtm_configure_in |
| 500 | fi |
| 501 | echoscip-shell system . . echo. $gtm_lcase_utils >>$gtm_configure_in |
| 502 | if [scip-shell system . . `[`. "Y" = $gtm_shlib_support ] ; then echoscip-shell system . . echo. $gtm_keep_obj >>$gtm_configure_in ; fi |
| 503 | echoscip-shell system . . echo. y >>$gtm_configure_in |
| 504 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Prepared configuration file ; catscip-shell system . . cat. $gtm_configure_in ; dump_infoscip-shell shell fis-gtm 7.1-008-1 dump_info(). ; fi |
| 505 | |
| 506 | |
| 507 | # Run the GT.M configure script |
| 508 | if [scip-shell system . . `[`. "$gtm_distrib" != "$gtm_tmp" ] ; then |
| 509 | chmodscip-shell system . . chmod. +w $gtm_tmp/tmp |
| 510 | cd $gtm_tmp/tmp |
| 511 | fi |
| 512 | tmp=`headscip-shell system . . head. -1 configure | cutscip-shell system . . cut. -f 1` |
| 513 | if [scip-shell system . . `[`. "#!/bin/sh" != "$tmp" ] ; then |
| 514 | echoscip-shell system . . echo. "#!/bin/sh" >configure.sh |
| 515 | fi |
| 516 | catscip-shell system . . cat. configure >>configure.sh |
| 517 | chmodscip-shell system . . chmod. +x configure.sh |
| 518 | |
| 519 | # Stop here if this is a dry run |
| 520 | if [scip-shell system . . `[`. "Y" = "$gtm_dryrun" ] ; then echoscip-shell system . . echo. Installation prepared in $gtm_tmp ; exit ; fi |
| 521 | |
| 522 | ./configure.sh <$gtm_configure_in 1> $gtm_tmp/configure_${timestamp}.out 2>$gtm_tmp/configure_${timestamp}.err |
| 523 | if [scip-shell system . . `[`. $? -gt 0 ] ; then catscip-shell system . . cat. $gtm_tmp/configure_${timestamp}.out $gtm_tmp/configure_${timestamp}.err ; fi |
| 524 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Installation complete ; lsscip-shell system . . ls. -l $gtm_installdir ; fi |
| 525 | |
| 526 | # Create copies of environment scripts and gtm executable |
| 527 | if [scip-shell system . . `[`. -d "$gtm_linkenv" ] ; then |
| 528 | ( cd $gtm_linkenv ; lnscip-shell system . . ln. -s $gtm_installdir/gtmprofile $gtm_installdir/gtmcshrc ./ ) |
| 529 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Linked env ; lsscip-shell system . . ls. -l $gtm_linkenv ; fi |
| 530 | else if [scip-shell system . . `[`. -d "$gtm_copyenv" ] ; then |
| 531 | ( cd $gtm_copyenv ; cpscip-shell system . . cp. $gtm_installdir/gtmprofile $gtm_installdir/gtmcshrc ./ ) |
| 532 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Copied env ; lsscip-shell system . . ls. -l $gtm_copyenv ; fi |
| 533 | fi |
| 534 | fi |
| 535 | if [scip-shell system . . `[`. -d "$gtm_linkexec" ] ; then |
| 536 | ( cd $gtm_linkexec ; lnscip-shell system . . ln. -s $gtm_installdir/gtm ./ ) |
| 537 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Linked exec ; lsscip-shell system . . ls. -l $gtm_linkexec ; fi |
| 538 | else if [scip-shell system . . `[`. -d "$gtm_copyexec" ] ; then |
| 539 | ( cd $gtm_copyexec ; cpscip-shell system . . cp. $gtm_installdir/gtm ./ ) |
| 540 | if [scip-shell system . . `[`. "Y" = "$gtm_verbose" ] ; then echoscip-shell system . . echo. Copied exec ; lsscip-shell system . . ls. -l $gtm_copyexec ; fi |
| 541 | fi |
| 542 | fi |