File: kitstart.csh

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (615 lines) | stat: -rwxr-xr-x 20,384 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
#!/usr/local/bin/tcsh
#################################################################
#								#
# Copyright (c) 2011-2023 Fidelity National Information		#
# Services, Inc. and/or its subsidiaries. All rights reserved.	#
#								#
#	This source code contains the intellectual property	#
#	of its copyright holder(s), and is made available	#
#	under a license.  If you do not know the terms of	#
#	the license, please stop and do not read further.	#
#								#
#################################################################
# kitstart.csh creates distribution kits for pro and dbg and bta.
# In order to test any configure.csh changes, copy a modified version into /usr/library/Vxxx/pro/configure
# and /usr/library/Vxxx/dbg/configure.  Then execute $gtm_tools/kitstart.csh -ti Vxxx and check output log.
# If changes are made to the configure script, such as removing files or changing permissions in the install
# directory there may need to be changes made to files used by kitstart.csh to execute
# $gtm_tools/gtm_compare_dist.csh.
#
# set echo
# set verbose
#
# root user of most (distribution) servers has default umask of 022. Some has 077
# The file permissions while creating kits and installing are individually handled (with specific chmod operations)
# The below umask is to have uniformity across servers for files in intermediate directories, especially when they
# are compared against the installed copies (gtm_compare_dir.csh)
umask 22
# Make sure don't start in utf-8 mode
if ($?gtm_chset) then
	if (M != $gtm_chset) then
		set longline='$LC_CTYPE, $gtm_dist, and $gtmroutines for M mode'
		echo '$gtm_chset'" = $gtm_chset, so change to M mode and also check "$longline
		exit
	endif
endif

# This script needs root privileges to
# - test install GT.M
# - set file ownership to 40535
set euser = `whoami`
if ("$euser" != "root") then
	echo "You must have root privileges to run kitstart"
	exit -1
endif

# we need s_linux and s_linux64 here
source $btc_tools/cms_cshrc.csh
source $btc_tools/server_list.csh	# To set $distrib_servers_unix

setenv PATH "/usr/local/bin:/usr/sbin:/usr/ccs/bin:/usr/bin:/bin"

# get the osname and arch type from the tables in server_list.csh

set servers      = ( $distrib_servers_unix )
set platformarch = ( $distrib_unix_platformarch )

foreach server ( $servers )
	@ index++
	if ("$server" =~ *${HOST:r:r:r}*) then
		set os_arch=$platformarch[$index]		# contortion alert! get the OS_ARCH value from the list
		set os_arch="${os_arch:s/_/ /}"			# and spilt OS_ARCH into "OS ARCH" and
		set os_arch=( ${os_arch:s/_/ /} )		# enclose it inside parenthesis to force conversion to an array
		break
	endif
end

# if not found in distribution servers then try from uname in case -allow entered
if (! $?os_arch) then
	# make a directory in /tmp to use to run unamearch.m
	setenv randstr `$gtm_dist/mumps -r %XCMD 'do ^%RANDSTR'`
	set tempdir = /tmp/kit_unamearch_${randstr}
	mkdir $tempdir
	cp $btc_tools/unamearch.m $tempdir
	set os_arch=`(cd $tempdir; $gtm_dist/mumps -r unamearch $distrib_unix_platformarch%$uname_platformarch)`
	if ("" == "$os_arch") then
		echo "Problem getting platform and arch from uname -a"
		rm -rf $tempdir
		exit 1
	endif
	set os_arch="${os_arch:s/_/ /}"			# and spilt OS_ARCH into "OS ARCH" and
	set os_arch=( ${os_arch:s/_/ /} )		# enclose it inside parenthesis to force conversion to an array
	rm -rf $tempdir
endif

set osname = $os_arch[1]
set arch = $os_arch[2]

set package = "tar cf"
set repackage = "tar rf"
set package_ext = "tar"
if ("$osname" == "os390") then
	set package = "pax -w -x pax -f"
	set repackage = "pax -a -f"
	set package_ext = "pax"
endif

set syntaxerr = 0
set arguments = "$argv"
if ($#argv < 1) then
	set syntaxerr = 1
else
	set testinstall = 0
	set leavedir = 0
	# when present, do not fire off a background kitstart
	if ("$1" == "logfile") then
		set logfile = 1
		shift
	endif
	# perform a test installation
	if ("$1" == "-ti") then
		set testinstall = 1
		shift
	endif
	# build a kit on a non-dist server
	set allow = 0
	if ("$1" == "-allow") then
		set allow = 1
		shift
	endif
	# Test the test install
	if ("$1" == "-tti") then
		set testinstall = 1
		set leavedir = 1
		set allow = 1
		shift
	endif
	if ("$1" == "" || "$2" != "" && "$2" != "pro" && "$2" != "dbg" && "$2" != "bta") then
		set syntaxerr = 1
	endif
endif

if ($syntaxerr) then
	echo ""
	echo "Usage : $0 [-ti] [-allow] [-tti] <ver> [pro | dbg | bta]"
	echo ""
	echo "<ver>       : Version with no punctuations; create distribution of this GT.M version (must be in $gtm_root)"
	echo "-ti         : Test installation"
	echo "-allow      : allow kit to be built on a non-distribution server"
	echo "-tti        : Test the test installation, implies -allow and always leaves dist, tmp_dist, install directories"
	echo "[pro | dbg | bta] : Create distribution of this image; or pro and dbg if not specified"
	echo ""
	exit 1
endif

if (! $allow && ("$distrib_servers_unix" !~ *${HOST:r:r:r}*)) then
	echo "This is not a distribution server. Exiting."
	exit
endif

set version = "${1:au}"		# ':au' - 'a' means apply to the whole string and 'u' means uppercase everything

set imagetype = "pro dbg"
if ($2 != "") then
	set imagetype = $2
endif

if (! -d $gtm_root/$version) then
	echo ""
	echo "$gtm_root/$version does not exist"
	echo ""
	exit 2
endif

# make sure $gtm_tools version is same as indicated in $version
if ($gtm_tools:h:t != $version) then
	echo ""
	echo "$version selected for kit should equal $gtm_tools:h:t in gtm_tools"
	echo ""
	exit 1
endif

if (! $?logfile) then
	set fname = ${gtm_root}/$version/log/kitstart.`date +%Y%m%d%H%M`
	echo "output will be in $fname"
	$0 logfile $arguments >&! $fname
	set save_status = $status
	grep -E "PASS|FAIL" $fname
	exit $save_status
endif
########################################################################################

set setactive_parms = ( $version p ) ; source $gtm_tools/setactive.csh
set zver = `$gtm_dist/mumps -run %XCMD 'write $zversion'`
set releasever = $zver[2]

set icuver =  `setenv gtm_dist $gtm_dist ; $gtm_tools/is_icu_symbol_rename.csh`
if ("" != "$icuver") setenv gtm_icu_version "$icuver"

# create a README.txt which has the current year in it
setenv readme_txt ${gtm_com}/README.txt
set year = `date +%Y`
sed "s/#YEAR#/$year/" $btc_tools/license_README.txt > $readme_txt
chmod 444 $readme_txt

# Set the open source flag and set lib_specific to the platform specific directories that needs to
# be copied as a part of open source distribution (down the script)
set open_source = 0
set GNU_COPYING_license = "${gtm_com}/COPYING"
if ("$osname" == "linux" && ( "$arch" == "i586" || "x8664" == "$arch" )) then
	set open_source = 1
	/bin/cp -pf $btc_tools/opensource_COPYING.txt $GNU_COPYING_license
	chmod 444 $GNU_COPYING_license
endif

set product = "gtm"
set dist = "$gtm_ver/dist"
set tmp_dist = "$gtm_ver/tmp_dist"
set install = "$gtm_ver/install"
set dist_prefix = "${product}_${version}_${osname}_${arch}"
set mnotdistributed = '{CHK2LEV,CHKOP,GENDASH,GENOUT,GETNEAR,GTMDEFINEDTYPESTODB,GTMHLPLD,GTMTHREADGBLASM,LOAD,LOADOP,LOADVX,MSG,TTTGEN,TTTSCAN,UNLOAD}.[om] GDE*.m' #BYPASSOKLENGTH
set notdistributed = '_*.o *.log map obj plugin/libgtm* plugin/*.tab plugin/gtmcrypt/maskpass{,.debug} plugin/r plugin/o'
set misc_notdistributed = "gtcm_{pkdisp,play,shmclean}{,.debug}"
set utf8_notdistributed = '_*.o *.m *.log map obj [a-z]*'

if (-d $dist || -d $tmp_dist || -d $install) then
	echo ""
	echo "$dist or $tmp_dist or $install exists. Exiting..."
	exit 3
endif

echo ""
set opensource_dist = "${dist}/opensource"
if (1 == $open_source) then
	echo "Creating $dist (for non open source customers) and $opensource_dist (for open source)"
	mkdir -p $opensource_dist || exit 4
else
	echo "Creating $dist"
	mkdir $dist || exit 4
endif


foreach image ($imagetype)
	set rm_from_dist = ""
	echo ""
	echo "Creating ${tmp_dist}/${image}"
	mkdir -p ${tmp_dist}/${image} || exit 5
	cd ${tmp_dist}/${image} || exit 7
	echo ""
	echo "Copying files from ${gtm_ver}/${image}"
	set cpflags="-r"
	if ("aix" == $osname) set cpflags="-rh"
	cp ${cpflags} ${gtm_ver}/${image}/* . || exit 8
	# Put pinentry into the plugin directory so that it ends up in the final package
	cp ${gtm_pct}/pinentry.m ./plugin/gtmcrypt/
	# Move debug symbols out of the way if they exist
	set debug_symbol_dir = "${tmp_dist}/${image}_DBG/"
	mkdir -p "$debug_symbol_dir"
	if ( -f ${tmp_dist}/${image}/mumps.debug ) then
		set rm_from_dist = "$rm_from_dist `echo *.debug`"
		mv *.debug $debug_symbol_dir
		pushd $debug_symbol_dir
		set dist_file = "${dist}/${product}-debug_${version}_${osname}_${arch}_${image}.${package_ext}"
		echo ""
		echo "Packaging debug symbols to ${dist_file}"
		cp $gtm_tools/install_debug_symbols_sh.txt install_debug_symbols.sh
		chmod +x install_debug_symbols.sh
		$package $dist_file *.debug install_debug_symbols.sh || exit 10
		echo "Gzipping $dist_file"
		gzip $dist_file || exit 11
		# Move debug symbols out of the way before other packages get made
		echo "Moving debug symbols to $debug_symbol_dir during kitstart"
		popd

	endif
	echo ""
	echo "Removing files that are not distributed (${notdistributed} ${mnotdistributed} ${misc_notdistributed})"
	set rm_from_dist = "$rm_from_dist `echo $mnotdistributed $misc_notdistributed`"
	/bin/rm -rf ${notdistributed} ${mnotdistributed} ${misc_notdistributed} || exit 9
	if (-e utf8) then
		cd utf8
		/bin/rm -rf ${utf8_notdistributed} ${mnotdistributed} || exit 9
		cd ..
	endif
	# add the README.txt file
	cp $readme_txt README.txt || exit 9
	# add the custom_errors_sample.txt file
	cp $gtm_tools/custom_errors_sample.txt . || exit 9
	if (-e gtmsecshrdir) then
		$gtm_com/IGS gtmsecshr "UNHIDE"	# make root-owned gtmsecshrdir world-readable
		chmod u+w gtmsecshrdir
	endif
	if (-e GTMDefinedTypesInit.m) then
		set dist_file = "${dist}/GTMDefinedTypesInit_${version}_${osname}_${arch}_${image}.${package_ext}"
		echo ""
		echo "Creating $dist_file"
		$package $dist_file README.txt GTMDefinedTypesInit.m || exit 10
		echo "Gzipping $dist_file"
		gzip $dist_file || exit 11
		if (1 == $open_source) then
			echo ""
			echo "Creating GTMDefinedTypesInit distribution for open source (includes GNU License)"
			echo ""
			echo "Copying $GNU_COPYING_license to $cwd"
			/bin/cp $GNU_COPYING_license . || exit 8
			set dist_file="${opensource_dist}/GTMDefinedTypesInit_${version}_${osname}_${arch}_${image}.${package_ext}"
			echo ""
			echo "Creating $dist_file"
			$package $dist_file README.txt COPYING GTMDefinedTypesInit.m || exit 10
			echo ""
			echo "Gzipping $dist_file"
			gzip $dist_file || exit 11
			rm -f COPYING || exit 9
		endif
		echo "Removing GTMDefinedTypesInit"
		set rm_from_dist = "$rm_from_dist `echo GTMDefinedTypesInit.*`"
		rm -f GTMDefinedTypesInit.* || exit 9
		if (-e utf8) then
			cd utf8
			rm -f GTMDefinedTypesInit.* || exit 9
			cd ..
		endif
	else
		echo ""
		echo "FAIL:GTMDefinedTypesInit was not found"
	endif
	set dist_file = "${dist}/${dist_prefix}_${image}.${package_ext}"
	# no files to be executable or writeable
	find . -type f -exec chmod a-xw {} \;
	# no directories to be writeable for group or world if aix or 32-bit linux, otherwise for all
	chmod a+x configure
	chmod a+x gtminstall
	if ((aix == ${osname}) || ((linux == ${osname}) && ("i586" == "$arch"))) then
		find . -type d -exec chmod go-w {} \;
	else
		find . -type d -exec chmod a-w {} \;
	endif
	# use 40535 for owner and group
	find . -exec chown 40535:40535 {} \;
	echo ""
	echo "Creating $dist_file"
	$package $dist_file . || exit 10
	echo ""
	echo "Gzipping $dist_file"
	gzip $dist_file || exit 11
	if (1 == $open_source) then
		echo ""
		echo "Creating distribution for open source (includes GNU License)"
		echo ""
		echo "Copying $GNU_COPYING_license to $cwd"
		/bin/cp $GNU_COPYING_license . || exit 8
		chown 40535:40535 COPYING
		set dist_file="${opensource_dist}/${dist_prefix}_${image}.${package_ext}"
		echo ""
		echo "Creating $dist_file"
		$package $dist_file . || exit 10
		echo ""
		echo "Gzipping $dist_file"
		gzip $dist_file || exit 11
		rm -f COPYING || exit 9
	endif
	set not_in_dist_${image} = `echo $rm_from_dist | sed 's/ /|/g'`
end
echo ""

if (-f $gtm_tools/gtmpcat.m) then
	pushd $gtm_tools
	set nonomatch ; set fldbld = (gtmpcat*On*${version}.m) ; unset nonomatch
	if (("$fldbld" == "gtmpcat*On*${version}.m") || ($#fldbld > 1)) then
		echo ""
		echo "FAIL:missing or duplicate gtmpcat field build file ($fldbld)"
	else
		set dist_file = "${dist}/gtmpcat_for_${version}_${osname}_${arch}.${package_ext}"
		echo ""
		echo "Creating $dist_file"
		sed "s/#ZVERSION#/${zver}/;s/#FLDBLD#/${fldbld}/" < install_gtmpcat_sh.txt > install_gtmpcat.sh
		cat gtmpcat_sh.txt > gtmpcat.sh
		chmod 500 install_gtmpcat.sh gtmpcat.sh
		set prev_user = `filetest -U gtmpcat.m`
		set prev_group = `filetest -G gtmpcat.m`
		set prev_perm = `filetest -P: gtmpcat.m`
		chown 0:0 gtmpcat.m $fldbld
		chmod 400 gtmpcat.m $fldbld
		$package $dist_file gtmpcat.m $fldbld install_gtmpcat.sh gtmpcat.sh || exit 10
		chown ${prev_user}:${prev_group} gtmpcat.m $fldbld
		chmod ${prev_perm} gtmpcat.m $fldbld
		echo ""
		echo "Gzipping $dist_file"
		gzip $dist_file || exit 11
	endif
	popd
else
	echo ""
	echo "FAIL:gtmpcat was not found"
endif

set verowner = `filetest -U: $gtm_ver`
set vergroup = `filetest -G: $gtm_ver`
find $dist -type f -exec chmod 444 {} \;
find $dist -type d -exec chmod 755 {} \;
chown -R ${verowner}:${vergroup} $dist
echo "Files in $dist"
/bin/ls -lR $dist
echo ""

set kitver = ${gtm_ver:t:s/V//}

if ($testinstall) then
	echo ""
	echo "Testing installation"
	echo ""
	echo "Creating $install"
	mkdir ${install} || exit 12
	foreach image ($imagetype)
		echo ""
		echo "Testing installation for $image"
		cd ${tmp_dist}/${image} || exit 13
		# V54000 introduced tests for installation validity.  The post v54000(includes it) creates an installation
		# for comparison using gtm_compare_build.csh later, but this is based on a restricted group
		# installation.  We now include an unrestricted group installation into the "${install}/defgroup" directory
		# for automated testing later. This will also verify the correct gtmsecshr permissions for both types
		# of installation. We answer "n" to the last question to remove files since we need them for the
		# restricted build.
		# V54002 now asks for an installation group (newline entered for default) so response needs one more
		# blank line for default group
		# V54003 now asks whether or not to retain .o files if libgtmutil.so is created
		# We answer "y" to this question
		# If libgtmutil.so is not created(on i586) this question is not asked
			if ("$osname" == "linux" && "$arch" == "i586") then
				sh ./configure << CONFIGURE_EOF


n
${install}/defgroup/${image}
y
y
n
n
CONFIGURE_EOF
			else
				sh ./configure << CONFIGURE_EOF


n
${install}/defgroup/${image}
y
y
n
y
n
CONFIGURE_EOF

			endif

		# We need for root to be a member of the restricted group so that it can run tests. root is a
		# member of the gtmsec NIS group.
		setenv rootgroup gtmsec

		# V54002 now asks for an installation group before the restricted group question so response is
		# reversed from V54000
		# V54003 now asks whether or not to retain .o files if libgtmutil.so is created
		# We answer "y" to this question
		# If libgtmutil.so is not created(on i586) this question is not asked
			if ("$osname" == "linux" && "$arch" == "i586") then
	 			sh ./configure << CONFIGURE_EOF

$rootgroup
y
${install}/${image}
y
y
n
y
CONFIGURE_EOF
			else
	 			sh ./configure << CONFIGURE_EOF

$rootgroup
y
${install}/${image}
y
y
n
y
y
CONFIGURE_EOF
			endif

		# exit if the installation of the image failed
		if ($status) then
			echo ""
			echo "Installation of $image failed; configure returned error"
			exit 14
		endif
		if ("`/bin/ls`" != "") then
			echo ""
			echo "Installation of $image failed; leftover files in ${tmp_dist}/${image}"
			/bin/ls -l
			exit 15
		endif

		# compare the files and directories in the installation to those in the build
		if ("pro" == ${image}) then
			# create the build.dir.  Only have to do it once
			cd $gtm_ver || exit 14
			# Filter away files not distributed
			ls -l pro pro/gtmsecshrdir | grep -vEw "$not_in_dist_pro|obj|map|lowerc_cp|arch|configure|gtminstall" | \
					awk '{if (NF > 2) print $1,$NF}' >> ${tmp_dist}/build.dir

			# make a defgroup directory under ${tmp_dist} and copy in the build.dir for use in
			# first iteration of the while loop
			mkdir ${tmp_dist}/defgroup
			cp ${tmp_dist}/build.dir ${tmp_dist}/defgroup

			set defgroup = "defgroup"
			@ both = 0
			# Exclude files that are created only during installation and not in regular builds
			set install_only_files = "README.txt|custom_errors_sample.txt|libgtmutil.so"
			set install_only_files = "$install_only_files|install_permissions.log|install_sha256_checksum.log"
			while (2 > $both)
				# create the install.dir from both installations
				cd ${install}/$defgroup
				ls -l pro pro/gtmsecshrdir |& grep -vEw "$install_only_files" | \
					awk '{if (NF > 2) print $1,$NF}' >> ${tmp_dist}/$defgroup/install.dir
				cd ${tmp_dist}/${image}
				env defgroup=$defgroup $gtm_tools/gtm_compare_dir.csh ${install} ${tmp_dist}/$defgroup
				set teststat = $status
				if ($teststat) then
					echo ""
					echo "Comparison of build and install directories failed."
					echo "Look in ${tmp_dist}/$defgroup/dircompare/diff.out"
					chmod -R ugo+rwx ${tmp_dist}/$defgroup/dircompare
					exit 16
				endif
				# to simplify the code to do the gtm_compare_dir.csh for both restricted and unrestricted group
				# installations in a loop, we set defgroup to null for the second pass.  This takes advantage of
				# the unix/linux path interpretation where dir//subdir is the same as dir/subdir
				# Also, if the value of $defgroup is "" (in the second round), dircompare.m removes
				# all world permissions from dev file listing
				set defgroup = ""
				@ both = $both + 1
			end
		endif

		# test the default group installation
		chmod a+x $install ${install}/defgroup ${install}/defgroup/${image}
		$gtm_tools/gtm_test_install.csh ${install}/defgroup/${image}
		set teststat = $status
		echo ""
		echo ""
		if (! $teststat) then
			echo "Test of installation for default group ${version}/defgroup/${image} PASSED"
		else
			echo "Test of installation for default group ${version}/defgroup/${image} FAILED"
			set leavedir = 1
		endif

		# test the group restricted installation
		$gtm_tools/gtm_test_install.csh ${install}/${image}
		set teststat = $status
		echo ""
		echo ""
		if (! $teststat) then
			echo "Test of installation for group restricted ${version}/${image} PASSED"
		else
			echo "Test of installation for group restriced ${version}/${image} FAILED"
			set leavedir = 1
		endif

		# Install gtmpcat
		pushd $gtm_tools
		yes | env gtm_dist=${install}/defgroup/${image} sh ./install_gtmpcat.sh
		yes | env gtm_dist=${install}/${image} sh ./install_gtmpcat.sh
		popd

		# Test gtmpcat
		pushd /tmp
		foreach dir (defgroup/${image} ${image})
			set gtmpcatout = "${install}/$dir/invoke_gtmpcat.out"
			set gtmcshrc = "$install/$dir/gtmcshrc"
			(source $gtmcshrc ; $gtm_dist/mumps -r %XCMD 'zsystem "$gtm_dist/gtmpcat "_$job') |& tee $gtmpcatout
			grep -q 'GTMPCAT Complete' $gtmpcatout
			if (0 == $status) then
				echo "Test of installation of gtmpcat ${version}/$dir PASSED"
			else
				echo "Test of installation of gtmpcat ${version}/$dir FAILED"
			endif
		end

		popd

		# install debug symbols
		if ( ( "`uname`" == "Linux" ) && ("pro" == "$image") ) then
			pushd ${tmp_dist}/${image}_DBG/
			yes | env gtm_dist=${install}/${image} sh ./install_debug_symbols.sh
			popd

			# Test debug symbols
			set result=`source ${install}/${image}/gtmcshrc ; gdb $gtm_dist/mumps -ex quit | grep mumps.debug | wc -l`
			echo ""
			echo ""
			if ( $result ) then
				echo "Test of installation of debug symbols ${version}/${image} PASSED"
			else
				echo "Test of installation of debug symbols ${version}/${image} FAILED"
			endif
		endif

	end
endif

cd $gtm_ver || exit 16

if (! $leavedir) then
	echo ""
	echo "Removing temporary directories"
	echo ""
	echo ""
	/bin/rm -rf ${tmp_dist} ${install}
	/bin/rm -f $gtm_tools/{gtmpcat.sh,install_gtmpcat.sh}
	exit 0
endif

echo ""
echo "Distribution creation/testing failed. Leaving directories ${tmp_dist} ${install}"
exit 17