-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
1677 lines (1497 loc) · 32.7 KB
/
Copy pathinstall.sh
File metadata and controls
1677 lines (1497 loc) · 32.7 KB
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
#!/bin/sh
#
# @(#)install.sh 7.94 04/04/20
#
# Script to install the software binary and support files on
# the target system.
#
# Command line options:
#
# -n Do not clean up distribution files after installing
# -b Run in non-interactive mode, use default answers for all prompts.
# The following environment variables can be used to override the
# default answers:
# BATCH_BINDIR Binary executable installation directory
# BATCH_XMCDLIB Xmcd support files top level directory
# BATCH_DISCOGDIR Local discographies top level directory
# BATCH_MANDIR Manual page top level directory
# BATCH_MANSUFFIX Manual page file suffix
#
# xmcd - Motif(R) CD Audio Player/Ripper
# cda - Command-line CD Audio Player/Ripper
#
# Copyright (C) 1993-2004 Ti Kan
# E-mail: xmcd@amb.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
OPATH="$PATH"
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/freeware/bin:/usr/local/bin
export PATH
XMCD_VER=3.3.2
XMCD_URL=http://www.amb.org/xmcd/
DIRPERM=755
SCRPERM=755
FILEPERM=444
XBINPERM=4711
BINPERM=711
GDIRPERM=777
OWNER=bin
GROUP=bin
XBINOWNER=root
XBINGROUP=bin
ERRFILE=/tmp/xmcd.err
TMPFILE=/tmp/xmcdinst.$$
STARTUP_SCRIPT=.xmcd_start
#
# Utility functions
#
do_exit()
{
if [ $1 -ne 0 ]
then
$ECHO "\nERROR(s) have occurred in the installation."
if [ $ERRFILE != /dev/null ]
then
$ECHO "See $ERRFILE for details."
fi
exit $1
fi
$ECHO "\nInstallation of xmcd is now complete."
if [ -n "$SHLIBEXISTS" ]
then
$ECHO "\nNOTICE: A CDDB shared library is already installed on"
$ECHO "your system ($SHLIBEXISTS) and install did not overwrite"
$ECHO "it. If your existing CDDB shared library is old,"
$ECHO "please remove it and re-install xmcd again."
fi
if [ "$LDSO_NEEDCONF" -eq 1 ]
then
$ECHO "\nNOTICE: You need to do the following to allow xmcd and"
$ECHO "cda to find the CDDB shared library. Xmcd/cda may not"
$ECHO "work until this is done."
if [ -n "$LDSO_CONF" ]
then
$ECHO " - Make sure that $SHLIBDIR is in your"
$ECHO " $LDSO_CONF file."
fi
if [ -n "$LDCONFIG" ]
then
$ECHO " - Login as root and run $LDCONFIG to activate"
$ECHO " the CDDB shared library."
fi
fi
CKWEBSITE=0
LAME_FOUND=0
FAAC_FOUND=0
pathdirs=`echo "$PATH" | sed 's/:/ /g'`
for i in $pathdirs $BINTRYDIRS
do
if [ -x ${i}/lame -o -x ${i}/notlame ]
then
LAME_FOUND=1
fi
if [ -x ${i}/faac ]
then
FAAC_FOUND=1
fi
done
if [ $LAME_FOUND -eq 0 ]
then
$ECHO "\nNOTICE: If you want to use xmcd/cda to rip CDs to MP3"
$ECHO "format, you must install the LAME encoder software."
CKWEBSITE=1
fi
if [ $FAAC_FOUND -eq 0 ]
then
$ECHO "\nNOTICE: If you want to use xmcd/cda to rip CDs to AAC and"
$ECHO "MP4 formats, you must install the FAAC encoder software."
CKWEBSITE=1
fi
if [ $CKWEBSITE -eq 1 ]
then
$ECHO "\nPlease see the \"Downloads\" area on the xmcd web site"
$ECHO "for further information."
fi
if [ -n "$BATCH" ]
then
$ECHO "\nNOTICE: Before using xmcd/cda for the first time, you"
$ECHO "must set up the software by running the following program:"
$ECHO "\n\t${XMCDLIB}/config/config.sh\n"
$ECHO "Xmcd/cda will not work until that is done."
fi
$ECHO "\nPlease read the $XMCDLIB/docs/README file.\n\n"
exit 0
}
log_err()
{
if [ "$1" = "-p" ]
then
$ECHO "Error: $2"
fi
$ECHO "$2" >>$ERRFILE
ERROR=1
}
get_str()
{
$ECHO "$* \c"
read ANS
if [ -n "$ANS" ]
then
return 0
else
return 1
fi
}
get_yn()
{
if [ -z "$YNDEF" ]
then
YNDEF=y
fi
while :
do
$ECHO "$*? [${YNDEF}] \c"
read ANS
if [ -n "$ANS" ]
then
case $ANS in
[yY])
RET=0
break
;;
[nN])
RET=1
break
;;
*)
$ECHO "Please answer y or n"
;;
esac
else
if [ $YNDEF = y ]
then
RET=0
else
RET=1
fi
break
fi
done
YNDEF=
return $RET
}
do_link()
{
source=$1
target=$2
rm -f $target
# Try symlink first
ln -s $source $target 2>/dev/null
RETSTAT=$?
if [ $RETSTAT -ne 0 -a -f $source ]
then
# Use hard link if a regular file
ln $source $target 2>/dev/null
RETSTAT=$?
fi
if [ $RETSTAT -ne 0 ]
then
log_err -n "Cannot link $source -> $target"
fi
return $RETSTAT
}
do_chown()
{
if [ $1 != _default_ ]
then
chown $1 $2 2>/dev/null
fi
}
do_chgrp()
{
if [ $1 != _default_ ]
then
chgrp $1 $2 2>/dev/null
fi
}
do_chmod()
{
if [ $1 != _default_ ]
then
chmod $1 $2 2>/dev/null
fi
}
make_dir()
{
dir=$1
perm=$2
owner=$3
group=$4
$ECHO "\t$dir"
if [ ! -d $dir ]
then
mkdir -p $dir
fi
do_chown $owner $dir
do_chgrp $group $dir
do_chmod $perm $dir
return 0
}
inst_file()
{
source=$1
target=$2
perm=$3
owner=$4
group=$5
tdir=`dirname $target`
if [ -n "$tdir" -a -d "$tdir" -a -w "$tdir" ]
then
if [ ! -f $source ]
then
$ECHO "\t$target NOT installed"
log_err -n "Cannot install ${target}: file missing."
return 1
fi
$ECHO "\t$target"
rm -f $target
cp $source $target
if [ $? != 0 ]
then
log_err -n "Cannot install $target: file copy error."
return 1
fi
if [ -f $target ]
then
do_chown $owner $target 2>/dev/null
do_chgrp $group $target 2>/dev/null
do_chmod $perm $target 2>/dev/null
fi
else
$ECHO "\t$target NOT installed"
log_err -n \
"Cannot install $target: target directory not writable."
return 1
fi
return 0
}
link_prompt()
{
$ECHO "\nFor security reasons, setuid programs (such as xmcd) search"
$ECHO "only /usr/lib and/or /usr/ccs/lib for dynamic libraries."
$ECHO "Some of the dynamic libraries that xmcd needs may not be in"
$ECHO "the standard locations, thus xmcd may not be able to find"
$ECHO "them."
$ECHO "\nSymbolic links can be created now to correct this problem."
$ECHO "\nDo you want this installation procedure to search your"
$ECHO "system for needed dynamic libraries, and create symbolic links"
$ECHO "of these libraries to /usr/lib\c"
YNDEF=y
get_yn " "
if [ $? != 0 ]
then
$ECHO "\nNo links will be created.\n"
$ECHO "If you encounter difficulty starting xmcd, see the FAQ"
$ECHO "file in the xmcd distribution for further information."
return 1
fi
$ECHO ""
return 0
}
link_dynlibs()
{
LINKFOUND=False
#
# Set LD_LIBRARY_PATH to point to all conceivable places where
# dynamic libraries can hide
#
LD_LIBRARY_PATH=$LIBDIR:/usr/X/lib:/usr/X11/lib:/usr/X386/lib:/usr/X11R5/lib:/usr/X11R6/lib:/usr/openwin/lib:/usr/X/desktop:/usr/Motif/lib:/usr/Motif1.1/lib:/usr/Motif1.2/lib:/usr/Motif2.0/lib:/usr/dt/lib:/usr/lib/X11:/usr/ccs/lib:/usr/lib:/lib:/usr/freeware/lib32:/usr/local/lib
export LD_LIBRARY_PATH
# Find the ldd program
for i in /bin /usr/bin /usr/ccs/bin
do
if [ -x $i/ldd ]
then
LDD=$i/ldd
fi
done
if [ -z "$LDD" ]
then
# Can't locate ldd
return
fi
if [ ! -r xmcd_d/xmcd ]
then
# Can't read xmcd binary
return
fi
# Run ldd to determine its dynamic library configuration
$LDD xmcd_d/xmcd >$TMPFILE 2>/dev/null
if fgrep '=>' $TMPFILE >/dev/null 2>&1
then
# BSD/SunOS/SVR5 style ldd output
DYNLIBS="`fgrep -v 'not found' $TMPFILE | \
fgrep -v 'xmcd needs:' | \
sed -e 's/^.*=> *//' -e 's/(.*)//' | tr '\015' ' '`"
ERRLIBS="`fgrep 'not found' $TMPFILE | $AWK '{ print $1 }' | \
tr '\015' ' '`"
else
# SVR4 style ldd output
DYNLIBS="`fgrep 'loaded:' $TMPFILE | sed 's/^.*: //' | \
tr '\015' ' '`"
ERRLIBS="`fgrep 'error opening' $TMPFILE | \
sed 's/^.*opening //' | tr '\015' ' '`"
fi
# Remove temp files
rm -f $TMPFILE
for i in $ERRLIBS _xoxo_
do
if [ "$i" = _xoxo_ ]
then
break
fi
# A needed library is not found in LD_LIBRARY_PATH
log_err -p "\nNeeded library $i not found! See the xmcd FAQ."
done
for i in $DYNLIBS _xoxo_
do
if [ "$i" = _xoxo_ ]
then
# Done processing
break
fi
LIBNAME=`basename $i`
DIRNAME=`dirname $i`
if [ "$DIRNAME" = /usr/lib -o "$DIRNAME" = /usr/ccs/lib ]
then
# This is the standard library location
continue
fi
if [ -f /usr/lib/$LIBNAME -o -f /usr/ccs/lib/$LIBNAME ]
then
# Link already there
continue
fi
if [ $LINKFOUND = False ]
then
LINKFOUND=True
if [ -z "$BATCH" ]
then
link_prompt
if [ $? != 0 ]
then
return
fi
fi
fi
YNDEF=y
if [ -n "$BATCH" ] || \
get_yn "Link $DIRNAME/$LIBNAME to /usr/lib/$LIBNAME"
then
do_link $DIRNAME/$LIBNAME /usr/lib/$LIBNAME
else
$ECHO "$DIRNAME/$LIBNAME not linked."
fi
done
}
fix_discog()
{
ogenre=$1
genre=$2
id=$3
file=$DISCOGDIR/$genre/$id/index.html
gn=`echo $genre | sed -e 's/_/ /g' -e 's/\// -> /g'`
gn_s=`echo $gn | sed 's/\//\\\\\//g'`
if [ ! -f $file ]
then
return;
fi
out=1
cat $file | while read line
do
if [ "$line" = '<LI>Browse category:' ]
then
echo "<LI><A HREF=\"../../index.html\">Main index</A>"
echo "<LI><A HREF=\"../index.html\">$gn index</A>"
out=0
continue
elif [ "$line" = '</LI>' -a out -eq 0 ]
then
out=1
continue
fi
if [ $out -eq 1 ]
then
if [ "$line" = '</BODY>' ]
then
echo "<HR>"
echo "This directory: <B>$DISCOGDIR/$genre/$id</B>"
fi
echo "$line"
fi
done | \
sed -e "s/Generated by xmcd 2\..*$/Generated by xmcd $XMCD_VER/" \
-e 's/Copyright .* Ti Kan/Copyright (C) 1993-2004 Ti Kan/' \
-e 's/Browse .* Xmcd web site/Xmcd official web site/' \
-e 's/Browse .* CDDB web site/CDDB - The #1 music info source/' \
-e 's/Browse music reviews/Yahoo! music reviews/' \
-e 's/How to set up Local/How to use Local/' \
-e "s/$ogenre $id/$gn_s $id/" \
-e "s/$ows_s/$XMCDURL_S/g" \
>${file}.new 2>/dev/null
sed 's/\.\.\/\.\./\.\.\/\.\.\/\.\./g' <${file}.new >$file
chmod 666 $file 2>/dev/null
rm -f ${file}.new
}
#
# Main execution starts here
#
# Catch some signals
trap "rm -f $TMPFILE; exit 1" 1 2 3 5 15
#
# Get platform information
#
OS_SYS=`(uname -s) 2>/dev/null`
OS_REL=`(uname -r) 2>/dev/null`
if [ "$OS_SYS" = IRIX ]
then
OS_MACH=mips
else
OS_MACH=`(uname -m) 2>/dev/null`
fi
if [ -z "$OS_SYS" ]
then
OS_SYS=unknown
fi
if [ -z "$OS_REL" ]
then
OS_REL=unknown
fi
if [ -z "$OS_MACH" ]
then
OS_MACH=unknown
fi
OS_SYS_T=`echo "$OS_SYS" | sed -e 's/\//_/g' -e 's/-/_/g' -e 's/[ ]/_/g'`
OS_MACH_T=`echo "$OS_MACH" | sed -e 's/\//_/g' -e 's/-/_/g' -e 's/[ ]/_/g'`
OS_REL_T=`echo "$OS_REL" | sed -e 's/\//_/g' -e 's/-/_/g' -e 's/[ ]/_/g'`
# Use Sysv echo if possible
if [ -x /usr/5bin/echo ]
then
ECHO=/usr/5bin/echo # SunOS SysV echo
elif [ -z "`(echo -e a) 2>/dev/null | fgrep e`" ]
then
ECHO="echo -e" # GNU bash, etc.
else
ECHO=echo # generic SysV
fi
if [ "$OS_SYS" = QNX ]
then
ECHO=echo
fi
# Use nawk if available
if [ -x /bin/nawk -o -x /usr/bin/nawk ]
then
AWK=nawk
else
# If awk doesn't work well on your system and you have gawk,
# try changing the following to gawk.
AWK=awk
fi
# Remove old error log file
ERROR=0
rm -f $ERRFILE
if [ -f $ERRFILE ]
then
$ECHO "Cannot remove old $ERRFILE: error logging not enabled."
ERRFILE=/dev/null
fi
# Parse command line args
NOREMOVE=0
BATCH=
if [ $# -gt 1 ]
then
for i in $*
do
case "$i" in
-n)
# Whether to remove distribution files after
# installation
NOREMOVE=1
;;
-b)
# Specify batch mode
BATCH=$i
;;
*)
log_err -p "Unknown option: $i"
do_exit 1
;;
esac
done
elif [ -f docs_d/INSTALL -a -f docs_d/PORTING ]
then
# Do not remove if running from source code directory
NOREMOVE=1
fi
# Implement platform-specific features and deal with OS quirks
LINKLIBS=False
SHELL=/bin/sh
SCO=False
LDSO_NEEDCONF=0
SHLIBEXISTS=""
if [ "$OS_SYS" = A/UX ]
then
# Apple A/UX
SHELL=/bin/ksh
elif [ "$OS_SYS" = FreeBSD ]
then
# FreeBSD
OS_REL_T=`echo "$OS_REL_T" | sed 's/\..*$//'`
OS_SYS_T=${OS_SYS_T}_${OS_REL_T}
elif [ "$OS_SYS" = HP-UX ]
then
# HP-UX
SHELL=/bin/ksh
elif [ "$OS_SYS" = Linux ]
then
# Linux
LDSO_CONF=/etc/ld.so.conf
LDCONFIG=/sbin/ldconfig
elif [ "$OS_SYS" = SunOS -o "$OS_SYS" = Solaris ]
then
case "$OS_REL" in
4.*)
# SunOS 4.x
LDCONFIG=/usr/etc/ldconfig
;;
5.*)
# SunOS 5.x
LINKLIBS=True
OS_SYS_T=Solaris
;;
*)
;;
esac
elif [ "$OS_SYS" = ULTRIX ]
then
# Digital Ultrix
SHELL=/bin/sh5
elif [ -x /bin/ftx ] && /bin/ftx
then
case "$OS_REL" in
4.*)
# Stratus FTX SVR4
LINKLIBS=True
;;
*)
;;
esac
elif [ -x /bin/i386 -o -x /sbin/i386 ] && i386
then
case "$OS_REL" in
3.*)
if (uname -X | fgrep "Release = 3.2") >/dev/null 2>&1
then
# SCO UNIX/Open Desktop/Open Server
SCO=True
OS_REL_T=`uname -X 2>/dev/null | \
fgrep "Version = " | \
sed -e 's/Version = //' -e 's/\..*$//'`
if [ -z "$OS_REL_T" ]
then
OS_REL_T=`uname -v | sed 's/\..*$//'`
fi
OS_SYS_T=SCO_3.2v${OS_REL_T}
fi
;;
4.*)
# UNIX SVR4.x
LINKLIBS=True
OS_SYS_T=${OS_SYS_T}_${OS_REL_T}
;;
4*MP)
# UNIX SVR4 MP
LINKLIBS=True
OS_SYS_T=${OS_SYS_T}_${OS_REL_T}
;;
5)
# UNIX SVR5
LINKLIBS=True
OS_SYS_T=${OS_SYS_T}_${OS_REL_T}
;;
5.*)
# UNIX SVR5.x
LINKLIBS=True
OS_SYS_T=${OS_SYS_T}_${OS_REL_T}
;;
*)
;;
esac
elif [ -x /bin/m88k ] && m88k
then
case "$OS_REL" in
4.*)
# Motorola SVR4/m88k
LINKLIBS=True
;;
*)
;;
esac
fi
$ECHO "\nInstalling \"xmcd\" Motif CD Player/Ripper version $XMCD_VER by Ti Kan"
$ECHO "----------------------------------------------------------------"
$ECHO "\nThis is free software and comes with no warranty."
$ECHO "See the GNU General Public License in the COPYING file"
$ECHO "for details."
$ECHO "\nThis software contains support for the Gracenote"
$ECHO "CDDB(R) Disc Recognition Service. See the CDDB file"
$ECHO "for information."
# Check privilege
(id | fgrep 'uid=0(root)') >/dev/null 2>&1
if [ $? != 0 ]
then
$ECHO "\n\nYou should be the super user to install xmcd."
YNDEF=n
if [ -z "$BATCH" ] && get_yn "\n Proceed with installation anyway"
then
$ECHO "\nWARNING: Without super-user privilege, some files may"
$ECHO "not be properly installed, or they may be installed"
$ECHO "with incorrect permissions."
XBINPERM=711
XBINOWNER=_default_
OWNER=_default_
GROUP=_default_
else
log_err -p "Not super user: installation aborted by user."
do_exit 1
fi
fi
# Check existence of binaries
MISSING=
for i in xmcd_d/xmcd cda_d/cda util_d/gobrowser cdda_d/has_alsa
do
if [ ! -f $i ]
then
MISSING="$MISSING $i"
fi
done
if [ -n "$MISSING" ]
then
$ECHO "\n\nThe following executable binaries are missing:\n"
for i in $MISSING
do
$ECHO "\t$i"
done
$ECHO "\nIf you have the xmcd source code distribution, make sure"
$ECHO "you compile the source code to generate the binaries first."
$ECHO "See the INSTALL file for details."
$ECHO "\nIf you have the xmcd binary distribution, it is probably"
$ECHO "corrupt."
YNDEF=n
if [ -z "$BATCH" ] && get_yn "\n Proceed with installation anyway"
then
$ECHO "\nThe missing files will not be installed."
else
log_err -p "Missing binaries: installation aborted by user."
do_exit 1
fi
fi
# Determine BINDIR
BINTRYDIRS="\
/usr/bin/X11 \
/usr/X/bin \
/usr/X11/bin \
/usr/X11R6/bin \
/usr/X11R5/bin \
/usr/X386/bin \
/usr/openwin/bin \
/usr/freeware/bin/X11 \
/usr/freeware/bin \
/usr/local/bin/X11 \
/usr/local/bin \
/usr/lbin \
"
if [ -z "$BINDIR" ]
then
for i in $BINTRYDIRS
do
if [ -d $i ]
then
BINDIR=$i
break
fi
done
if [ -z "$BINDIR" ]
then
BINDIR=/usr/bin/X11
fi
else
BINDIR=`echo $BINDIR | sed 's/\/\//\//g'`
fi
$ECHO "\n\nThe X binary directory is where the xmcd and cda executable files"
$ECHO "will be installed. It should be in each xmcd user's PATH environment."
if [ -n "$BATCH" ]
then
if [ -n "$BATCH_BINDIR" ]
then
BINDIR=$BATCH_BINDIR
fi
$ECHO "\nUsing $BINDIR"
else
while :
do
if get_str "\n Enter X binary directory\n [${BINDIR}]:"
then
UDIR="$ANS"
if echo "$UDIR" | grep "^/" >/dev/null 2>&1
then
if [ -d "$UDIR" ]
then
BINDIR="$UDIR"
break
else
YNDEF=y
if get_yn \
" Directory $UDIR does not exist. Create it"
then
BINDIR="$UDIR"
break
else
$ECHO \
" Error: Cannot install in ${UDIR}."
fi
fi
else
$ECHO " Error: You must use an absolute path."
fi
else
break
fi
done
fi
# Determine LIBDIR
LIBTRYDIRS="\
/usr/lib/X11 \
/usr/X/lib \
/usr/X11/lib \
/usr/X11R6/lib/X11 \
/usr/X11R5/lib/X11 \
/usr/X386/lib \
/usr/openwin/lib \
/usr/freeware/lib/X11 \
/usr/freeware/lib \
/usr/local/lib/X11 \
/usr/local/lib \
"
if [ -z "$LIBDIR" ]
then
for i in $LIBTRYDIRS
do
if [ -d $i ]
then
LIBDIR=$i
break
fi
done
if [ -z "$LIBDIR" ]
then
LIBDIR=/usr/lib/X11
fi
else
LIBDIR=`echo $LIBDIR | sed 's/\/\//\//g'`
fi
# Determine xmcd libdir
$ECHO "\n\nThe xmcd library directory is where xmcd/cda support files"
$ECHO "will be installed."
XMCDLIB=$LIBDIR/xmcd
if [ -n "$BATCH" ]
then
if [ -n "$BATCH_XMCDLIB" ]
then
XMCDLIB=$BATCH_XMCDLIB
fi
$ECHO "\nUsing $XMCDLIB"
else
while :
do
if get_str "\n Enter xmcd library directory\n [${XMCDLIB}]:"
then
UDIR="$ANS"
if echo "$UDIR" | grep "^/" >/dev/null 2>&1
then
if [ -d "$UDIR" ]
then
XMCDLIB="$UDIR"
break
else
if get_yn \
" Directory $UDIR does not exist. Create it"
then
XMCDLIB="$UDIR"
break
else
$ECHO \
" Error: Cannot install in ${UDIR}."
fi
fi
else
$ECHO " Error: You must use an absolute path."
fi
else
break
fi
done
fi
# Determine DISCOGDIR
DISCOGDIR=$XMCDLIB/discog
if [ ! -d $DISCOGDIR ]
then
$ECHO "\n\nThe Local Discographies directory is where documents,"
$ECHO "images, sound clips and other files related to each CD may"
$ECHO "be stored. These can then be viewed or played using the"
$ECHO "wwwWarp feature of xmcd."
if [ -n "$BATCH" ]
then
if [ -n "$BATCH_DISCOGDIR" ]
then
DISCOGDIR=$BATCH_DISCOGDIR
fi
$ECHO "\nUsing $DISCOGDIR"
else
if get_str \
"\n Enter Local Discographies directory\n [${DISCOGDIR}]:"
then
DISCOGDIR=$ANS
fi
fi
fi
# Determine MANDIR
if [ -z "$MANDIR" ]
then
for i in /usr/man/man.LOCAL \
/usr/share/man/man1 \
/usr/X11/man/man1 \
/usr/X/man/man1 \
/usr/X11R6/man/man1 \
/usr/X11R5/man/man1 \
/usr/X386/man/man1 \
/usr/freeware/catman/u_man/cat1 \
/usr/local/man/man1
do
if [ -d $i ]
then