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 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514
|
#!/bin/sh
#
# INSTALL.SH -- Install IRAF on the local machine, either as a system-wide
# facility, and/or for personal use. Root privileges are only required for
# a system installation.
#
# Usage:
# % install [opts]
#
# Where [opts] include:
#
# -h, --help # print help
# --version # print script version
#
# -n, --noop # no execute
# -s, --system # do a system install (needs root)
# -C, --csh # install C-shell scripts
#
# -t, --term <term> # set default terminal type
# -b, --bindir <dir> # set local bin directory
# -c, --cache <dir> # set cache directory
# -i, --imdir <dir> # set image directory
# -m, --mach <arch> # set architecture
# -r, --root <dir> # set iraf root directory
#
# -C, --oldcache <dir> # set old cache directory
# -I, --oldimdir <dir> # set old image directory
# -R, --oldroot <dir> # set old iraf root directory
#
#
# Initialize script variables.
if [ ! -n "$iraf" ]; then
export iraf=$PWD
fi
if [ -e "$iraf/unix/hlib/util.sh" ]; then
. "$iraf/unix/hlib/util.sh"
fi
if [ -e "${iraf}/unix/hlib/irafarch.sh" ]; then
mach=$("${iraf}/unix/hlib/irafarch.sh") # current platform architecture
hmach=$("${iraf}/unix/hlib/irafarch.sh" -hsi) # current HSI architecture
if [ -z "$IRAFARCH" ]; then
IRAFARCH=$mach
fi
elif [ -e "./unix/hlib/irafarch.sh" ]; then
mach=$(./unix/hlib/irafarch.sh) # current platform architecture
hmach=$(./unix/hlib/irafarch.sh -hsi) # current HSI architecture
if [ -z "$IRAFARCH" ]; then
IRAFARCH=$mach
fi
else
mach=""
hmach=""
echo "Error: Cannot determine platform architecture, quitting."
echo ' : Try setting a $iraf or $IRAFARCH variable.'
exit 1
fi
if [ -e "${iraf}/.version" ]; then
VERSION=$(cat "${iraf}/.version")
else
VERSION="v2.16"
fi
defterm="xgterm" # default terminal type
do_system=0 # system or personal install?
do_csh=0 # Install csh scripts?
err_seen=0 # have errors been seen?
err_count=0 # error count
exec="yes" # take action?
old_links=0 # use old link method?
extn="sh" # shell script extension
LS="/bin/ls" # directory listing command
TEMP="/tmp/iraf_install.$$" # temp output file
imdir="" # image directory
cache="" # cache directory
myterm="" # terminal type
p_iraf="" # <param> iraf root directory
p_imdir="" # <param> image directory
p_cache="" # <param> cache directory
p_lbin="" # commands directory
o_iraf="" # old iraf root directory
o_imdir="" # old image directory
o_cache="" # old cache directory
# INSTALL_HELP -- Print script help.
install_help() {
ECHO ""
ECHO " Usage:"
ECHO " % install [opts]"
ECHO ""
ECHO " Where [opts] include:"
ECHO ""
ECHO " -h, --help # print help"
ECHO " --version # print script version"
ECHO ""
ECHO " -n, --noop # no execute"
ECHO " -s, --system # do a system install (needs root)"
ECHO " -C, --csh # install C-shell scripts"
ECHO ""
ECHO " -t, --term <term> # set default terminal type"
ECHO " -b, --bindir <dir> # set local bin directory"
ECHO " -c, --cache <dir> # set cache directory"
ECHO " -i, --imdir <dir> # set image directory"
ECHO " -m, --mach <arch> # set architecture"
ECHO " -r, --root <dir> # set iraf root directory"
ECHO ""
ECHO " -C, --oldcache <dir> # set old cache directory"
ECHO " -I, --oldimdir <dir> # set old image directory"
ECHO " -R, --oldroot <dir> # set old iraf root directory"
ECHO ""
ECHO ""
}
#=============================================================================
# Process command line arguments. The defaults are set to empty strings
# in order to allow them to be defined first on the command-line. In
# addition, if the 'sysinstall" option is used it will change how we
# look for installation directories.
#=============================================================================
while [ -n "$1" ] ; do
case "$1" in
"-h"|"-help"|"--help") # print script help
install_help
exit 0
;;
"-version"|"--version") # print script version
echo "$VERSION"
exit 0
;;
"-n"|"-noop"|"--noop") # no execute
exec=no
;;
"-s"|"-system"|"--system") # do a system-wide install?
do_system=1
;;
"-C"|"-csh"|"--csh") # Install csh scripts?
do_csh=1
;;
"-t"|"-term"|"--term") # set default terminal type.
myterm=$2 ; shift
;;
"-b"|"-bindir"|"--bindir") # set local bin directory
p_lbin=$2 ; shift
;;
"-c"|"-cache"|"--cache") # set cache directory
p_cache=$2 ; shift
;;
"-i"|"-imdir"|"--imdir") # set image directory
p_imdir=$2 ; shift
;;
"-m"|"-mach"|"--mach") # set architecture
mach=$2 ; shift
;;
"-r"|"-root"|"--root") # set iraf root directory
p_iraf=$2 ; shift
if [ ! -n "$p_iraf" ]; then
export iraf=$p_iraf
fi
if [ -e "$iraf/unix/hlib/util.sh" ]; then
. "$iraf/unix/hlib/util.sh"
fi
if [ -e "${iraf}/unix/hlib/irafarch.sh" ]; then
mach=$("${iraf}/unix/hlib/irafarch.sh")
fi
;;
"-C"|"-oldcache"|"--oldcache") # set old cache directory
o_cache=$2 ; shift
;;
"-I"|"-oldimdir"|"--oldimdir") # set old image directory
o_imdir=$2 ; shift
;;
"-R"|"-oldroot"|"--oldroot") # set old iraf root directory
o_iraf=$2 ; shift
;;
*)
MSG "Unknown option '$1'"
exit 1
;;
esac
if [ "$2" = "" ]; then
break
else
shift
fi
done
#=============================================================================
# Get the values of o_iraf and o_imdir from the current mkiraf.*sh file, if
# not already otherwise defined. 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.
#=============================================================================
mkiraf=${iraf}/unix/hlib/mkiraf.sh
if [ "$o_iraf" = "" ]; then
o_iraf=$(grep "^iraf=" "$mkiraf" | sed -e "s+iraf=++" -e 's+"++g')
fi
o_iraf=$(echo "$o_iraf" | sed -e 's+/\(["]*\)$+\1+')
if [ "$o_imdir" = "" ]; then
o_imdir=$(grep "^imdir=" "$mkiraf" | sed -e "s+imdir=++" -e 's+"++g')
fi
o_imdir=$(echo "$o_imdir" | sed -e 's+/\(["]*\)$+\1+')
if [ "$o_cache" = "" ]; then
o_cache=$(grep "^cachedir=" "$mkiraf" | sed -e "s+cachedir=++" -e 's+"++g')
fi
o_cache=$(echo "$o_cache" | sed -e 's+/\(["]*\)$+\1+')
#=============================================================================
# User Check
#
# If we're doing a private install, initialize the $HOME/.iraf directory.
#=============================================================================
# Get the current user name.
WHOAMI=$(whoami)
if [ "$WHOAMI" = "root" ]; then
if [ "$do_system" = 0 ]; then
do_proceed="yes"
while [ "$do_proceed" = "yes" ]; do
BOLD_ON
ECHO "You are running as the root user: "
PROMPT "Install IRAF for all users on this machine?"
read ans
do_proceed="no"
if [ -n "$ans" ]; then
if [ "$ans" = "" ] || [ "$ans" = "y" ] || [ "$ans" = "yes" ]; then
ECHO "Proceeding with a system-wide install on this machine ..."
do_system=1
do_proceed="no"
elif [ "$ans" = "quit" ] || [ "$ans" = "q" ]; then
exit 0
elif [ "$ans" = "no" ] || [ "$ans" = "n" ]; then
ECHO "Proceeding with a personal install for 'root' ...."
do_system=0
do_proceed="no"
elif [ "$ans" = "help" ] || [ "$ans" = "h" ] || [ "$ans" = "?" ]; then
NEWLINE
MSG "If you proceed, IRAF will be installed on this machine for all"
MSG "users. This means that files and links will be put in the "
MSG "system directories such as /usr/include and a local bin dir,"
MSG "doing so requires root permission. If you say 'no', then IRAF"
MSG "will be installed as a personal system for the user."
NEWLINE
MSG "Type <cr> to continue, or 'q' to quit to exit."
NEWLINE
do_proceed="yes"
else
ECHO "Huh?"
do_proceed="yes"
fi
else
ECHO "Proceeding with a system-wide install on this machine ..."
do_system=1
do_proceed="no"
fi
done
fi
fi
if [ "$do_system" = 0 ]; then
if [ ! -e "$HOME/.iraf" ]; then
NEWLINE
ECHO "Initializing $HOME/.iraf directory ....."
NEWLINE
mkdir "$HOME/.iraf"
(cd "$HOME/.iraf" && mkdir imdir cache bin)
fi
fi
#=============================================================================
clear
NEWLINE
BOLD_ON;
ECHO " ===================================="
ECHO " IRAF $VERSION Installation"
ECHO " ===================================="
BOLD_OFF
NEWLINE
ECHO " Welcome to the IRAF installation script. This script will first"
ECHO " prompt you for several needed path names. Once the installation is"
ECHO " complete, you will be allowed to do some minimal system configuration."
# Print a quick usage summary.
NEWLINE
ECHO -n " For each prompt: hit "
BOLD_ON ; ECHO -n "<CR>"; BOLD_OFF;
ECHO -n " to accept the default value, "
BOLD_ON ; ECHO -n "'q'" ; BOLD_OFF
ECHO ' to quit,'
ECHO -n " or "
BOLD_ON ; ECHO -n "'help'"; BOLD_OFF
ECHO -n " or ";
BOLD_ON ; ECHO -n "'?'"; BOLD_OFF
ECHO -n " to print an explanation of the prompt."
NEWLINE
NEWLINE
#=============================================================================
# Prompt the user for needed paths.
#=============================================================================
NEWLINE
BOLD_ON
ECHO "========================================================================"
ECHO "===================== Query for System Settings ======================"
ECHO "========================================================================"
BOLD_OFF
NEWLINE
#=============================================================================
# Set $iraf, the new root directory for iraf. The system must already have
# been read in at this directory (e.g., /iraf/iraf), but we assume that no
# files have yet been modified.
#=============================================================================
iraf_prompt="yes"
if [ "$iraf" = "" ]; then
# Use the current directory.
d_iraf=$(pwd)
else
if [ "$p_iraf" ]; then
d_iraf="$p_iraf"
iraf_prompt="no"
else
d_iraf="$iraf"
fi
fi
while [ $iraf_prompt = "yes" ]; do
d_iraf=$(ECHO "$d_iraf" | sed -e 's+/\(["]*\)$+\1+')
iraf_prompt="no"
NEWLINE
BOLD_ON ; ECHO -n "New iraf root directory " ; BOLD_OFF
ECHO -n "($d_iraf): "
read iraf
if [ "$iraf" = "" ]; then
export iraf="$d_iraf"
break
elif [ "$iraf" = "quit" ] || [ "$iraf" = "q" ]; then
exit 0
elif [ "$iraf" = "help" ] || [ "$iraf" = "h" ] || [ "$iraf" = "?" ]; then
NEWLINE
MSG "The iraf root directory is the place where the IRAF tar"
MSG "file was unpacked; it contains subdirectories such as 'dev',"
MSG "'local', 'noao', 'pkg', and the file IS.PORT.GEN."
di=$d_iraf
if [ -d "$di/dev" ] && [ -d "$di/pkg" ] && [ -d "$di/noao" ]; then
MSG ""
MSG "The default path '$d_iraf' appears to be correct ..."
else
MSG ""
MSG "The default path '$d_iraf' appears to be incorrect ..."
fi
NEWLINE
iraf=$d_iraf
iraf_prompt="yes"
fi
done
#=============================================================================
# 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
imdir_prompt="yes"
if [ "$p_imdir" ]; then
imdir=$p_imdir
imdir_prompt="no"
elif [ "$do_system" = 0 ]; then
d_imdir="$HOME/.iraf/imdir"
elif [ -d "$o_imdir" ]; then
d_imdir=$o_imdir
elif [ -d "/iraf" ]; then
d_imdir=/iraf/imdirs
elif [ -d "/home/iraf" ]; then
d_imdir=/home/iraf/imdirs
elif [ -d "$iraf_p" ]; then
d_imdir=$iraf_p/imdirs
elif [ -d "/usr/local/iraf" ]; then
d_imdir=/usr/local/iraf/imdirs
else
d_imdir="/tmp"
fi
while [ "$imdir_prompt" = "yes" ]; do
imdir_prompt="no"
BOLD_ON ; ECHO -n "Default root image storage directory " ; BOLD_OFF
ECHO -n "($d_imdir): "
read imdir
if [ "$imdir" = "" ]; then
imdir="$d_imdir"
imdir_prompt="no"
elif [ "$imdir" = "quit" ] || [ "$imdir" = "q" ]; then
exit 0
elif [ "$imdir" = "help" ] || [ "$imdir" = "h" ] || [ "$imdir" = "?" ]; then
NEWLINE
MSG "The root imdir directory is the default image storage dir"
MSG 'for OIF images (i.e. the ".imh" format) used by all users on'
MSG "this system. Individual user dirs will be created as needed."
MSG "It should be some large data disk on the machine which has a"
MSG "regular backup, scratch or tmp disks should be avoided or data"
MSG "may be lost."
MSG ""
MSG 'The "HDR$" syntax should not be used at this stage, please'
MSG 'edit the hlib$mkiraf.sh script after installation if you wish'
MSG "to make this the default."
export imdir=$d_imdir
imdir_prompt="yes"
fi
# Cannot have iraf and imdir the same.
if [ "$imdir" = "$iraf" ]; then
NEWLINE
MSG "The definition of imdir cannot be the same as the iraf"
MSG "root, please choose a different directory. Ideally this"
MSG "should be some large data area on your system or a user"
MSG "data area such as /home, /users, /u1, etc."
NEWLINE
NEWLINE
imdir_prompt="yes"
fi
done
fi
#=============================================================================
# Set $cache, the default user file cache root directory.
#=============================================================================
if [ "$cache" = "" ]; then
cache_prompt="yes"
if [ "$p_cache" ]; then
cache=$p_cache
cache_prompt="no"
elif [ "$do_system" = 0 ]; then
d_cache="$HOME/.iraf/cache"
elif [ -d "/iraf" ]; then
d_cache="/iraf/cache"
elif [ -d "/home/iraf" ]; then
d_cache="/home/iraf/cache"
elif [ -d "$iraf_p" ]; then
d_cache="$iraf_p/cache"
elif [ -d "/usr/local/iraf" ]; then
d_cache="/usr/local/iraf/cache"
else
d_cache="/tmp"
fi
while [ "$cache_prompt" = "yes" ]; do
cache_prompt="no"
BOLD_ON ; ECHO -n "Default root cache directory " ; BOLD_OFF
ECHO -n "($d_cache): "
read cache
if [ "$cache" = "" ]; then
cache="$d_cache"
cache_prompt="no"
elif [ "$cache" = "quit" ] || [ "$cache" = "q" ]; then
exit 0
elif [ "$cache" = "help" ] || [ "$cache" = "h" ] || [ "$cache" = "?" ]; then
NEWLINE
MSG "The root cache directory is the default storage directory for"
MSG "URL-referenced files. Individual user dirs will be created as"
MSG "needed. It should be some large data disk on the machine "
MSG "which has a regular backup, scratch or tmp disks should be"
MSG "avoided or data may be lost."
MSG ""
NEWLINE
export cache=$d_cache
cache_prompt="yes"
fi
# Cannot have iraf and cache the same.
if [ "$cache" = "$iraf" ]; then
NEWLINE
MSG "The definition of cache cannot be the same as the iraf"
MSG "root, please choose a different directory. Ideally this"
MSG "should be some large data area on your system or a user"
MSG "data area such as /home, /users, /u1, etc."
NEWLINE
NEWLINE
cache_prompt="yes"
fi
done
fi
#=============================================================================
# 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
lbin_prompt="yes"
# Look around and come up with a likely candidate directory.
if [ "$p_lbin" ]; then
lbin=$p_lbin
lbin_prompt="no"
elif [ "$do_system" = 0 ]; then
d_lbin="$HOME/.iraf/bin/"
elif [ -d "/usr/local/bin" ]; then
d_lbin="/usr/local/bin"
elif [ -d "/opt/local/bin" ]; then
d_lbin="/opt/local/bin"
elif [ -d "/local/bin" ]; then
d_lbin="/local/bin"
else
d_lbin="/usr/bin"
fi
while [ "$lbin_prompt" = "yes" ]; do
lbin_prompt="no"
BOLD_ON ; ECHO -n "Local unix commands directory " ; BOLD_OFF
ECHO -n "($d_lbin): "
read lbin
if [ "$lbin" = "" ]; then
lbin="$d_lbin"
lbin_prompt="no"
elif [ "$lbin" = "quit" ] || [ "$lbin" = "q" ]; then
exit 0
elif [ "$lbin" = "help" ] || [ "$lbin" = "h" ] || [ "$lbin" = "?" ]; then
NEWLINE
MSG "The local bin directory is the system directory into which the"
MSG "iraf commands (e.g. cl, mkiraf, mkpkg, etc) will be installed"
MSG "as symlinks to files in the iraf tree. This should be a common"
MSG "dir such as /usr/local/bin which will likely be found in every"
MSG "user's path."
NEWLINE
export lbin=$d_lbin
lbin_prompt="yes"
fi
# Create the local bin directory if it doesn't exist?
if [ ! -e $lbin ]; then
if [ "$do_system" = 0 ]; then
ans="yes"
else
BOLD_ON ;
ECHO -n " Sorry, but $lbin does not exist, create it? "
BOLD_OFF
read ans
fi
if [ "$ans" = "" ] || [ "$ans" = "y" ] || [ "$ans" = "yes" ]; then
ECHO " Creating directory $lbin..."
if [ "$exec" = "yes" ]; then
mkdir $lbin
if [ ! -e $lbin ]; then
ERRMSG "Cannot create $lbin, please retry..."
export lbin=$d_lbin
lbin_prompt="yes"
fi
fi
else
lbin_prompt="yes"
fi
NEWLINE
fi
done
fi
bindir=$lbin
# Prompt for the terminal to use in a private installation.
if [ "$do_system" = 0 ]; then
if [ -z "$myterm" ] ; then
BOLD_ON
ECHO "Terminal types: xgterm, xtermjh, xterm, etc."
ECHO -n 'Enter default terminal type ('
BOLD_OFF
ECHO -n "$defterm"
BOLD_ON
ECHO -n '): '
BOLD_OFF
read myterm
if [ -z "$myterm" ]; then
myterm=$defterm
fi
fi
fi
#===============================================================================
# Determine iraf root directory
#===============================================================================
#===============================================================================
# Determine the old 'iraf', 'imdir' and 'cachedir' for editing.
#===============================================================================
#===============================================================================
# Verify the machine type.
#===============================================================================
if [ -e /usr/bin/uname ]; then
uname_cmd="/usr/bin/uname"
elif [ -e /bin/uname ]; then
uname_cmd="/bin/uname"
else
WARNING "No 'uname' command found to determine architecture."
exit 1
fi
export UNAME=$($uname_cmd | tr '[:upper:]' '[:lower:]')
if [ "$UNAME" = "sunos" ]; then
export UNAME_M=$($uname_cmd -m | cut -c2- | tr '[:upper:]' '[:lower:]')
else
export UNAME_M=$($uname_cmd -m | tr '[:upper:] ' '[:lower:]_')
fi
export OSVERSION=$($uname_cmd -r | cut -c1)
# ============================================
# The following is partially system dependent.
# ============================================
# Set the BINDIRS pathnames - directories where the HSI executables go.
host="$iraf/unix"
hbin="$iraf/unix/bin.$hmach"
hlib="$iraf/unix/hlib"
fbin="$iraf/bin"
# Replace any // by /.
host=$(echo "$host" | sed -e "s+//+/+g")
hbin=$(echo "$hbin" | sed -e "s+//+/+g")
fbin=$(echo "$fbin" | sed -e "s+//+/+g")
hlib=$(echo "$hlib" | sed -e "s+//+/+g")
# Strip any trailing /.
host=$(echo "$host" | sed -e 's+/\(["]*\)$+\1+')
hbin=$(echo "$hbin" | sed -e 's+/\(["]*\)$+\1+')
fbin=$(echo "$fbin" | sed -e 's+/\(["]*\)$+\1+')
hlib=$(echo "$hlib" | sed -e 's+/\(["]*\)$+\1+')
BINDIRS="$hbin $hlib $fbin $host"
# The following file lists are partially system dependent.
PATHFILES="mkiraf.${extn} cl.${extn} ecl.${extn} setup.sh setup.csh"
MODEFILES="cl.${extn} fc.${extn} mkiraf.${extn} mkfloat.${extn} mkmlist.${extn} $host/reboot 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 irafarch.${extn}"
LINKFILES="ecl.${extn} cl.${extn} mkiraf.${extn} mkmlist.${extn} generic.e mkpkg.e rmbin.e rmfiles.e rtar.e sgidispatch.e wtar.e rpp.e xpp.e xyacc.e xc.e"
LTARGETS="${hlib}/ecl.${extn} ${hlib}/cl.${extn} ${hlib}/mkiraf.${extn} ${hlib}/mkmlist.${extn} ${hbin}/generic.e ${hbin}/mkpkg.e ${hbin}/rmbin.e ${hbin}/rmfiles.e ${hbin}/rtar.e ${hbin}/sgidispatch.e ${hbin}/wtar.e ${hbin}/rpp.e ${hbin}/xpp.e ${hbin}/xyacc.e ${hbin}/xc.e"
CMDLINKS="ecl cl mkiraf mkmlist generic mkpkg rmbin rmfiles rtar sgidispatch wtar rpp xpp xyacc xc irafarch"
#===============================================================================
# Echo parameters, get go-ahead.
#===============================================================================
NEWLINE
BOLD_ON
ECHO "========================================================================"
ECHO "===================== Verifying System Settings ======================"
ECHO "========================================================================"
BOLD_OFF
NEWLINE
BOLD_ON; ECHO -n "Hostname = "; \
BOLD_OFF; ECHO "$(hostname)" | awk '{printf("%-20.20s ", $1)}'
BOLD_ON; ECHO -n "OS version = "; \
BOLD_OFF; ECHO "$($uname_cmd) $($uname_cmd -r)"
BOLD_ON; ECHO -n "Architecture = "; \
BOLD_OFF; ECHO "$mach" | awk '{printf("%-20s ", $1)}'
BOLD_ON; ECHO -n "HSI arch = "; \
BOLD_OFF; ECHO "$hmach" | awk '{printf("%-20s\n", $1)}'
BOLD_ON; ECHO -n "Old iraf root = "; \
BOLD_OFF; ECHO "$o_iraf" | awk '{printf("%-20s ", $1)}'
BOLD_ON; ECHO -n "New iraf root = "; \
BOLD_OFF; ECHO "$iraf" | awk '{printf("%-20s\n", $1)}'
BOLD_ON; ECHO -n "Old imdir = "; \
BOLD_OFF; ECHO "$o_imdir" | awk '{printf("%-20s ", $1)}'
BOLD_ON; ECHO -n "New imdir = "; \
BOLD_OFF; ECHO "$imdir" | awk '{printf("%-s\n", $1)}'
BOLD_ON; ECHO -n "Old cache = "; \
BOLD_OFF; ECHO "$o_cache" | awk '{printf("%-20s ", $1)}'
BOLD_ON; ECHO -n "New cache = "; \
BOLD_OFF; ECHO "$cache" | awk '{printf("%-s\n", $1)}'
NEWLINE
BOLD_ON; ECHO -n "Local bin dir = "; \
BOLD_OFF; ECHO "$bindir" | awk '{printf("%-20s\n", $1)}'
NEWLINE ; NEWLINE
#=============================================================================
# Prompt for the go-ahead ...
#=============================================================================
do_proceed="yes"
while [ "$do_proceed" = "yes" ]; do
PROMPT "Proceed with installation? "
read ans
do_proceed="no"
if [ "$ans" = "" ] || [ "$ans" = "y" ] || [ "$ans" = "yes" ]; then
NEWLINE
do_proceed="no"
elif [ "$ans" = "quit" ] || [ "$ans" = "q" ]; then
exit 0
elif [ "$ans" = "no" ] || [ "$ans" = "n" ]; then
exit 0
elif [ "$ans" = "help" ] || [ "$ans" = "h" ] || [ "$ans" = "?" ]; then
NEWLINE
MSG "If you proceed, the system will be installed on this machine."
MSG "This means that command links will be placed in the local bin"
MSG "directory, needed system files will be created, and the iraf"
MSG "root path will be edited into key files. Stopping at this stage"
MSG "will have no side effects on your system or the iraf files."
MSG "Type <cr> to continue, or 'q' to quit to exit the installation."
NEWLINE
do_proceed="yes"
else
ECHO "Huh?"
do_proceed="yes"
fi
done
# Constraints:
#
# - validate iraf root directory
# - imdir cannot be under iraf root directory
# - cache cannot be under iraf root directory
# - check for write permission on iraf directory
#
# - if [ sysinstall ]; then
# - check we're running with root/sudo permissions
# - check file permissions to $iraf, $iraf/unix, $iraf/unix/hlib
# fi
#
# - check that bin directory exists
# - delete existing command directory
# Do the actual installation. This involves:
#
# 1) Editing the $iraf path into system files
# 2) Creating the <iraf.h> link
# 3) Creating the system command links
# 4) Creating the image directory (imdir)
# 5) Creating the cache directory (cache)
# 6) Tape setup (modes on alloc.e and /dev tape devices)
# 7) Graphics/Display file installation/setup
#=============================================================================
# See whether there is an existing commands dir we need to delete.
#=============================================================================
NEWLINE
BOLD_ON
ECHO "========================================================================"
ECHO "========================= Begin Installation ========================="
ECHO "========================================================================"
BOLD_OFF
NEWLINE
NEWLINE
ECHO -n "Checking for existing commands directory... "
cl_found=0
clpath=""
paths=$(echo "$PATH" | sed -e "s/:/ /g")
for d in ${paths}; do
if [ -e "$d/cl" ]; then
cl_found=1
clpath="$d/cl"
break
fi
done
if [ "$do_system" = 0 ]; then
cl_found=0
fi
if [ "$cl_found" = 1 ]; then
o_lbin=${clpath%/*}
if [ "$o_lbin" != "$lbin" ]; then
DO_WARN
NEWLINE
MSG "IRAF commands were found in the directory:"
MSG ""
MSG " $o_lbin"
MSG ""
MSG " These commands may conflict with the commands now being"
MSG "installed in: '$lbin'"
MSG ""
del_cmd_="yes"
while [ "$del_cmd_" = "yes" ]; do
PROMPT "Do you want to delete commands in the old directory? "
read ans
del_cmd_="no"
if [ -n "$ans" ]; then
if [ "$ans" = "y" ] || [ "$ans" = "yes" ]; then
NEWLINE
for i in ${CMDLINKS}; do # remove the iraf commands
file=$o_lbin/$i
if [ -e "$file" ]; then
MSG "Deleting old command $file ..."
if [ "$exec" = "yes" ]; then
RM "$file" >> /dev/null 2>&1
fi
fi
done
del_cmd_="no"
elif [ "$ans" = "quit" ] || [ "$ans" = "q" ]; then
exit 1
elif [ "$ans" = "no" ] || [ "$ans" = "n" ]; then
del_cmd_="no"
elif [ "$ans" = "help" ] || [ "$ans" = "h" ] || [ "$ans" = "?" ]; then
NEWLINE
MSG "Multiple commands such as 'cl' or 'mkiraf' on a machine"
MSG "may cause errors (such as 'command not found' due to an"
MSG "invalid link), or confusions as to which version of iraf"
MSG "is being run if the old link is still valid. This is"
MSG "because the command being used depends on the order in"
MSG 'which the directories occur in the users "$path" environ-'
MSG "ment variable (which may vary by user)."
MSG ""
MSG "It is recommended there be only one iraf command directory"
MSG "on a given system, other methods can be used to start a"
MSG "different IRAF installation. This script will not auto-"
MSG "matically remove those links, and will only correct the"
MSG "path is the local bin directory is the same as before."
MSG ""
MSG "Type 'q' to quit and rerun the install script to specify"
MSG "a different local bin directory, 'yes' to remove the old"
MSG "links, and 'no' to leave the old commands around."
MSG ""
NEWLINE
del_cmd_="yes"
else
NEWLINE
for i in ${CMDLINKS}; do # remove the iraf commands
file=$o_lbin/$i
if [ -e "$file" ]; then
MSG "Deleting old command $file ..."
if [ "$exec" = "yes" ]; then
RM "$file" >> /dev/null 2>&1
fi
fi
done
del_cmd_="no"
fi
fi
NEWLINE
done
else
DO_OK
fi
else
DO_OK
fi
# Step 1) Edit the $iraf path into the system files
NEWLINE
BOLD_ON
ECHO " Editing Paths"
ECHO " -------------"
BOLD_OFF
# Edit the $iraf pathname in the .login file for user 'iraf'.
if [ "$do_system" = 0 ]; then
ECHO -n "Editing the user login/rc files ... "
pfiles="$HOME/.bashrc $HOME/.profile $HOME/.bash_profile $HOME/.bash_login $HOME/.cshrc $HOME/.login"
fi
for file in ${pfiles}; do
if [ -e "$file" ]; then
if [ "$exec" = "yes" ]; then
sed -i.bak -e "s+$o_iraf+$iraf+" "$file"
RM "${file}.bak"
fi
fi
done
DO_OK
# Edit the $iraf and $imdir paths in mkiraf.*sh, *cl.*sh, and libc/iraf.h
# files.
ECHO -n "Editing iraf/imdir/cache paths into system files ... "
err_seen=0
for i in ${PATHFILES}; do
if [ -e "$iraf/unix/hlib/$i" ]; then
sed -i.bak \
-e "s|$o_iraf|$iraf|" \
-e "s|$o_cache|$cache|" \
-e "s|$o_imdir|$imdir|" \
"$iraf/unix/hlib/$i"
RM "${iraf}/unix/hlib/${i}.bak"
else
if [ "$err_seen" = 0 ]; then
DO_FAIL
err_seen=1
err_count=$(( err_count+1 ))
fi
MSG "File $i not found."
fi
done
if [ "$err_seen" = 0 ]; then
DO_OK
fi
# Create the root imdir as a public scratch directory, if not already
# created.
err_seen=0
if [ -d "$imdir" ]; then
if [ -x $"imdir" ]; then
ECHO -n 'Checking imdir permissions ...'
ECHO -n ' '
else
ECHO -n 'Setting mode for $imdir to 0777'
ECHO -n ' '
if [ "$exec" = "yes" ]; then
chmod 777 "$imdir"
fi
fi
else
if [ "$do_system" = 1 ]; then
ECHO -n "Creating root imdir at $imdir ... "
else
ECHO -n 'Creating root imdir at $HOME/.iraf/imdir ... '
ECHO -n ' '
fi
if [ "$exec" = "yes" ]; then
mkdir $imdir; chmod 777 $imdir
fi
fi
if [ "$err_seen" = 0 ]; then
DO_OK
fi
# Create the root cache as a public scratch directory, if not already
# created.
err_seen=0
if [ -d "$cache" ]; then
if [ -x "$cache" ]; then
ECHO -n 'Checking cache permissions ...'
ECHO -n ' '
else
ECHO -n 'Setting mode for $cache to 0777 '
if [ "$exec" = "yes" ]; then
chmod 777 $cache
fi
fi
else
if [ "$do_system" = 1 ]; then
ECHO -n "Creating root cache at $cache ... "
else
ECHO -n 'Creating root cache at $HOME/.iraf/cach ... '
ECHO -n ' '
fi
if [ "$exec" = "yes" ]; then
mkdir $cache; chmod 777 $cache
fi
fi
if [ "$err_seen" = 0 ]; then
DO_OK
fi
NEWLINE
BOLD_ON
ECHO " Creating File Links"
ECHO " -------------------"
BOLD_OFF
# Create a /iraf symlink on the system to establish a /iraf/iraf root
# path regardless of the actual root dir. We only do this if there is
# no /iraf on the system already.
if [ "$do_system" = 1 ]; then
ECHO -n "Checking for /iraf symlink ... "
if [ ! -e "/iraf" ]; then
if [ "$exec" = "yes" ]; then
ln -s "$iraf_p" /iraf
fi
if [ "$exec" = "no" ] || [ -e "/iraf/iraf" ]; then
DO_OK
else
DO_FAIL
err_count=$(( err_count+1 ))
fi
else
DO_OK
fi
# 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.
# Verify we have a /usr/include directory (some MacOSX systems won't)
ECHO -n "Checking /usr/include directory ... "
if [ ! -e /usr/include ]; then
if [ $exec = yes ]; then
mkdir /usr/include
if [ -d /usr/include ]; then
DO_OK
else
DO_FAIL
err_count=$(( err_count+1 ))
fi
else
DO_OK
fi
else
DO_OK
fi
ECHO -n "Creating <iraf.h> symlink ... "
file1="/usr/include/iraf.h"
file2="$iraf/unix/hlib/libc/iraf.h"
err_seen=0
if [ -e "$file1" ]; then
if [ "$($LS -l $file1 | grep $file2)" = "" ]; then
if [ "$exec" = "yes" ]; then
RM "$file1"
ln -s "$file2" "$file1"
fi
fi
else
if [ "$exec" = "yes" ]; then
RM "$file1"
ln -s "$file2" "$file1"
fi
fi
if [ "$exec" = "no" ]; then
DO_OK
elif [ "$err_seen" = 0 ] && [ -e "$file1" ]; then
DO_OK
else
DO_FAIL
err_count=$(( err_count+1 ))
fi
else # else of 'do_system'
ECHO -n "Creating <iraf.h> symlink ... "
file1="$HOME/.iraf/iraf.h"
file2="$iraf/unix/hlib/libc/iraf.h"
err_seen=0
if [ -e "$file1" ]; then
if [ "$($LS -l $file1 | grep $file2)" = "" ]; then
if [ "$exec" = "yes" ]; then
RM "$file1"
ln -s "$file2" "$file1"
fi
fi
else
if [ "$exec" = "yes" ]; then
RM "$file1"
ln -s "$file2" "$file1"
fi
fi
if [ "$exec" = "no" ]; then
DO_OK
elif [ "$err_seen" = 0 ] && [ -e "$file1" ]; then
DO_OK
else
DO_FAIL
err_count=$(( err_count+1 ))
fi
ECHO -n 'Marking system architecture ... '
if [ "$exec" = "yes" ]; then
if [ -e "$HOME/.iraf/arch" ]; then
RM "$HOME/.iraf/arch"
fi
echo "$IRAFARCH" > "$HOME/.iraf/arch"
fi
DO_OK
fi # end of 'do_system'
# Establish the remaining symbolic links to HSI tasks.
ECHO -n "Creating iraf command links in local bin dir ... "
err_seen=0
if [ $old_links = 1 ]; then
for i in ${LINKFILES}; do
# Locate the file to be linked to.
file1=${i%.*}
for j in ${BINDIRS}; do
file2="$j/$file1.${extn}"
if [ -e "$file2" ]; then
break
fi
file2="$j/$i"
if [ -e "$file2" ]; then
break
fi
done
# Verify or set the link.
if [ -e "$lbin/$file1" ]; then
if [ "$($LS -l $lbin/$file1 | grep $file2)" = "" ]; then
if [ "$exec" = "yes" ]; then
RM "$lbin/$file1"
ln -s "$file2" "$lbin/$file1"
fi
fi
else
if [ "$exec" = "yes" ]; then
RM "$lbin/$file1"
ln -s "$file2" "$lbin/$file1"
fi
fi
if [ "$exec" = "yes" ]; then
if [ ! -e "$lbin/$file1" ]; then
if [ "$err_seen" = 0 ]; then
DO_FAIL
fi
MSG "Could not make link $file1 -> $file2"
err_seen=1
err_count=$(( err_count+1 ))
fi
fi
done
else
# Create the command links, regardless of whether the target binaries exist.
# This allows us to create links on a source-only system.
for file2 in ${LTARGETS}; do
file1=$(basename "$file2" | cut -d. -f1)
# Verify or set the link.
if [ -e "$lbin/$file1" ]; then
if [ "$($LS -l $lbin/$file1 | grep $file2)" = "" ]; then
if [ "$exec" = "yes" ]; then
RM "$lbin/$file1"
ln -s "$file2" "$lbin/$file1"
fi
fi
else
if [ "$exec" = "yes" ]; then
RM "$lbin/$file1"
ln -s "$file2" "$lbin/$file1"
fi
fi
done
fi
if [ "$err_seen" = 0 ]; then
DO_OK
fi
# Mark the system update time.
ECHO -n 'Marking system update time hlib$utime ... '
if [ "$exec" = "yes" ]; then
touch "$hlib/utime"
fi
DO_OK
#=============================================================================
# Common code for XGTERM/XIMTOOL installation.
#=============================================================================
NEWLINE
BOLD_ON
ECHO " Creating Graphics Device Files"
ECHO " ------------------------------"
BOLD_OFF
#=============================================================================
# Install the default IMTOOLRC frame buffer configuration file. The path
# /usr/local/lib path hardwired in to ximtool 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.
if [ "$do_system" = 1 ]; then
ECHO -n "Checking /usr/local/lib directory ... "
if [ ! -e "/usr/local/lib" ]; then
if [ "$exec" = "yes" ]; then
if [ ! -e "/usr/local" ]; then
mkdir /usr/local
fi
mkdir /usr/local/lib
if [ -d "/usr/local/lib" ]; then
DO_OK
else
DO_FAIL
err_count=$(( err_count+1 ))
fi
else
DO_OK
fi
else
DO_OK
fi
fi
# Verify or set the IMTOOLRC link.
if [ "$do_system" = 1 ]; then
file1=/usr/local/lib/imtoolrc
ECHO -n "Creating /usr/local/lib/imtoolrc link ... "
else
file1=$HOME/.imtoolrc
ECHO -n 'Creating $HOME/.imtoolrc link ... '
fi
/bin/rm -f "$file1"
file2=$iraf/dev/imtoolrc
err_seen=0
if [ -e "$file1" ]; then
if [ "$($LS $file1)" = "$file1" ]; then
if [ "$($LS -l $file1 | grep $file2)" = "" ]; then
if [ "$exec" = "yes" ]; then
RM "$file1"
ln -s "$file2" "$file1"
fi
fi
fi
else
if [ "$exec" = "yes" ]; then
if [ -e "$file1" ]; then
RM "$file1"
fi
ln -s "$file2" "$file1"
fi
fi
if [ "$exec" = "no" ]; then
DO_OK
elif [ "$err_seen" = 0 ] && [ -e "$file1" ]; then
DO_OK
else
DO_FAIL
err_count=$(( err_count+1 ))
fi
# Install links for the X11IRAF binaries.
ECHO -n "Creating X11IRAF links ... "
if [ "$do_system" = 0 ]; then
xfiles="xgterm ximtool ism_wcspix.e"
for f in ${xfiles}; do
if [ -e "$iraf/vendor/x11iraf/bin.$IRAFARCH/$f" ]; then
if [ "$exec" = "yes" ]; then
if [ -e "$HOME/.iraf/bin/$f" ]; then
RM "$HOME/.iraf/bin/$f"
fi
ln -s "$iraf/vendor/x11iraf/bin.$IRAFARCH/$f" "$HOME/.iraf/bin/$f"
fi
fi
done
fi
DO_OK
#=============================================================================
# Initialize the login.cl/uparm for a personal installation
#=============================================================================
if [ "$do_system" = 0 ]; then
NEWLINE
BOLD_ON
ECHO " Initializing Login Files"
ECHO " ------------------------"
BOLD_OFF
cur=$PWD
if [ ! -e "$HOME/.iraf" ]; then
mkdir "$HOME/.iraf"
fi
cd "$HOME/.iraf"
ECHO -n "Creating global login.cl and uparm directory .... "
"$iraf/unix/hlib/mkiraf.sh" --default --init --term="$myterm" > /dev/null 2>&1
if [ -e "$HOME/.iraf/login.cl" ]; then
DO_OK
else
DO_FAIL
fi
cd "$cur"
# Add the setup to the user's login files.
if [ "$do_csh" = 1 ] && [ "$exec" = "yes" ]; then
cfiles="$HOME/.cshrc $HOME/.tcshrc $HOME/.login"
for file in ${cfiles}; do
if ! grep -qs iraf/setup.csh "$file"; then
if [ -e "$file" ] ; then
cp "$file" "${file}.bak"
else
touch "$file"
fi
cat >> $file <<EOF
# Add iraf setup commands
if ( -e $HOME/.iraf/setup.csh ) then
source $HOME/.iraf/setup.csh
endif
EOF
fi
done
fi
if [ "$exec" = "yes" ]; then
bfiles="$HOME/.bashrc $HOME/.profile $HOME/.bash_profile $HOME/.bash_login"
for file in ${bfiles}; do
if ! grep -qs iraf/setup.sh "$file"; then
if [ -e "$file" ] ; then
cp "$file" "${file}.bak"
else
touch "$file"
fi
cat >> $file <<EOF
# Add iraf setup commands
if [ -e $HOME/.iraf/setup.sh ]; then
source $HOME/.iraf/setup.sh
fi
EOF
fi
done
fi
fi
#=============================================================================
# Finish up and set the exit status.
#=============================================================================
NEWLINE ; NEWLINE
if [ "$err_count" = 0 ]; then
BOLD_ON
ECHO "========================================================================"
ECHO -n "Congratulations! "
BOLD_OFF
ECHO "IRAF has been successfully installed on this system."
BOLD_ON
ECHO "========================================================================"
BOLD_OFF
NEWLINE
if [ "$do_system" = 1 ]; then
ECHO " To begin using the system simply log in as any user and from the"
ECHO "directory you wish to use as your iraf login directory type:"
ECHO ""
ECHO -n ' % ';
BOLD_ON; ECHO -n 'mkiraf'; BOLD_OFF
ECHO ' # create a login.cl file'
ECHO -n ' % ';
BOLD_ON; ECHO -n 'cl '; BOLD_OFF
ECHO ' # start IRAF'
ECHO ""
ECHO "The 'iraf' user is already configured with a login.cl file so a simple"
ECHO "'cl' command is sufficient to start the system."
else
ECHO " To begin using IRAF you can simply type"
ECHO ""
ECHO -n ' % ';
BOLD_ON; ECHO 'source ~/.login '; BOLD_OFF
ECHO -n ' % ';
BOLD_ON; ECHO 'cl '; BOLD_OFF
ECHO ""
ECHO "From any directory to use the global login files created in the"
BOLD_ON ; ECHO -n "$HOME/.iraf " ; BOLD_OFF
ECHO "directory. If you wish to have a login.cl/uparm that"
ECHO "is specific to a particular directory, you will need to type"
ECHO ""
ECHO -n ' % ';
BOLD_ON; ECHO -n 'mkiraf'; BOLD_OFF
ECHO ' # create a login.cl file (needed once)'
ECHO -n ' % ';
BOLD_ON; ECHO -n 'cl '; BOLD_OFF
ECHO ' # start IRAF'
ECHO ""
fi
ECHO "Additional user information can be found at the iraf community web site:"
NEWLINE
BOLD_ON ; ECHO " https://iraf-community.github.io" ; BOLD_OFF
NEWLINE
ECHO "Please create an issue on https://github.com/iraf-community/iraf/issues"
ECHO "in case of problems."
NEWLINE
NEWLINE
BOLD_ON
ECHO "========================================================================"
ECHO "================ Installation Completed With No Errors ==============="
ECHO "========================================================================"
BOLD_OFF
NEWLINE
exit 0
else
BOLD_ON
ECHO "========================================================================"
ECHO "================= Installation Completed With Errors ================="
ECHO "========================================================================"
BOLD_OFF
NEWLINE
exit 1
fi
exit 0
|