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
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
|
#!/bin/csh -f
#
# INSTALL -- Install IRAF on a UNIX/IRAF host. May also be run after the
# initial installation as a consistency check to verify that all the necessary
# links and file permissions are still in place (e.g., after updating UNIX
# itself).
#
# Usage: install [-n] [-r rootdir] [-i imdir] [-b localbindir] \
# [-R oldroot] [-I oldimdir] [-u username (e.g., 'iraf')]
# [-m mach (e.g., 'sparc', 'mc68020') ]
#
# Example:
# % su
# % cd $hlib
# % install -n
# % install
#
# If run with no arguments, INSTALL will make an informed guess and prompt
# with this value; type <return> to accept the value, or enter a new value.
#
# Use "install -n" to do a dry run to see what the would be done, without
# actually modifying the host system and IRAF configuration files. To do the
# actual installation one must be superuser, but anyone can run "install -n"
# to see what it would do.
# ----------------------------------------------------------------------------
unset noclobber
unalias cd cp cmp echo ln mv rm sed set grep ls chmod chown pwd touch
set path = (/sbin /usr/sbin /bin /usr/bin /usr/ucb /etc /usr/etc)
#set echo
set W = '\([ "]\)' # match a blank, tab, or "
set TEMP = "/tmp/I_temp"
set exec = yes
set user = iraf
set LS = /bin/ls
alias PUT "mv -f \!*; chown $user \!$ "
# Determine platform architecture.
if (-f /etc/redhat-release) then
if (`uname -m` == "ppc") then
set mach = linuxppc
else
set mach = redhat
endif
else
set mach = `uname -s | tr '[A-Z]' '[a-z]'`
endif
if ($mach == "darwin") then
set mach = macosx
endif
if ($?iraf == 1) then
if (! -d $iraf) then
setenv iraf ""
endif
else
setenv iraf ""
endif
set imdir = ""
set lbin = ""
set o_iraf = ""
set o_imdir = ""
# Process any command line arguments.
while ("$1" != "")
switch ("$1")
case -n: # no execute
alias PUT "diff \!$ \!^; rm -f $TEMP"
set exec = no
breaksw
case -b: # set local bin directory (unix)
if ("$2" != "") then
shift
else
echo "missing argument to '-b <localbindir>' switch"
exit 1
endif
set lbin = "$1"
breaksw
case -i: # set imdir directory
if ("$2" != "") then
shift
else
echo "missing argument to '-i <imdir>' switch"
exit 1
endif
set imdir = "$1"
breaksw
case -m: # set machine type
if ("$2" != "") then
shift
else
echo "missing argument to '-m <mach>' switch"
exit 1
endif
set mach = "$1"
breaksw
case -r: # set root directory
if ("$2" != "") then
shift
else
echo "missing argument to '-r <irafdir>' switch"
exit 1
endif
setenv iraf "$1"
breaksw
case -I: # set old imdir directory
if ("$2" != "") then
shift
else
echo "missing argument to '-I <o_imdir>' switch"
exit 1
endif
set o_imdir = "$1"
breaksw
case -R: # set old root directory
if ("$2" != "") then
shift
else
echo "missing argument to '-R <o_iraf>' switch"
exit 1
endif
set o_iraf = "$1"
breaksw
case -u: # set user name for iraf, e.g, 'iraf'
if ("$2" != "") then
shift
else
echo "missing argument to '-u <irafowner>' switch"
exit 1
endif
set user = "$1"
breaksw
default:
echo "install: unknown argument $1"
breaksw
endsw
if ("$2" == "") then
break
else
shift
endif
end
# Set $iraf, the new root directory for iraf. The system must already have
# been read in at this directory (e.g., /usr/iraf), but we assume that no
# files have yet been modified.
if ("$iraf" == "") then
# Make a guess at what the new root directory is.
set d_iraf = ""
if (-d /iraf/iraf) then
set d_iraf = /iraf/iraf
else if (-d /iraf) then
set d_iraf = /iraf
else if (-d /usr/iraf) then
set d_iraf = /usr/iraf
else
# Search for a directory /u*/iraf.
foreach i (/u*)
if (-d $i/iraf) then
set d_iraf = "$i/iraf"
break
endif
end
# Search for a directory /*/iraf.
if ("$d_iraf" == "") then
foreach i (/*)
if (-d $i/iraf) then
set d_iraf = "$i/iraf"
break
endif
end
endif
endif
if ("$d_iraf" == "") then
set d_iraf = /usr/iraf
endif
else
set d_iraf = $iraf
endif
# If the given directory doesn't exist, compute the root directory relative
# to $iraf/unix/hlib (our current directory, presumably).
if (! -d $d_iraf) then
set d_iraf = `(cd ../..;cwd)`
endif
set d_iraf = `echo $iraf | sed -e 's+/\(["]*\)$+\1+'`
echo -n "new iraf root directory ($d_iraf): "
setenv iraf "$<"
if ("$iraf" == "") then
setenv iraf "$d_iraf"
endif
# Get the values of o_iraf and o_imdir from the current mkiraf.csh file, if
# not already otherwise defined.
cd $iraf/unix/hlib
set WS = '[ ]'
if ("$o_iraf" == "") then
set o_iraf =\
`grep "^set$WS*iraf" mkiraf.csh | sed -e "s+^.*=$WS*++" | sed -e 's+"++g'`
endif
if ("$o_imdir" == "") then
set o_imdir =\
`grep "^set$WS*imdir" mkiraf.csh | sed -e "s+^.*=$WS*++" | sed -e 's+"++g'`
endif
# Strip any trailing / in the pathname to be matched, so that the trailing /,
# if present, will be LEFT in the occurrence of the path in the file.
set o_iraf = `echo $o_iraf | sed -e 's+/\(["]*\)$+\1+'`
set o_imdir = `echo $o_imdir | sed -e 's+/\(["]*\)$+\1+'`
# Set $imdir, the default user image storage root directory. Each user imdir
# will be a subdirectory of this directory by default, when MKIRAF is run.
# Since bulk image data can consume hundreds of megabytes of disk space, IRAF
# likes to keep such data on a public scratch device, which is probably not
# backed up, which has a short file expiration interval, and possibly which
# has been configured (newfs/mkfs) with a large block size for fast seq. i/o.
if ("$imdir" == "") then
if (-d $o_imdir) then
set d_imdir = $o_imdir
else if (-d /tmp2) then
set d_imdir = /tmp2/iraf
else if (-d /tmp3) then
set d_imdir = /tmp3/iraf
else if (-d /usr/tmp) then
set d_imdir = /usr/tmp
else
set d_imdir = /tmp
endif
echo -n "default root image storage directory ($d_imdir): "
set imdir = "$<"
if ("$imdir" == "") then
set imdir = "$d_imdir"
endif
endif
# Get UNIX directory where HSI commands (links) are to be installed, if not
# set on command line. IRAF will only install a very few new commands in this
# directory. Ideally it should be a directory on the standard user $path,
# so that users do not have to customize their . files just to run IRAF.
if ("$lbin" == "") then
# Look around and come up with a likely candidate directory.
if (-d /usr/local/bin) then
set d_lbin = /usr/local/bin
else if (-d /local/bin) then
set d_lbin = /local/bin
else
set d_lbin = /usr/bin
endif
echo -n "local unix commands directory ($d_lbin): "
set lbin = "$<"
if ("$lbin" == "") then
set lbin = "$d_lbin"
endif
endif
# Verify the machine type.
echo "install iraf for machine type $mach"
# Document the old root pathnames.
echo "old iraf root = $o_iraf, old imdir = $o_imdir"
# Cannot have iraf and imdir the same.
if ($iraf == $imdir) then
echo "imdir cannot be the same as the iraf root, try again"
exit 1
endif
# The following is partially system dependent.
# ------------------------------------------
# Set the BINDIRS pathnames - directories where the HSI executables go.
set host = "$iraf/unix"
set hbin = "$iraf/unix/bin.$mach" # "mach" is SUN specific!!
set hlib = "$iraf/unix/hlib"
set fbin = "$iraf/bin"
# Replace any // by /.
set host = `echo $host | sed -e "s+//+/+g"`
set hbin = `echo $hbin | sed -e "s+//+/+g"`
set fbin = `echo $fbin | sed -e "s+//+/+g"`
set hlib = `echo $hlib | sed -e "s+//+/+g"`
# Strip any trailing /.
set host = `echo $host | sed -e 's+/\(["]*\)$+\1+'`
set hbin = `echo $hbin | sed -e 's+/\(["]*\)$+\1+'`
set fbin = `echo $fbin | sed -e 's+/\(["]*\)$+\1+'`
set hlib = `echo $hlib | sed -e 's+/\(["]*\)$+\1+'`
set BINDIRS = "$hbin $hlib $fbin"
# The following file lists are partially system dependent.
set PATHFILES = "mkiraf.csh libc/iraf.h cl.csh"
set MODEFILES = "mkiraf.csh mkmlist.csh generic.e mkpkg.e rmbin.e rmfiles.e rpp.e rtar.e wtar.e xc.e xpp.e xyacc.e sgidispatch.e $hbin/sgi2*.e cl.csh mkfloat.csh fc.csh $host/reboot"
set LINKFILES = "cl.e generic.e mkiraf.csh mkmlist.csh mkpkg.e rmbin.e rmfiles.e rtar.e sgidispatch.e wtar.e rpp.e xpp.e xyacc.e xc.e"
# ------------------------------------------
# Begin installation.
# ------------------
echo "installing iraf at $iraf, imdir=$imdir, lbindir=$lbin"
echo -n "proceed with installation? (yes): "; set temp = $<
if (! ($temp == "" || $temp == "y" || $temp == "yes")) then
echo "installation terminated"
exit 1
else
echo ""
endif
# Create the root imdir as a public scratch directory, if not already created.
if (! -d $imdir) then
echo "creating root imdir at $imdir"
if ($exec == yes) then
mkdir $imdir; chmod 777 $imdir
endif
else
if ($exec == yes) then
chmod 777 $imdir
endif
echo "default root imdir is ok"
endif
# Allow deletion of files in /tmp - needed for multiuser tape allocation.
if ($exec == yes) then
echo "set delete permission on /tmp"
chmod -t /tmp
endif
# Initialize permissions of tape devices.
if ($exec == yes) then
echo "set mode 0666 on magtape devices to permit tape allocation"
chmod 666 /dev/*st[0-4]*
endif
# Set owner=root for the device allocation task, alloc.e.
#foreach i ($BINDIRS)
# if (-e $i/alloc.e) then
# if ("`$LS -l $i/alloc.e | grep 'rwsr-.*root'`" != "") then
# echo "device allocation task $i/alloc.e is ok"
# else
# echo "chown $i/alloc.e to root, set uid modebit"
# if ($exec == yes) then
# chown 0 $i/alloc.e
# chmod u+s $i/alloc.e
# endif
# endif
# break
# else
# echo "cannot find alloc.e"
# endif
#end
# Edit the $iraf pathname in the .login file for user 'iraf'.
cd $iraf/local
if (-e .login) then
rm -f $TEMP >& /dev/null
sed -e "s+$W$o_iraf+\1$iraf+" .login > $TEMP
cmp -s .login $TEMP
if ($status) then
echo "updating $iraf/local/.login"
PUT $TEMP .login
else
echo "iraf .login file is ok"
rm -f $TEMP
endif
else
echo "cannot find the iraf .login file"
endif
# Edit the $iraf and $imdir pathnames in the mkiraf.csh and libc/iraf.h files.
cd $iraf/unix/hlib
foreach i ($PATHFILES)
if (-e $i) then
rm -f $TEMP >& /dev/null
sed -e "s+$W$o_iraf+\1$iraf+" $i |\
sed -e "s+$W$o_imdir+\1$imdir+" > $TEMP
cmp -s $i $TEMP
if ($status) then
echo "updating $i"
PUT $TEMP $i
if ($exec == yes) then
chmod 755 $i
endif
else
echo "$i is ok"
rm -f $TEMP
endif
else
echo "cannot find $i"
endif
end
# Set default file permissions for the executable files in the BINDIRS,
# in case the file mode has somehow been changed, e.g., in a file restore
# or copy.
echo "--------------- Check File Permissions ----------------"
#foreach i ($MODEFILES)
# set file = $i
# if (! -e $file) then
# foreach j ($BINDIRS)
# if (-e $j/$i) then
# set file = $j/$i
# break
# endif
# end
# endif
#
# if (-e $file) then
# if ("`$LS -l $file | grep '^.rwxr.xr.x'`" != "") then
# echo "file $file exists with the correct permissions"
# else
# echo "set mode for $file to 0755"
# if ($exec == yes) then
# chmod 755 $file
# endif
# endif
# else
# echo "cannot find $file"
# endif
#end
# Link $hlib/libc/iraf.h to <iraf.h>. This is needed not only to compile C
# source files in iraf, but also to define $iraf, $host, etc. for iraf tasks.
echo "---------------- Check Symbolic Links -----------------"
set file1 = /usr/include/iraf.h
set file2 = $iraf/unix/hlib/libc/iraf.h
if (-e $file1) then
if ("`$LS -l $file1 | grep $file2`" != "") then
echo "symbolic link $file1 is ok"
else
echo "link $file1 exists but is invalid; unlink $file1"
if ($exec == yes) then
rm -f $file1
endif
echo "make symbolic link $file1 -> $file2"
if ($exec == yes) then
rm -f $file1
ln -s $file2 $file1
endif
endif
else
echo "make symbolic link $file1 -> $file2"
if ($exec == yes) then
rm -f $file1
ln -s $file2 $file1
endif
endif
# Establish the remaining symbolic links to HSI tasks.
echo "directory $lbin"
cd $lbin
foreach i ($LINKFILES)
# Locate the file to be linked to.
set file1 = $i:r
foreach j ($BINDIRS)
set file2 = $j/$file1.csh
if (-e $file2) then
break
endif
set file2 = $j/$i
if (-e $file2) then
break
endif
end
# Verify or set the link.
if ("`$LS $file1`" == "$file1") then
if ("`$LS -l $file1 | grep $file2`" != "") then
echo "symbolic link $file1 is ok"
else
echo "link $file1 exists but is invalid; unlink $file1"
if ($exec == yes) then
rm -f $file1
endif
echo "make symbolic link $file1 -> $file2"
if ($exec == yes) then
rm -f $file1
ln -s $file2 $file1
endif
endif
else
echo "make symbolic link $file1 -> $file2"
if ($exec == yes) then
rm -f $file1
ln -s $file2 $file1
endif
endif
end
# Mark the system update time.
echo 'touch hlib$utime'
if ($exec == yes) then
touch $hlib/utime
endif
#exit 0 # COMMENT OUT FOR SUN/IRAF
# SUN/IRAF specific stuff.
# ------------------------------
if ($mach == linux || $mach == redhat || $mach == suse || \
$mach == freebsd || $mach == sunos || $mach == linuxppc) then
set pciraf = yes
else
set pciraf = no
endif
# If PC-IRAF only do X.
if ($pciraf == yes) then
goto xconfig
endif
# Install custom suntools (GTERM and IMTOOL).
if ("`grep Release.4 /etc/motd`" != "" || `mach` == "i386") then
set SUNOS4 = yes
else
set SUNOS4 = no
endif
echo ""
echo "------------ Custom Suntools Installation -------------"
if ($SUNOS4 == "yes") then
# SunOS 4.0 and later versions.
# Install GTERM and IMTOOL executables in /usr/bin.
# ----------------------------------
# Get the path to the user bin directory.
set usrbin = /usr/bin
if ($mach != `mach`) then
echo -n "/usr/bin directory for machine type $mach ($usrbin): "
set usrbin = "$<"
if ("$usrbin" == "") then
set usrbin = "$usrbin"
endif
endif
# Install the executables.
cd $usrbin
foreach i (gterm imtool)
set file2 = $hbin/$i.e
# Check if installed executable, if any, is up to date.
if (-e $i) then
rm -f $TEMP.[12] >& /dev/null
size $i > $TEMP.1; size $file2 > $TEMP.2
cmp -s $TEMP.1 $TEMP.2
if ($status || "`find $file2 -newer $i -print`" != "") then
set uptodate = no
else
set uptodate = yes
endif
rm $TEMP.[12]
else
set uptodate = no
endif
# Update file if necessary.
if ($uptodate == no) then
echo "copy $file2 to $usrbin/$i"
if (-e $file2) then
if ($exec == yes) then
if (-e $i) then
rm -f $i
endif
cp $file2 $i
endif
else
echo "file $file2 not found"
endif
else
echo "installed version of $i is up to date"
endif
end
# Add entries for GTERM and IMTOOL to rootmenu file, if necessary.
set file = /usr/lib/rootmenu
if ("`grep gterm $file`" != "" &&\
"`grep imtool $file`" != "") then
echo "standard rootmenu file is ok (has gterm, imtool entries)"
else
echo -n "add entries for gterm and imtool to rootmenu file? (yes): "
set temp = "$<"
if ("$temp" == "" || "$temp" == "y" || "$temp" == "yes") then
(rm -f $TEMP; rm -f $TEMP.s) >& /dev/null
if ("`grep gterm $file`" == "") then
echo '7a\' > $TEMP.s
echo '"Gterm" gterm' >> $TEMP.s
sed -f $TEMP.s < $file > $TEMP
PUT $TEMP $file; rm $TEMP.s
endif
if ("`grep imtool $file`" == "") then
echo '8a\' > $TEMP.s
echo '"ImTool" imtool' >> $TEMP.s
sed -f $TEMP.s < $file > $TEMP
PUT $TEMP $file; rm $TEMP.s
endif
endif
endif
else
# Install the custom Suntools - SunOS versions prior to 4.0.
# -------------------------------
echo -n "install custom suntools (GTERM, IMTOOL)? (yes): "; set temp = "$<"
if (! ("$temp" == "" || "$temp" == "y" || "$temp" == "yes")) then
echo "suntools installation skipped"
exit 0
endif
# The custom suntools executable is upwards compatible with standard
# suntools. If the answer to the query below is yes, the new executable
# replaces /usr/bin/suntools, which is renamed /usr/bin/suntools.BAK.
# If the answer is no, GTERM and IMTOOL will be linked to the uninstalled
# IRAF version of suntools, $iraf/local/suntools, which will work, but
# runtime memory requirements will be 800 Kb or so greater than otherwise.
# The main reason one would not want to use the IRAF /usr/bin/suntools is
# if a custom version of /usr/bin/suntools containing tools not in the
# standard SUN version of suntools has already been installed.
echo -n "install custom version of /usr/bin/suntools executable? (yes): "
set temp = "$<"
if ("$temp" == "" || "$temp" == "y" || "$temp" == "yes") then
# Install custom version of /usr/bin/suntools, and make links for gterm
# and imtool in /usr/bin, like the other suntools.
set usrbin = /usr/bin
set file2 = $hbin/suntools.e
if ($mach != `mach`) then
echo -n "/usr/bin directory for machine type $mach ($usrbin): "
set usrbin = "$<"
if ("$usrbin" == "") then
set usrbin = "$usrbin"
endif
endif
set suntools = $usrbin/suntools
# Check if installed executable is up to date.
rm -f $TEMP.[12] >& /dev/null
size $suntools > $TEMP.1; size $file2 > $TEMP.2
cmp -s $TEMP.1 $TEMP.2
if ($status || "`find $file2 -newer $suntools -print`" != "") then
set uptodate = no
else
set uptodate = yes
endif
rm $TEMP.[12]
# Update file if necessary.
if ($uptodate == no) then
if (! -e $suntools.BAK) then
echo "rename standard suntools ($suntools) to $suntools.BAK"
if ($exec == yes) then
cp $suntools $suntools.BAK
endif
endif
echo "copy $file2 to $suntools"
if (-e $file2) then
if ($exec == yes) then
cp $file2 temp
mv -f temp $suntools
endif
else
echo "file $file2 not found"
endif
else
echo "installed version of $suntools is up to date"
endif
# Add entries for GTERM and IMTOOL to rootmenu file, if necessary.
set file = /usr/lib/rootmenu
if ("`grep gterm $file`" != "" &&\
"`grep imtool $file`" != "") then
echo "standard rootmenu file is ok (has gterm, imtool entries)"
else
echo -n "add entries for gterm and imtool to rootmenu file? (yes): "
set temp = "$<"
if ("$temp" == "" || "$temp" == "y" || "$temp" == "yes") then
(rm -f $TEMP; rm -f $TEMP.s) >& /dev/null
if ("`grep gterm $file`" == "") then
echo '7a\' > $TEMP.s
echo '"Gterm" gterm' >> $TEMP.s
sed -f $TEMP.s < $file > $TEMP
PUT $TEMP $file; rm $TEMP.s
endif
if ("`grep imtool $file`" == "") then
echo '8a\' > $TEMP.s
echo '"ImTool" imtool' >> $TEMP.s
sed -f $TEMP.s < $file > $TEMP
PUT $TEMP $file; rm $TEMP.s
endif
endif
endif
# Make sure GTERM and IMTOOL links are in place.
echo "directory $usrbin"
cd $usrbin
# Note that the following is resolved at runtime, hence the /usr/bin
# is correct regardless of the physical directory.
set exe = /usr/bin/suntools
foreach i (gterm imtool)
if (-e $lbin/$i) then
echo "remove old symbolic link $lbin/$i"
if ($exec == yes) then
/bin/rm -f $lbin/$i
endif
endif
if (-e $i) then
if ("`$LS -l $i | grep $exe`" != "") then
echo "symbolic link $i is ok"
else
echo "link $i exists but is invalid; unlink it"
if ($exec == yes) then
/bin/rm -f $i
endif
echo "make symbolic link '$i' pointing to $exe"
if ($exec == yes) then
/bin/ln -s $exe $i
endif
endif
else
echo "make symbolic link '$i' pointing to $exe"
if ($exec == yes) then
ln -s $exe $i
endif
endif
end
else
# Do not install custom suntools and rootmenu files; leave these in
# $hbin, but add links to $lbin for gterm, and imtool, pointing to
# local iraf version of suntools.
set file = $hbin/suntools.e
if (! -e $file) then
echo "custom suntools executable $file is missing!!"
endif
echo "directory $lbin"
cd $lbin
foreach i (gterm imtool)
if (-e /usr/bin/$i) then
echo "remove old symbolic link /usr/bin/$i"
if ($exec == yes) then
rm -f /usr/bin/$i
endif
endif
if (-e $i) then
if ("`$LS -l $i | grep iraf`" != "") then
echo "symbolic link $i is ok"
else
echo "link $i exists but is invalid; unlink it"
if ($exec == yes) then
rm -f $i
endif
echo "make symbolic link '$i' -> $file"
if ($exec == yes) then
ln -s $file $i
endif
endif
else
echo "make symbolic link '$i' -> $file"
if ($exec == yes) then
ln -s $file $i
endif
endif
end
endif
endif
# Common code for GTERM/IMTOOL installation.
# -------------------------------------------
xconfig:
# Make sure special device entries for the IMTOOL display server exist
# in /dev.
foreach i (/dev/imt1i /dev/imt1o)
if (-e $i) then
echo "imtool device entry $i is ok"
else
echo "make device entry $i for imtool"
if ($exec == yes) then
if ($mach == linux || $mach == redhat || $mach == suse || \
$mach == linuxppc) then
mknod $i p
else if ($mach == freebsd) then
mkfifo $i
else
mknod $i p
endif
chmod 777 $i
endif
endif
end
# The old /dev/imt1 entry is now just a link to /dev/imt1o.
set file = /dev/imt1
if (-e $file) then
if ("`$LS -l $file | grep imt1o`" != "") then
echo "imtool device entry $file is ok"
else
echo "make device entry $file for imtool"
if ($exec == yes) then
rm -f $file
ln -s /dev/imt1o $file
endif
endif
else
echo "make device entry $file for imtool"
if ($exec == yes) then
ln -s /dev/imt1o $file
endif
endif
# Install the default IMTOOLRC frame buffer configuration file. The path
# /usr/local/lib path hardwired in to imtool and cannot easily be changed, but
# if installation of the default imtoolrc in this directory is not possible,
# the file can be installed in each imtool user's login directory as .imtoolrc,
# or the environment variable IMTOOLRC can be defined in each imtool user's
# .login or .cshrc to define the path to the file.
# Verify imtoolrc link.
cd /usr/local/lib
set file1 = imtoolrc
set file2 = $iraf/dev/imtoolrc
# Verify or set the link.
if ("`$LS $file1`" == "$file1") then
if ("`$LS -l $file1 | grep $file2`" != "") then
echo "symbolic link $file1 is ok"
else
echo "link $file1 exists but is invalid; unlink $file1"
if ($exec == yes) then
rm -f $file1
endif
echo "make symbolic link $file1 -> $file2"
if ($exec == yes) then
rm -f $file1
ln -s $file2 $file1
endif
endif
else
echo "make symbolic link $file1 -> $file2"
if ($exec == yes) then
rm -f $file1
ln -s $file2 $file1
endif
endif
# Make sure there are entries in the the termcap and graphcap files for xgterm
# and imtool.
set temp = `grep -l xgterm $iraf/dev/termcap | grep -v "^#"`
if ("$temp" == "") then
echo "WARNING: no xgterm entry in termcap file"
else
echo "termcap file is ok (contains xgterm entry)"
endif
set gcok = yes
set temp = `grep -l xgterm $iraf/dev/graphcap | grep -v "^#"`
if ("$temp" == "") then
echo "WARNING: no xgterm entry in graphcap file"
set gcok = no
endif
set temp = `grep -l imtool $iraf/dev/graphcap | grep -v "^#"`
if ("$temp" == "") then
echo "WARNING: no imtool entry in graphcap file"
set gcok = no
endif
if ($gcok == yes) then
echo "graphcap file is ok (contains xgterm, imtool entries)"
endif
# Install or update the XGTERM and XIMTOOL manual pages.
if ($pciraf == no && -e /usr/man/mann) then
cd /usr/man/mann
set src = $iraf/unix/x11
foreach i (xgterm ximtool)
set file1 = $i.n
set file2 = $src/$i.man
# Install or update the manpage source file.
if (-e $file1) then
cmp -s $file1 $file2
if ($status) then
echo "update $i manual page"
if ($exec == yes) then
cp $file2 $file1
endif
else
echo "$i manual page is up to date"
endif
else
echo "install $i manual page in /usr/man/mann"
if ($exec == yes) then
cp $file2 $file1
endif
endif
# Rerun catman if necessary.
if (-e /usr/man/catl) then
set file2 = /usr/man/catl/$i.n
if (! -e $file2 || "`find $file1 -newer $file2 -print`" != "") then
echo "rerun catman on section n"
if ($exec == yes) then
/usr/etc/catman n
endif
endif
endif
end
endif
|