Ubuntu Pastebin

Paste from BlackDalek at Tue, 4 Aug 2015 10:21:22 +0000

Download as text
   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
#!/bin/sh
#
# @(#)install.sh.m4 1.0 04/04/02 XSSC
#
# Installed System software for Fuji Xerox AP Printers.
#
copyright="Copyright(C) 2009 by Fuji Xerox Asia Pacific Pte Ltd. All rights reserved."
progtitle="FXAP UNIX Driver Installer for Redhat Linux"
progname="$0"
PATH=/usr/ucb:/bin:/etc:/usr/bin:/usr/etc:/usr/sbin
# Setup default parameters
PrinterName=""
HOSTNAME=""         # net install host name
TAPEDEV="/dev/fd0"
REWIND=""
#### directorys ###
ROOT=
CURDIR="`pwd`"
SAVEDIR="`pwd`/SAVED"
## DocuCentre C400 Series
PACKAGE400="uxdriver.tar"
BINDIR400="${ROOT}/usr/local/fxbinC400"
LIBDIR400="${ROOT}/usr/lib/fxpsC400"
ETCDIR400="${ROOT}/usr/local/fxetcC400"
## DocuPrint C2428 Series
PACKAGE2428="uxdriver2.tar"
BINDIR2428="${ROOT}/usr/local/fxbin2428"
LIBDIR2428="${ROOT}/usr/lib/fxps2428"
ETCDIR2428="${ROOT}/usr/local/fxetc2428"
## DocuCentre-II C3000 Series
PACKAGE3000="uxdriver3.tar"
BINDIR3000="${ROOT}/usr/local/fxbin3000"
LIBDIR3000="${ROOT}/usr/lib/fxps3000"
ETCDIR3000="${ROOT}/usr/local/fxetc3000"
##
SAMPLEDIR="${ROOT}/usr/local/fxsrc"
MANDIR="${ROOT}/usr/man/ja_JP.ujis"
MANDIR2="${ROOT}/usr/man/ja_JP.eucJP"
MANDIRF="${ROOT}/usr/share/man/ja"
PRINTCAP="${ROOT}/etc/printcap"
TERMINFO="${ROOT}/usr/share/lib/terminfo"
MODEL_PATH="${ROOT}/usr/lib/lp/model"
ETC="${ROOT}/etc"
RESOURCEDIR="${ROOT}/usr/X11R6/lib/X11/app-defaults"
### utility for installation ###
bins="euc2ps2 fxoption tiff2ps2 xwd2ps2"
libs="fxpof fxoption_exec string_from_printcap fxbanner.ps fxpif_sample.sh"
printcap="printcap.add"
filter="fxpif fxpof fxpvf fxpg4f"
filter_add="A3 A4"
## DocuPrint C400 Series
defaults400=".fxpsdefaultC400"
man1400="euc2psC2400.1 fxoptionC400.1 fxpifC400.1 fxpofC400.1 fxpvfC400.1 fxpg4fC400.1 tiff2ps2C400.1 tiff2g4C400.1 xwd2ps2C400.1 xwd2g4C400.1"
man5400="fxpsdefaultC400.5"
## DocuPrint C2428 Series
defaults2428=".fxpsdefault2428"
man12428="euc2ps22428.1 fxoption2428.1 fxpif2428.1 fxpof2428.1 fxpvf2428.1 fxpg4f2428.1 tiff2ps22428.1 tiff2g42428.1 xwd2ps22428.1 xwd2g42428.1"
man52428="fxpsdefault2428.5"
## DocuCentre-II C3000 Series
defaults3000=".fxpsdefault3000"
man13000="euc2ps23000.1 fxoption3000.1 fxpif3000.1 fxpof3000.1 fxpvf3000.1 fxpg4f3000.1 tiff2ps23000.1 tiff2g43000.1 xwd2ps23000.1 xwd2g43000.1"
man52428="fxpsdefault3000.5"
## GUI Tool
bins_gui="ufptool"
bins_gui5="ufptool5"
bins_gui7="ufptool7"
bins_gui_file=".UFPDefault"
resource_gui_file="Ufptool"

################################
## Printer Model Registration ##
################################
RegisterPrinterModels() {
     Model DCC400        FXDCC400.fd     "Document Centre C240/C320/C400"
     Model DPC2428       FXDPC2428.fd    "DocuPrint C2428"
     Model DCC450        FXDCC450.fd     "Document Centre  C450/C360/C250"
     Model APC6550       FXAPC6550.fd    "ApeosPort C6550 I/C5540 I"
     Model DCC6550       FXDCC6550.fd    "DocuCentre C6550 I/C5540 I"
     Model AP2C4300      FXAP2C4300.fd   "ApeosPort-II C4300/C3300/C2200"
     Model DC2C4300      FXDC2C4300.fd   "DocuCentre-II C4300/C3300/C2200"
     Model DC2C3000      FXDC2C3000.fd   "DocuCentre-II C3000"
     Model AP2C7500      FXAP2C7500.fd   "ApeosPort-II C7500/C6500/C5400"
     Model DC2C7500      FXDC2C7500.fd   "DocuCentre-II C7500/C6500/C5400"
     Model AP3C3300      FXAP3C3300.fd   "ApeosPort-III C2201/C2200/C3300"
     Model DC3C3300      FXDC3C3300.fd   "DocuCentre-III C2201/C2200/C3300"
     Model AP3C4400      FXAP3C4400.fd   "ApeosPort-III C4400"
     Model DC3C4400      FXDC3C4400.fd   "DocuCentre-III C4400"
     Model AP3C7600      FXAP3C7600.fd   "ApeosPort-III C7600/C6500/C5500"
     Model DC3C7600      FXDC3C7600.fd   "DocuCentre-III C7600/C6500/C5500"
     Model BinaryInstall2428     dummy2428.fd   "Binary update only"
} #EndRegisterPrinterModels
# model_pt<n> ... printer model name
# model_fd<n> ... Solaris FD file name
# model_mn<n> ... menu string
Model() {
    [ x"$ModelCount" = x ] && ModelCount=0
    eval ModelCount=`expr $ModelCount + 1`
    eval model_pt$ModelCount=$1
    eval model_fd$ModelCount=$2
    eval model_mn$ModelCount="\"$3\""
    eval fd_$1=$2
}
## Display Model Selet Menu
ModelSelectMenu() {
    echo "Please wait..."
    RegisterPrinterModels
    clear
    echo "$progtitle"
    echo "$copyright"
    echo ""
    echo "Printer Model?"
    i=1
    tmp=$i
    menustr=x
    while [ x"$menustr" != xExit ]
    do
        eval menustr="\"\$model_mn$i\""
        [ $i -gt $ModelCount ] && menustr="Exit"
        echo "  ${i}. $menustr"
        [ $i -gt 1 ] && tmp="${tmp}/${i}"
        i=`expr $i + 1`
    done
    i=""
    while [ "`expr $i + 0 2>&1`" != "$i" ]
    do
        echo -n "Enter Process No(${tmp})?:"
        read i
    done
    if [ $i -gt $ModelCount ]
    then
        EJECT
        exit
    fi
    eval PrinterName=\$model_pt$i
    if [ "`P400check`" = "true" ]
    then
        PACKAGE=$PACKAGE400
        BINDIR=$BINDIR400
        LIBDIR=$LIBDIR400
        defaults=$defaults400
        ETCDIR=$ETCDIR400
        man1=$man1400
        man5=$man5400
    elif [ "`P2428check`" = "true" ]
    then
        PACKAGE=$PACKAGE2428
        BINDIR=$BINDIR2428
        LIBDIR=$LIBDIR2428
        defaults=$defaults2428
        ETCDIR=$ETCDIR2428
        man1=$man12428
        man5=$man52428
    elif [ "`P3000check`" = "true" ]
    then
        PACKAGE=$PACKAGE3000
        BINDIR=$BINDIR3000
        LIBDIR=$LIBDIR3000
        defaults=$defaults3000
        ETCDIR=$ETCDIR3000
        man1=$man13000
        man5=$man53000
    fi
}
### DocuPrint C400 Series Check ###
P400check() {
   if [ "${PrinterName}" = "DCC400" ]
    then
        echo "true"     # DocuCentre Color 400/320/240/160 Series
    else
        echo "false"    # Not DocuPrint C400 Series
    fi
}
### DocuPrint C2428 Series Check ###
P2428check() {
    if [ "${PrinterName}" = "DPC2428" ]
    then
        echo "true"     # DocuPrint C2428 Series
    elif [ "${PrinterName}" = "DCC450" ]
    then
        echo "true"     # Document Centre C450/C360/C250 Series
    elif [ "${PrinterName}" = "APC6550" ]
    then
        echo "true"     # ApeosPort C6550 I/C5540 I Series
    elif [ "${PrinterName}" = "DCC6550" ]
    then
        echo "true"     # DocuCentre C6550 I/C5540 I Series
    elif [ "${PrinterName}" = "AP2C4300" ]
    then
        echo "true"     # ApeosPort-II C4300/C3300/C2200 Series
    elif [ "${PrinterName}" = "DC2C4300" ]
    then
        echo "true"     # DocuCentre-II C4300/C3300/C2200 Series
    elif [ "${PrinterName}" = "AP2C7500" ]
    then
        echo "true"     # ApeosPort-II C7500/C6500/C5400 Series
    elif [ "${PrinterName}" = "DC2C7500" ]
    then
        echo "true"     # DocuCentre-II C7500/C6500/C5400 Series
    elif [ "${PrinterName}" = "AP3C3300" ]
    then
		echo "true"     # ApeosPort-III C2201/C2200/C3300 Series
    elif [ "${PrinterName}" = "DC3C3300" ]
    then
		echo "true"     # DocuCentre-III C2201/C2200/C3300 Series
    elif [ "${PrinterName}" = "AP3C4400" ]
    then
		echo "true"     # ApeosPort-III C4400 Series
    elif [ "${PrinterName}" = "DC3C4400" ]
    then
		echo "true"     # DocuCentre-III C4400 Series
    elif [ "${PrinterName}" = "AP3C7600" ]
    then
		echo "true"     # ApeosPort-III C7600/C6500/C5500 Series
    elif [ "${PrinterName}" = "DC3C7600" ]
    then
		echo "true"     # DocuCentre-III C7600/C6500/C5500 Series
    elif [ "${PrinterName}" = "BinaryInstall2428" ]
    then
        echo "true"     # BinaryInstall
    else
        echo "false"    # Not DocuPrint C2428 Series
    fi
}
### DocuCentre-II C3000 Series Check ###
P3000check() {
   if [ "${PrinterName}" = "DC2C3000" ]
    then
        echo "true"     # DocuCentre-II C3000 Series
    else
        echo "false"    # Not DocuCentre-II C3000 Series
    fi
}
################################
# Local functions
#
### turn off MSI/MailBox/Sorter
CutOff() {
    egrep -v 'MSI|m1|m2|m3|m4|m5|m6|m7|m8|m9|m10|Ost' $1
}
### get OS Major Version ###
OSMVersion() {
    uname -r | awk '{printf ("%s",1)}'
}
### get OS Version ###
OSVersion() {
    uname -r | awk '{printf ("%s",1)}'
}
### nlecho message ###
nlecho() {
    echo
    echo $*
}
### errorexit exitcode message ###
errorexit() {
    nlecho "$progname:$2" 1>&2
    ${EJECT}
    echo
    exit $1
}
### readparam message default_value
readparam() {
    if [ "$2" = "" ]
    then
        echo
        echo -n "$1:"
        read parameter
    else
        echo
        echo -n "$1[$2]:"
        read parameter
        parameter="${parameter:-$2}"
    fi
}
### readenum message default_value
readenum() {
    parameter=""
    while [ "${parameter}" = "" ]
    do
        echo
        echo -n "$1(1:$2 2:$3):"
        read parameter
        if [ "${parameter}" = "1" ]
        then
            parameter="$2"
        elif [ "${parameter}" = "2" ]
        then
            parameter="$3"
        else
            parameter=""
        fi
    done
}
### ask 'y' or 'n' ###
YesNo() {
    ans=""
    case "$2" in
        Yes|y)
            dmsg="y"
            ;;
        No|n)
            dmsg="n"
            ;;
        *)
            dmsg=""
            ;;
    esac
    while [ "$ans" = "" ]
    do
        echo
        echo -n "$1(y/n)${dmsg:+[$dmsg]}:"
        read ans
        ans="${ans:-$dmsg}"
        if [ "$ans" = "y" -o "$ans" = "n" ]
        then
            return
        fi
        echo "You must select 'y' or 'n'."
        ans=""
    done
}
### Menu ###
Menu() {
    n=$#
    i=1
    tmp=$i
    while [ $i -le $n ]
    do
        echo "  ${i}. $1"
        if [ $i -gt 1 ]
        then
            tmp="${tmp}/${i}"
        fi
        eval param_$i="\"$1\""
        shift
        i=`expr $i + 1`
    done
    i=""
    while [ "`expr $i + 0 2>&1`" != "$i" ]
    do
        echo -n "Enter Process No(${tmp})?:"
        read i
    done
    eval ans=\$param_"$i"
    return $i
}
### Extract ###
Extract() {
    install_directory=$1
    shift 1
    install_Zfiles=""
    install_files=""
    for f in $*
    do
        if ((found "${bins_solaris}" ${f}) && [ "`OSMVersion`" = "5" ])
        then
            install_Zfiles="${install_Zfiles} ${f}5.Z"
        else
            install_Zfiles="${install_Zfiles} $f.Z"
        fi
        install_files="${install_files} $f"
    done
    ${REWIND}
    cwd=`pwd`
    cd ${CURDIR}
    tar xvf ${TAPEDEV} ${install_Zfiles}
    for f in ${install_files}
    do
        gunzip ${f}
        install -g bin -o root $f ${install_directory}
        /bin/rm ${CURDIR}/$f
    done
    cd $cwd
}
### filename ###
filename() {
    set `echo $1 | sed 's/\// /g'`
    shift `expr $# - 1`
    echo $1
}
### found ###
found() {
    for i in $1
    do
        if [ "${i}" = $2 ]
        then
            return 0
        fi
    done
    return 1
}
### keyedit edit_file key addfile saved ###
keyedit() {
    echo -n "   $1 ... "
    RC=255
    grep "$2" $1 >/dev/null 2>&1
    case "$?" in
        0)
            echo "already edited."
            ;;
        2)
            echo "file not found."
            ;;
        1)
            if [ ! -f "$4/`filename $1`" ]
            then
                cp $1 $4
                RC=0
            fi
            if [ -w $1 ]
            then
                cat $3 >> $1 2>/dev/null
                echo "done"
            else
                echo "Permission denied."
            fi
            ;;
    esac
    return ${RC}
}
### read parameter with confirm ###
ReadParamWithConfirm() {
    parameter=""
    while [ "${parameter}" = "" ]
    do
        readparam "Enter $1?" "$2"
        if [ "$#" = "2" ]
        then
            YesNo "$1 is '${parameter}'" "y"
            if [ "$ans" = "n" ]
            then
                parameter=""
            fi
        elif [ $3 ${parameter} ]
        then
            parameter=""
        fi
    done
}
### read printer name with confirm ###
ReadPrinterNameWithConfirm() {
    parameter=""
    while [ "${parameter}" = "" ]
    do
        readparam "Enter $1?" "$2"
        if (echo ${parameter} | grep "[^a-zA-Z0-9_]")
        then
            echo "$1 can only contain alphanumeric characters and underscores"
            parameter=""
        else
            if [ "`echo -n ${parameter} | wc -c`" -le 14 ]
            then
                YesNo "$1 is '${parameter}'" "y"
                if [ "$ans" = "n" ]
                then
                    parameter=""
                fi
            else
                echo "$1 exceeds 14 characters"
                parameter=""
            fi
        fi
    done
}
##
mk_LIBDIR() {
    ### disk free space check
    df
    echo
    echo "This Software requires at least 20MB disk space."
    echo "Enter a new directory at the following prompt,if you want change the path."
    LINKDIR=""
    WORKPARAM=""
    OK="n"
    while [ "${LINKDIR}" = "" ]
    do
        while [ "${OK}" = "n" ]
        do
            readparam "Enter directory name" "${LIBDIR}"
            if [ `expr substr ${parameter} 1 1` != "/" ]
            then
                YesNo "directory is '`pwd`/${parameter}'  " n
                WORKPARAM="`pwd`/${parameter}"
            else
                YesNo "directory is '${parameter}'  " n
                WORKPARAM="${parameter}"
            fi
            OK=${ans}
        done
        LINKDIR="${WORKPARAM}"
        if [ -d ${LINKDIR} ]
        then
            echo "'${LINKDIR}' already exists."
            YesNo "Erase ${libs} ${defaults} in '${LINKDIR}'. Confirm?" n
            if [ "$ans" = "y" ]
            then
                dir=`pwd`
                echo -n "'delete..."
                cd ${LINKDIR}
                rm -rf ${libs} UserDefault/${defaults}
                cd ${dir}
                echo "done"
            #else
            #   LINKDIR=""
            fi
        fi
    done
    if [ "${LINKDIR}" != "${LIBDIR}" ]
    then
        mkdir ${LINKDIR}
        ln -s ${LINKDIR} ${LIBDIR}
    else
        [ ! -d $LIBDIR ] && mkdir $LIBDIR
    fi
    set `df ${LIBDIR} | grep -v Filesystem`  # RedHat8 Âбþ
    FREE="$4"
    FILESYS="$6"
    if [ ${FREE:=0} -lt 1024 ]
    then
        nlecho "Not enough space in '${FILESYS}' file system."
        rm -rf ${LIBDIR} ${LINKDIR}
        errorexit 255 "Installation aborted."
    fi
}
### Make binary install directry
mk_BINDIR() {
    LINKBDIR=""
    WORKPARAM=""
    OK="n"
    while [ "${LINKBDIR}" = "" ]
    do
        while [ "${OK}" = "n" ]
        do
            readparam "Enter binary directory name" "${BINDIR}"
            if [ `expr substr ${parameter} 1 1` != "/" ]
            then
                YesNo "directory is '`pwd`/${parameter}'  " n
                WORKPARAM="`pwd`/${parameter}"
            else
                YesNo "directory is '${parameter}'  " n
                WORKPARAM="${parameter}"
            fi
            OK=${ans}
        done
        LINKBDIR="${WORKPARAM}"
        if [ -d ${LINKBDIR} ]
        then
            echo "'${LINKBDIR}' already exists."
            YesNo "Erase ${bins_solaris} ${bins_gui} in '${LINKBDIR}'. Confirm?" n
            if [ "$ans" = "y" ]
            then
                dir=`pwd`
                echo -n "'delete..."
                cd ${LINKBDIR}
                rm -rf ${bins_solaris} ${bins_gui}
                cd ${dir}
                echo "done"
            fi
        fi
        if [ -d ${LINKBDIR}/UFPDefault ]
        then
            echo "'${LINKBDIR}/UFPDefault' already exists."
            YesNo "Erase ${bins_gui_file} in '${LINKBDIR}/UFPDefault'. Confirm?" n
            if [ "$ans" = "y" ]
            then
                dir=`pwd`
                echo -n "'delete..."
                cd ${LINKBDIR}
                rm -rf ${bins_gui_file}
                cd ${dir}
                echo "done"
            fi
        fi
    done
    if [ "${LINKBDIR}" != "${BINDIR}" ]
    then
        mkdir ${LINKBDIR}
        BINDIR="${LINKBDIR}"
    else
        [ ! -d $BINDIR ] && mkdir $BINDIR
    fi
    set `df ${BINDIR} | grep -v Filesystem`  # RedHat8 Âбþ
    FREE="$4"
    FILESYS="$6"
    if [ ${FREE:=0} -lt 5120 ]
    then
        nlecho "Not enough space in '${FILESYS}' file system."
        rm -rf ${LINKBDIR}
        errorexit 255 "Installation aborted."
    fi
}

#Clean library install directory for binary update
mk_UD_LIBDIR() {
    ### disk free space check
    echo "Enter library and binary installed directory."
    LINKDIR=""
    OK="n"
    while [ "${LINKDIR}" = "" ]
    do
        while [ "${OK}" = "n" ]
        do
            readparam "Enter library directory name" "${LIBDIR}"
            if [ `expr substr ${parameter} 1 1` != "/" ]
            then
                YesNo "directory is '`pwd`/${parameter}'  " n
            else
                YesNo "directory is '${parameter}'  " n
            fi
            OK=${ans}
        done
        LINKDIR="${parameter}"
        if [ -d ${LINKDIR} ]
        then
            dir=`pwd`
            echo -n "'Delete all old library files..."
            cd ${LINKDIR}
            rm -rf ${libs}
            cd ${dir}
            echo "done"
        else
            echo "Directory not found."
            echo "Binary update give up."
            exit 255
        fi
    done
}

#Clean binary install directory for binary update
mk_UD_BINDIR() {
    LINKBDIR=""
    WORKPARAM=""
    OK="n"
    while [ "${LINKBDIR}" = "" ]
    do
        while [ "${OK}" = "n" ]
        do
            readparam "Enter binary directory name" "${BINDIR}"
            if [ `expr substr ${parameter} 1 1` != "/" ]
            then
                YesNo "directory is '`pwd`/${parameter}'  " n
                WORKPARAM="`pwd`/${parameter}"
            else
                YesNo "directory is '${parameter}'  " n
                WORKPARAM="${parameter}"
            fi
            OK=${ans}
        done
        LINKBDIR="${WORKPARAM}"
        if [ -d ${LINKBDIR} ]
        then
            dir=`pwd`
            echo -n "'Delete all old binary files..."
            cd ${LINKBDIR}
            rm -rf ${bins}
            rm -rf ${bins_gui}
            cd ${dir}
        else
            echo "Directory not found."
            echo "Binary update give up."
            exit 255
        fi
        if [ -d ${LINKBDIR}/UFPDefault ]
        then
            dir=`pwd`
            cd ${LINKBDIR}
            rm -rf ${bins_gui_file}
            cd ${dir}
            echo "done"
        fi
    done
}

#Make etc install directry
mk_ETCDIR() {
    LINKEDIR=""
    WORKPARAM=""
    OK="n"
    while [ "${LINKEDIR}" = "" ]
    do
        while [ "${OK}" = "n" ]
        do
            readparam "Enter etc directory name" "${ETCDIR}"
            if [ `expr substr ${parameter} 1 1` != "/" ]
            then
                YesNo "directory is '`pwd`/${parameter}'  " n
                WORKPARAM="`pwd`/${parameter}"
            else
                YesNo "directory is '${parameter}'  " n
                WORKPARAM="${parameter}"
            fi
            OK=${ans}
        done
        LINKEDIR="${WORKPARAM}"
        if [ -d ${LINKEDIR} ]
        then
            echo "'${LINKEDIR}' already exists."
            YesNo "Erase ${printcap} in '${LINKEDIR}'. Confirm?" n
            if [ "$ans" = "y" ]
            then
                dir=`pwd`
                echo -n "'delete..."
                cd ${LINKEDIR}
                rm -rf ${printcap}
                cd ${dir}
                echo "done"
            fi
        fi
    done
    if [ "${LINKEDIR}" != "${ETCDIR}" ]
    then
        mkdir ${LINKEDIR}
        ETCDIR="${LINKEDIR}"
    else
        [ ! -d $ETCDIR ] && mkdir $ETCDIR
    fi
    set `df ${ETCDIR} | grep -v Filesystem`  # RedHat8 Âбþ
    FREE="$4"
    FILESYS="$6"
    if [ ${FREE:=0} -lt 6144 ]
    then
        nlecho "Not enough space in '${FILESYS}' file system."
        rm -rf ${LINKEDIR}
        errorexit 255 "Installation aborted."
    fi
}
### do symbolic link ###
LN_S() {
    [ -f $2 ] && rm -f $2   # remove, if $2 already exists.
    ln -s $1 $2
}
### do hard link ###
LN_H() {
    [ -f $2 ] && rm -f $2   # remove, if $2 already exists.
    ln $1 $2
}
### Linux Install ###
Linux_Install() {
    YesNo "Install Filters?" "y"
    if [ "$ans" = "y" ]
    then
        mk_LIBDIR
        mk_BINDIR
        mk_ETCDIR
        install -d -m 755 ${BINDIR}
        install -d -m 755 ${LIBDIR}
        install -d -m 755 ${LIBDIR}/UserDefault
        install -d -m 755 ${ETCDIR}
        install -d -m 755 ${BINDIR}/UFPDefault
        Extract ${LIBDIR} ${libs}
        Extract ${LIBDIR}/UserDefault ${defaults}
        Extract ${BINDIR} ${bins}
        RVER=`uname -r | awk '{printf ("%s",substr($1,5,2))}'`
        MVER=`uname -r | awk '{printf ("%s",substr($1,3,1))}'`
        eval MNUM=\$MVER #MinerVersion
        eval RNUM=\$RVER #Revision
        #if Kernel Ver 2.0.xx
        if [ 0 -eq $MNUM ]
        then
            #if Kernel Ver 2.0.36 upper
            if [ 35 -lt $RNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui5}.Z
                gunzip ${bins_gui5}.Z
                install -g bin -o root ${bins_gui5} ${BINDIR}/${bins_gui}
                /bin/rm ${CURDIR}/${bins_gui5}
            else
                Extract ${BINDIR} ${bins_gui}
            fi
        #if Kernel Ver 2.2.xx
        elif [ 2 -eq $MNUM ]
        then
            GMVER=`rpm -q glibc | awk '{printf ("%s",substr($1,9,1))}'`
            GRVERT=`rpm -q glibc | awk '{printf ("%s",substr($1,12,1))}'`
            if [ "-" == $GRVERT ]
            then
                GRVER=`rpm -q glibc | awk '{printf ("%s",substr($1,11,1))}'`
            else
                GRVER=`rpm -q glibc | awk '{printf ("%s",substr($1,11,2))}'`
            fi
            eval GMNUM=\$GMVER
            eval GRNUM=\$GRVER
            #if glibc Ver 2.2.xx
            if [ 2 -eq $GMNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui7}.Z
                gunzip ${bins_gui7}.Z
                install -g bin -o root ${bins_gui7} ${BINDIR}/${bins_gui}
                rm ${CURDIR}/${bins_gui7}
            #if glibc Ver 2.1.95 upper
            elif [ 94 -lt $GRNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui7}.Z
                gunzip ${bins_gui7}.Z
                install -g bin -o root ${bins_gui7} ${BINDIR}/${bins_gui}
                rm ${CURDIR}/${bins_gui7}
            else
                tar xvf ${TAPEDEV} ${bins_gui5}.Z
                gunzip ${bins_gui5}.Z
                install -g bin -o root ${bins_gui5} ${BINDIR}/${bins_gui}
                /bin/rm ${CURDIR}/${bins_gui5}
            fi
        #if Kernel Ver 2.x.xx
        else
            GMVER=`rpm -q glibc | awk '{printf ("%s",substr($1,9,1))}'`
            eval GMNUM=\$GMVER
            #if glibc Ver 2.1.xx
            if [ 1 -eq $GMNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui5}.Z
                gunzip ${bins_gui5}.Z
                install -g bin -o root ${bins_gui5} ${BINDIR}/${bins_gui}
                /bin/rm ${CURDIR}/${bins_gui5}
            #if glibc Ver 2.2.xx upper
            else
                tar xvf ${TAPEDEV} ${bins_gui7}.Z
                gunzip ${bins_gui7}.Z
                install -g bin -o root ${bins_gui7} ${BINDIR}/${bins_gui}
                rm ${CURDIR}/${bins_gui7}
            fi
        fi
        Extract ${BINDIR}/UFPDefault ${bins_gui_file}
        Extract ${RESOURCEDIR} ${resource_gui_file}
        Extract ${ETCDIR} ${printcap}
#        if [ -d ${MANDIRF} ]
#        then
#            MANDIR="${MANDIRF}"
#        elif [ -d ${MANDIR2} ]
#        then
#            LN_S ${MANDIR2} ${MANDIR}
#        fi
#        Extract ${MANDIR}/man1 ${man1}
#        Extract ${MANDIR}/man5 ${man5}
        ## compatibility
#        if [ "`P400check`" = "true" ]
#        then
#            cd $MANDIR/man5
#            LN_S fxpsdefault400.5 .fxpsdefault400.5
#        elif [ "`P2428check`" = "true" ]
#        then
#            cd $MANDIR/man5
#            LN_S fxpsdefault2428.5 .fxpsdefault2428.5
#        else
#            cd $MANDIR/man5
#            LN_S fxpsdefault1250.5 .fxpsdefault1250.5
#        fi
        # do binary hard link
        LN_H ${BINDIR}/euc2ps2 ${LIBDIR}/fxpif
        LN_H ${BINDIR}/xwd2ps2 ${LIBDIR}/fxpvf
        LN_H ${BINDIR}/xwd2ps2 ${LIBDIR}/fxpg4f
        LN_H ${BINDIR}/xwd2ps2 ${BINDIR}/xwd2g4
        LN_H ${BINDIR}/tiff2ps2 ${BINDIR}/tiff2g4
        cd ${LIBDIR}
        for i in ${filter_add}
        do
            for j in ${filter}
            do
                LN_S ${j} ${j}_${i}
            done
        done
        echo
        echo "*** Editing ${PrinterName} Enviroment files. ***"
        echo
        if [ "`P400check`" = "true" ]
        then
            MTYPE="C400"
        elif [ "`P2428check`" = "true" ]
        then
            MTYPE="2428"
        elif [ "`P3000check`" = "true" ]
        then
            MTYPE="3000"
        fi
        if keyedit ${PRINTCAP} fxps${MTYPE}/fxpif ${ETCDIR}/${printcap} ${SAVEDIR}
        then
            SAVE_FILES="${SAVE_FILES} ${PRINTCAP}"
        fi
        echo "${BINDIR}" > /tmp/fxbinpath${MTYPE}
        install -g bin -o root /tmp/fxbinpath${MTYPE} ${LIBDIR}
        rm -f /tmp/fxbinpath${MTYPE}
    fi
    echo
    if [ "${SAVE_FILES}" ]
    then
        echo ${SAVE_FILES} | tr -s ' ' '\012'
        echo "Original files is saved in '${SAVEDIR}'."
    else
        rm -r ${SAVEDIR}
    fi
}

### Linux Binary Install ###
Linux_BinaryInstall() {
    YesNo "Update Binaries?" "y"
    if [ "$ans" = "y" ]
    then
        mk_UD_LIBDIR
        mk_UD_BINDIR
        install -d -m 755 ${BINDIR}
        install -d -m 755 ${BINDIR}/UFPDefault
        install -d -m 755 ${LIBDIR}
        Extract ${LIBDIR} ${libs}
        Extract ${BINDIR} ${bins}
        RVER=`uname -r | awk '{printf ("%s",substr($1,5,2))}'`
        MVER=`uname -r | awk '{printf ("%s",substr($1,3,1))}'`
        eval MNUM=\$MVER #MinerVersion
        eval RNUM=\$RVER #Revision
        #if Kernel Ver 2.0.xx
        if [ 0 -eq $MNUM ]
        then
            #if Kernel Ver 2.0.36 upper
            if [ 35 -lt $RNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui5}.Z
                uncompress ${bins_gui5}.Z
                install -g bin -o root ${bins_gui5} ${BINDIR}/${bins_gui}
                /bin/rm ${CURDIR}/${bins_gui5}
            else
                Extract ${BINDIR} ${bins_gui}
            fi
        #if Kernel Ver 2.2.xx
        elif [ 2 -eq $MNUM ]
        then
            GMVER=`rpm -q glibc | awk '{printf ("%s",substr($1,9,1))}'`
            GRVERT=`rpm -q glibc | awk '{printf ("%s",substr($1,12,1))}'`
            if [ "-" == $GRVERT ]
            then
                GRVER=`rpm -q glibc | awk '{printf ("%s",substr($1,11,1))}'`
            else
                GRVER=`rpm -q glibc | awk '{printf ("%s",substr($1,11,2))}'`
            fi
            eval GMNUM=\$GMVER
            eval GRNUM=\$GRVER
            #if glibc Ver 2.2.xx
            if [ 2 -eq $GMNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui7}.Z
                uncompress ${bins_gui7}.Z
                install -g bin -o root ${bins_gui7} ${BINDIR}/${bins_gui}
                rm ${CURDIR}/${bins_gui7}
            #if glibc Ver 2.1.95 upper
            elif [ 94 -lt $GRNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui7}.Z
                uncompress ${bins_gui7}.Z
                install -g bin -o root ${bins_gui7} ${BINDIR}/${bins_gui}
                rm ${CURDIR}/${bins_gui7}
            else
                tar xvf ${TAPEDEV} ${bins_gui5}.Z
                uncompress ${bins_gui5}.Z
                install -g bin -o root ${bins_gui5} ${BINDIR}/${bins_gui}
                /bin/rm ${CURDIR}/${bins_gui5}
            fi
        #if Kernel Ver 2.x.xx
        else
            GMVER=`rpm -q glibc | awk '{printf ("%s",substr($1,9,1))}'`
            eval GMNUM=\$GMVER
            #if glibc Ver 2.1.xx
            if [ 1 -eq $GMNUM ]
            then
                tar xvf ${TAPEDEV} ${bins_gui5}.Z
                uncompress ${bins_gui5}.Z
                install -g bin -o root ${bins_gui5} ${BINDIR}/${bins_gui}
                /bin/rm ${CURDIR}/${bins_gui5}
            #if glibc Ver 2.2.xx upper
            else
                tar xvf ${TAPEDEV} ${bins_gui7}.Z
                uncompress ${bins_gui7}.Z
                install -g bin -o root ${bins_gui7} ${BINDIR}/${bins_gui}
                rm ${CURDIR}/${bins_gui7}
            fi
        fi
        Extract ${BINDIR}/UFPDefault ${bins_gui_file}
        Extract ${RESOURCEDIR} ${resource_gui_file}
#        if [ -d ${MANDIRF} ]
#        then
#            MANDIR="${MANDIRF}"
#        elif [ -d ${MANDIR2} ]
#        then
#            LN_S ${MANDIR2} ${MANDIR}
#        fi
#        Extract ${MANDIR}/man1 ${man1}
#        Extract ${MANDIR}/man5 ${man5}
        ## compatibility
#        if [ "`P3530check`" = "true" ]
#        then
#            cd $MANDIR/man5
#            LN_S fxpsdefault3320.5 .fxpsdefault3320.5
#        elif [ "`P2220check`" = "true" ]
#        then
#            cd $MANDIR/man5
#            LN_S fxpsdefault2220.5 .fxpsdefault2220.5
#        elif [ "`P3530check`" = "true" ]
#        then
#            cd $MANDIR/man5
#            LN_S fxpsdefault3530.5 .fxpsdefault3530.5
#        else
#            cd $MANDIR/man5
#            LN_S fxpsdefault1250.5 .fxpsdefault1250.5
#        fi
        # do binary hard link
        LN_H ${BINDIR}/euc2ps2 ${LIBDIR}/fxpif
        LN_H ${BINDIR}/xwd2ps2 ${LIBDIR}/fxpvf
        LN_H ${BINDIR}/xwd2ps2 ${LIBDIR}/fxpg4f
        LN_H ${BINDIR}/xwd2ps2 ${BINDIR}/xwd2g4
        LN_H ${BINDIR}/tiff2ps2 ${BINDIR}/tiff2g4
        cd ${LIBDIR}
        for i in ${filter_add}
        do
            for j in ${filter}
            do
                LN_S ${j} ${j}_${i}
            done
        done
        if [ "`P400check`" = "true" ]
        then
            MTYPE="C400"
        elif [ "`P2428check`" = "true" ]
        then
            MTYPE="2428"
        elif [ "`P3000check`" = "true" ]
        then
            MTYPE="3000"
        fi
        echo "${BINDIR}" > /tmp/fxbinpath${MTYPE}
        install -g bin -o root /tmp/fxbinpath${MTYPE} ${LIBDIR}
        rm -f /tmp/fxbinpath${MTYPE}
    fi
}

### Eject floppy ###
EJECT() {
    echo
}
##
setup_tapedevice() {
    if [ $?PACKAGE ]
    then
        if [ -f $PACKAGE ]
        then
            TAPEDEV=$PACKAGE
        else
            echo
            echo "Extracting a package, please wait..."
            tar xf $TAPEDEV $PACKAGE 2>&1 >/dev/null
            [ -f $PACKAGE ] && TAPEDEV=$PACKAGE
        fi
    fi  # if no package found, old version of Unix Filter
}
################################
# START Installation Here
################################
#/usr/ucb/clear
if [ "`whoami`" != "root" ]
then
    errorexit 255 "should be used by 'root'."
fi
if [ ! -d ${SAVEDIR} ]
then
    mkdir ${SAVEDIR}
fi
SAVE_FILES=""
ModelSelectMenu
setup_tapedevice
if [ ! -d ${ETC} ]
then
    mkdir ${ETC}
fi
if [ ! -f ${PRINTCAP} ]
then
    Extract ${ETC} printcap_hed
    cd /etc
    mv printcap_hed printcap
    chmod 644 printcap
fi
if [ ! "$PrinterName" = "BinaryInstall2428" ]; then
    Linux_Install
else
    Linux_BinaryInstall
fi
awk -F : '{print $1 " " $6}' /etc/passwd > ${LIBDIR}/UserDefault/.userhomedir
chmod 755 ${LIBDIR}/UserDefault/.userhomedir
##[ -f $PACKAGE ] && rm -f $PACKAGE
echo ""
echo "done."
##EJECT
##### END-OF-INSTALL #####
Download as text