summaryrefslogtreecommitdiffstats
path: root/kscd/kscd-script
blob: 89146f7c8e74749076505d443d405b67c6b1f355 (plain)
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
#!/bin/sh
#
#   Kscd - A simple cd player for the KDE Project
#
#   $Id$
# 
#   Copyright (c) 1997 Bernd Johannes Wuebben math.cornell.edu
#   
#   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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

# the following is borrowed from configure 
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    ac_n= ac_c='
' ac_t='        '
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi

config_file="config.h"
ORG_CONFIG="config.h.std"

display_main_menu(){

clear
echo 
echo  "                   KSCD -- Configuration"
echo    "==================================================================="
echo
echo     "               Linux ...................... L"
echo     "               FreeBSD/NetBSD ............. F"
echo     "               BSD386 ..................... B"
echo     "               Sun ........................ S"
echo     "               HPUX ....................... H"
echo     "               Irix ....................... I"
echo     "               Sony NEWS .................. N"
echo     "               OSF/1 ...................... O"
echo     "               Ultrix ..................... U"
echo     "               Generic SVR4 (not Sun) ..... V"
echo 
echo     "               Quit ....................... Q"
echo 
echo
echo   "            Bernd Johannes Wuebben <wuebben@kde.org>"
echo    "=================================================================="
echo  
echo  $ac_n  "            Please chose acccording to your platform:$ac_c"

read platform

}

give_instructions(){

echo "Please answer all questions. Simply hit [Enter] to select the default"
echo "values which are displayed in square brackets."
echo

}

write_config_header(){

echo "" >> $config_file
echo "/* This header file was automatically generated by the kscd" >> $config_file
echo "   installation script. In case of trouble please edit" >> $config_file
echo "   $ORG_CONFIG in the source directory of the kscd distribution" >> $config_file
echo "   and rename it to $config_file .*/" >> $config_file
echo "" >> $config_file

}

linux_conf(){

clear
echo "KSCD configuration for Linux systems"
echo "------------------------------------"
echo

give_instructions
write_config_header

echo "#ifdef linux " >> $config_file
echo "" >> $config_file

echo $ac_n "Please specify your cdrom device [/dev/cdrom]:$ac_c"

read device
if [ "$device" = "" ]
then
    device="/dev/cdrom"
fi

echo "Your choice was: $device"
echo "#define DEFAULT_CD_DEVICE   \"$device\"  " >> $config_file



echo 
echo "I have made modifications to the workman engine which cause kscd to be"
echo "a very fast and responsive cd player for an average IDE CDROM drive."
echo "Answer NO to the next question unless you have problems getting kscd"
echo "to work."
echo
echo $ac_n "Revert to original Workman behavior? (y/n) [n]:$ac_c"

read workman

case "$workman" in
    "yes" | "y" | "Yes" | "Y") echo "#define WORKMAN_ORIGINAL " >> $config_file ;;
esac


echo
echo "I have incorporated modifications from Dirk (milliByte@DeathsDoor.com)"
echo "which will make kscd perform better on any drive using the sbpcd or"
echo "mcdx drivers. If and only if your kernel uses one of these cd drivers you"
echo "should try answering YES to the next question. Please peruse the "
echo "documents in the spbcd directory of this distribution for more "
echo "information about theses modifications."
echo
echo $ac_n "Enable SBPCD_HACK? (y/n) [n]:$ac_c"

read sbpcd

case "$sbpcd" in
    "yes" | "y" | "Yes" | "Y") echo "#define SBPCD_HACK " >> $config_file ;;
esac


echo
echo "If and only if you have an SCSI cdrom drive you should probably"
echo "answer YES to the next question"
echo
echo $ac_n "Enable LINUX_SCSI_PASSTHROUGH? (y/n) [n]:$ac_c"

read scsi

case "$scsi" in
    "yes" | "y" | "Yes" | "Y") echo "#define LINUX_SCSI_PASSTHROUGH " >> $config_file ;;
esac

echo
echo "Most cdrom devices have a volume range from 0 to 255."
echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
echo "until volume adjustment works to your satisfaction."
echo "Note: Some CDROM device only support a range from 128 to 255."
echo
echo $ac_n "MIN_VOLUME [0]:$ac_c"

read MINVOLUME
if [ "$MINVOLUME" = "" ]
then
    MINVOLUME="0"
fi

echo "You entered $MINVOLUME "
echo "#define MIN_VOLUME $MINVOLUME " >> $config_file 

echo
echo $ac_n "MAX_VOLUME [255]:$ac_c"

read MAXVOLUME
if [ "$MAXVOLUME" = "" ]
then
    MAXVOLUME="255"
fi

echo "You entered $MAXVOLUME "
echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file 

echo
echo "If you own one a cdrom player whose volume range is 128 to 255,"
echo "you might want to try answering YES to the next question."
echo "Enabling 'Curved Volume' will give you a square root like"
echo "volume slider - volume curve."
echo
echo $ac_n "Enable CURVED_VOLUME? (y/n) [n]:$ac_c"

read curved

case "$curved" in
    "yes" | "y" | "Yes" | "Y") echo "#define CURVED_VOLUME " >> $config_file ;;
esac

echo "" >> $config_file
echo "#endif /* linux */" >> $config_file

}

irix_conf(){

clear
echo "KSCD configuration for Irix"
echo "---------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(sgi)" >> $config_file
echo "" >> $config_file

echo $ac_n "Please specify your cdrom device [/dev/scsi/sc0d6l0]:$ac_c"

read device
if [ "$device" = "" ]
then
    device="/dev/scsi/sc0d6l0"
fi

echo "Your choice was: $device"
echo "#define DEFAULT_CD_DEVICE   \"$device\"  " >> $config_file

echo $ac_n "Enable CDDA? (y/n) [y]:$ac_c"

read curved

case "$curved" in
    "yes" | "y" | "Yes" | "Y" | "") echo "#define CDDA " >> $config_file ;;
esac
echo ""
echo "That's all for sgi ..."

echo "#endif /* sgi */" >> $config_file

}

hp_conf(){

clear
echo "KSCD configuration for HPUX systems"
echo "-----------------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(hpux) || defined (__hpux)" >> $config_file
echo "" >> $config_file

echo $ac_n "Please specify your cdrom device [/dev/rscsi]:$ac_c"

read device
if [ "$device" = "" ]
then
    device="/dev/rcsci"
fi

echo "Your choice was: $device"
echo "#define DEFAULT_CD_DEVICE   \"$device\"  " >> $config_file
echo ""
echo "That's all for HPUX ..."

echo "#endif /* hpux */" >> $config_file


}

bsd386_conf(){

clear
echo "KSCD configuration for BSD386 systems"
echo "-------------------------------------"
echo

give_instructions
write_config_header

echo "#ifdef __bsdi__ " >> $config_file

echo 
echo "Please answer YES to the next question if you have a Sound Blaster cdrom."
echo
echo $ac_n "Define SOUNDBALSTER? (y/n) [n]:$ac_c"

read soundblaster

case "$soundblaster" in
    "yes" | "y" | "Yes" | "Y") echo "#define SOUNDBLASTER " >> $config_file ;;
esac

echo "#endif /* __bsdi__ */" >> $config_file

}

freebsd_netbsd_conf(){

clear
echo "KSCD configuration for FreeBSD/NetBSD systems"
echo "---------------------------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(__FreeBSD__) || defined(__NetBSD__)" >> $config_file
echo "" >> $config_file

# get default device
if [ `/usr/bin/uname -s` = "NetBSD" ]; then
	if [ `/usr/bin/uname -m` = "i386" ]; then
		def_device=/dev/rcd0d
	else
		def_device=/dev/rcd0c
	fi
else
	# FreeBSD
	def_device=/dev/acd0c
fi

echo $ac_n "Please specify your cdrom device [$def_device]:$ac_c"

read device
if [ "$device" = "" ]
then
    device="$def_device"
fi

echo "Your choice was:$device"
echo "#define DEFAULT_CD_DEVICE   \"$device\"  " >> $config_file

echo
echo "Some experimental changes to the FreeBSD code were made."
echo "Please let me know whether answering yes or no to the next"
echo "question will give you a better functioning cd player."
echo "Users of NetBSD might want to experiment with this too."
echo
echo $ac_n "Define NEW_BSD_PLAYCLICKED? (y/n) [y]:$ac_c"

read free_play_clicked

case "$free_play_clicked" in
    "yes" | "y" | "Yes" | "Y"| "") echo "#define NEW_BSD_PLAYCLICKED" >> $config_file ;;
esac

echo "" >> $config_file
echo "#endif /* FreeBSD/NetBSD */" >> $config_file

}

sun_conf(){

clear
echo "KSCD configuration for Sun systems"
echo "----------------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(sun) || defined(__sun__)  " >> $config_file
echo "" >> $config_file

echo $ac_n "Are you compiling on Solaris 2.x? (y/n) [y]:$ac_c"
read solaris

case "$solaris" in

 n | N) 
	echo
	;;
 *)
	echo "#define SYSV" >> $config_file
	solaris="y"
	;;
esac

echo ""
echo "You need to enable the internal audio device if you wish"
echo "to get sound from your workstation, as opposed to only from"
echo "the head-phone jack of your CDROM."
echo ""
echo $ac_n "Activate internal audio device (CODEC)? (y/n) [y]:$ac_c"

read codec

case "$code" in

 n | N) 
	;;
 *)
	echo "#define CODEC" >> $config_file
	;;
esac

if [ "$solaris" = "y" ]
then
  echo
  echo "Do you wish to enable digital audio capablilites on drives that"
  echo $ac_n "support it? (y/n) [y]:$ac_c"
  read cdda

  case "$cdda" in

    n | N) 
	   ;;
    *)
       echo "#define BUILD_CDDA" >> $config_file
       ;;
  esac
fi


echo
echo "Most cdrom devices have a volume range from 0 to 255."
echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
echo "until volume adjustment works to your satisfaction."
echo "Note: Some CDROM device only support a range from 128 to 255."
echo
echo $ac_n "MIN_VOLUME [128]:$ac_c"

read MINVOLUME
if [ "$MINVOLUME" = "" ]
then
    MINVOLUME="128"
fi

echo "You entered $MINVOLUME "
echo "#define MIN_VOLUME $MINVOLUME " >> $config_file 

echo
echo $ac_n "MAX_VOLUME [255]:$ac_c"

read MAXVOLUME
if [ "$MAXVOLUME" = "" ]
then
    MAXVOLUME="255"
fi

echo "You entered $MAXVOLUME "
echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file 

echo
echo "If you own one a cdrom player whose volume range is 128 to 255,"
echo "you might want to try answering YES to the next question."
echo "Enabling 'Curved Volume' will give you a square root like"
echo "volume slider - volume curve."
echo
echo $ac_n "Enable CURVED_VOLUME? (y/n) [n]:$ac_c"

read curved

case "$curved" in
    "yes" | "y" | "Yes" | "Y") echo "#define CURVED_VOLUME " >> $config_file ;;
esac

echo "#endif /* Sun*/" >> $config_file

}

sony_conf(){

clear
echo "KSCD configuration for Sony NEWS systems"
echo "---------------------------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(__sony_news) || defined(sony_news)" >> $config_file
echo "" >> $config_file

echo "Unfortunately, I have conflicting reports:"
echo "You might need a,b or c below."
echo "Please let me know what is required on Sony NEWS."
echo
echo "a) #include <CD.h> "
echo
echo "b) #include <newsiodev/scu.h>"
echo "   #include <newsiodev/scsireg.h>"
echo 
echo "c)  both of the above"
echo ""
echo $ac_n "Please choose a,b or c. [c]:$ac_c"

read sony_include

case "$sony_include" in 
  "a" | "A" )
  echo "Your choice was a"
  echo "#include <CD.h>" >> $config_file 
  ;;
  "b" | "B" )
  echo "Your choice was b"
  echo "#include <newsiodev/scu.h>" >> $config_file 
  echo "#include <newsiodev/scsireg.h>" >> $config_file 
  ;;
  * )
  echo "Your choice was c"
  echo "#include <CD.h>" >> $config_file 
  echo "#include <newsiodev/scu.h>" >> $config_file 
  echo "#include <newsiodev/scsireg.h>" >> $config_file 
  ;;
esac

echo 
echo $ac_n "Please specify your cdrom device [/dev/rsd/b0i6u0p2\0]:$ac_c"

read device
if [ "$device" = "" ]
then
    device="/dev/rsd/b0i6u0p2\0"
fi

echo "Your choice was:$device"
echo "#define DEFAULT_CD_DEVICE   \"$device\"  " >> $config_file

echo
echo "While most CDROM devices have a volume range from 0 to 255,"
echo "it appears that 128 to 255 is more appropriate for Sony NEWS."
echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
echo "until volume adjustment works to your satisfaction."
echo "Don't forget to let me know the result of your experiments."
echo
echo $ac_n "MIN_VOLUME [128]:$ac_c"

read MINVOLUME
if [ "$MINVOLUME" = "" ]
then
    MINVOLUME="128"
fi

echo "You entered $MINVOLUME "
echo "#define MIN_VOLUME $MINVOLUME " >> $config_file 

echo
echo $ac_n "MAX_VOLUME [255]:$ac_c"

read MAXVOLUME
if [ "$MAXVOLUME" = "" ]
then
    MAXVOLUME="255"
fi

echo "You entered $MAXVOLUME "
echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file 

echo "" >> $config_file
echo "#endif /* sony_news */" >> $config_file

}

ultrix_conf(){

clear
echo "KSCD configuration for Ultrix systems"
echo "---------------------------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(ultrix) || defined(__ultrix)" >> $config_file
echo "" >> $config_file

echo "Unfortunately, I have conflicting reports:"
echo "You might need a,b or c below."
echo "Please let me know what is required on Ultrix."
echo
echo "a) #include <sys/rzdisk.h>"
echo "   #include <sys/cdrom.h>"
echo
echo "b) #include <sys/devio.h>"
echo "   #include <io/cam/cam.h>"
echo "   #include <io/cam/uagt.h>"
echo "   #include <io/cam/dec_cam.h>"
echo "   #include <io/cam/scsi_all.h>"
echo ""
echo "c)  both of the above"
echo ""
echo $ac_n "Please choose a,b or c. [a]:$ac_c"

read ultrix_include

case "$ultrix_include" in 
  "c" | "C" )
  echo "Your choice was c)"
  echo ""
  echo "#include <sys/rzdisk.h>" >> $config_file 
  echo "#include <sys/cdrom.h>">> $config_file 
  echo ""
  echo "#include <sys/devio.h>" >> $config_file 
  echo "#include <io/cam/cam.h>" >> $config_file 
  echo "#include <io/cam/uagt.h>" >> $config_file 
  echo "#include <io/cam/dec_cam.h>" >> $config_file 
  echo "#include <io/cam/scsi_all.h>" >> $config_file 
  echo "" >> $config_file 
  ;;

  "b" | "B" )
  echo "Your choice was b"
  echo "#include <sys/devio.h>" >> $config_file 
  echo "#include <io/cam/cam.h>" >> $config_file 
  echo "#include <io/cam/uagt.h>" >> $config_file 
  echo "#include <io/cam/dec_cam.h>" >> $config_file 
  echo "#include <io/cam/scsi_all.h>" >> $config_file 
  ;;
  * )
  echo "Your choice was a"
  echo "#include <sys/rzdisk.h>" >> $config_file 
  echo "#include <sys/cdrom.h>">> $config_file 
  ;;
esac

echo
echo "While most CDROM devices have a volume range from 0 to 255,"
echo "it appears that 128 to 255 is more appropriate for Ultrix"
echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
echo "until volume adjustment works to your satisfaction."
echo "Don't forget to let me know the result of your experiments."
echo
echo $ac_n "MIN_VOLUME [128]:$ac_c"

read MINVOLUME
if [ "$MINVOLUME" = "" ]
then
    MINVOLUME="128"
fi

echo "You entered $MINVOLUME "
echo "#define MIN_VOLUME $MINVOLUME " >> $config_file 

echo
echo $ac_n "MAX_VOLUME [255]:$ac_c"

read MAXVOLUME
if [ "$MAXVOLUME" = "" ]
then
    MAXVOLUME="255"
fi

echo "You entered $MAXVOLUME "
echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file 

echo "" >> $config_file
echo "#endif /* ultrix */" >> $config_file

}

osf_conf(){

clear
echo "KSCD configuration for OSF systems"
echo "----------------------------------"
echo

give_instructions
write_config_header

echo "" >> config_file
echo "#if defined(__osf__)" >> $config_file

echo "Nothing to be done for OSF. The CD device should be automatically detected."
echo "If you have trouble look at plat_osf1.c and let me know what needs to be"
echo "changed."

echo ""
echo $ac_n "Press [Enter] to continue.$ac_c"
read dummy

echo "" >> $config_file
echo "#endif /* osf */" >> $config_file
echo "" >> $config_file

#endif    


}

generic_svr_conf(){

clear
echo "KSCD configuration for a generic SVR4 system"
echo "--------------------------------------------"
echo

give_instructions
write_config_header

echo "" >> $config_file
echo "#if defined(SVR4) && !defined(sun) && !defined(__sun__)" >> $config_file

echo $ac_n "Please specify your cdrom device [/dev/rcdrom/cd0]:$ac_c"

read device
if [ "$device" = "" ]
then
    device="/dev/rcdrom/cd0"
fi

echo "Your choice was:$device"
echo "#define DEFAULT_CD_DEVICE   \"$device\"  " >> $config_file

echo "" >> $config_file
echo "#endif /* SVR4 */" >> $config_file
echo "" >> $config_file

}

########################################################################
#
#        main
#
########################################################################

if [ -f $config_file ]
then
     echo "Found old config file. Will clean up first ...."
     rm $config_file
     sleep 1
fi

display_main_menu

if [ "$platform" = "q" ]
then
    clear
    echo "Good bye!"
    exit 1
fi

case "$platform" in 
l|L) linux_conf;;
f|F) freebsd_netbsd_conf;;
b|B) bsd386_conf;;
s|S) sun_conf;;
h|H) hp_conf;;
i|I) irix_conf;;
n|N) sony_conf;;
o|O) osf_conf;;
u|U) ultrix_conf;;
v|V) generic_svr_conf;;
*)   linux_conf;;
esac

sleep 1
clear
echo ""
echo "I have written your configuration choices to $config_file."
echo "Should you have trouble with the configuration file this"
echo "script generates, you can rename $ORG_CONFIG to $config_file"
echo "and edit it manually to suit your configuration."
echo ""
echo "Have fun with kscd!"
echo ""
echo "Bernd Johannes Wuebben"
echo "wuebben@kde.org"
echo "wuebben@math.cornell.edu"
echo ""
echo "Press [Enter] to start the compilation."
read  key
exit