source: trunk/config.sh

Last change on this file was 11672, checked in by felixka, 9 months ago
  • add Support Nagra CAK6.3 3DES overcrypt
  • patch tested and provided by @chimpie23
  • Property svn:eol-style set to LF
  • Property svn:executable set to *
File size: 21.0 KB
Line 
1#!/bin/sh
2
3addons="WEBIF WEBIF_LIVELOG WEBIF_JQUERY TOUCH WITH_SSL HAVE_DVBAPI WITH_NEUTRINO READ_SDT_CHARSETS IRDETO_GUESSING CS_ANTICASC WITH_DEBUG MODULE_MONITOR WITH_LB CS_CACHEEX CS_CACHEEX_AIO CW_CYCLE_CHECK LCDSUPPORT LEDSUPPORT CLOCKFIX IPV6SUPPORT"
4protocols="MODULE_CAMD33 MODULE_CAMD35 MODULE_CAMD35_TCP MODULE_NEWCAMD MODULE_CCCAM MODULE_CCCSHARE MODULE_GBOX MODULE_RADEGAST MODULE_SCAM MODULE_SERIAL MODULE_CONSTCW MODULE_PANDORA MODULE_GHTTP"
5readers="READER_NAGRA READER_NAGRA_MERLIN READER_IRDETO READER_CONAX READER_CRYPTOWORKS READER_SECA READER_VIACCESS READER_VIDEOGUARD READER_DRE READER_TONGFANG READER_BULCRYPT READER_GRIFFIN READER_DGCRYPT"
6card_readers="CARDREADER_PHOENIX CARDREADER_INTERNAL CARDREADER_SC8IN1 CARDREADER_MP35 CARDREADER_SMARGO CARDREADER_DB2COM CARDREADER_STAPI CARDREADER_STAPI5 CARDREADER_STINGER CARDREADER_DRECAS"
7
8defconfig="
9CONFIG_WEBIF=y
10CONFIG_WEBIF_LIVELOG=y
11CONFIG_WEBIF_JQUERY=y
12# CONFIG_TOUCH=n
13# CONFIG_WITH_SSL=n
14CONFIG_HAVE_DVBAPI=y
15# CONFIG_WITH_NEUTRINO=n
16CONFIG_READ_SDT_CHARSETS=y
17CONFIG_IRDETO_GUESSING=y
18# CONFIG_CS_ANTICASC=n
19CONFIG_WITH_DEBUG=y
20CONFIG_MODULE_MONITOR=y
21CONFIG_WITH_LB=y
22# CONFIG_CS_CACHEEX=n
23# CONFIG_CS_CACHEEX_AIO=n
24# CONFIG_CW_CYCLE_CHECK=n
25# CONFIG_LCDSUPPORT=n
26# CONFIG_LEDSUPPORT=n
27# CONFIG_CLOCKFIX=n
28# CONFIG_IPV6SUPPORT=n
29# CONFIG_MODULE_CAMD33=n
30CONFIG_MODULE_CAMD35=y
31CONFIG_MODULE_CAMD35_TCP=y
32CONFIG_MODULE_NEWCAMD=y
33CONFIG_MODULE_CCCAM=y
34CONFIG_MODULE_CCCSHARE=y
35CONFIG_MODULE_GBOX=y
36# CONFIG_MODULE_RADEGAST=n
37# CONFIG_MODULE_SERIAL=n
38# CONFIG_MODULE_CONSTCW=n
39# CONFIG_MODULE_PANDORA=n
40CONFIG_MODULE_SCAM=y
41# CONFIG_MODULE_GHTTP=n
42CONFIG_WITH_CARDREADER=y
43CONFIG_READER_NAGRA_COMMON=y
44CONFIG_READER_NAGRA=y
45CONFIG_READER_NAGRA_MERLIN=y
46CONFIG_READER_IRDETO=y
47CONFIG_READER_CONAX=y
48CONFIG_READER_CRYPTOWORKS=y
49CONFIG_READER_SECA=y
50CONFIG_READER_VIACCESS=y
51CONFIG_READER_VIDEOGUARD=y
52CONFIG_READER_DRE=y
53CONFIG_READER_TONGFANG=y
54CONFIG_READER_BULCRYPT=y
55CONFIG_READER_GRIFFIN=y
56CONFIG_READER_DGCRYPT=y
57CARDREADER_PHOENIX=y
58# CARDREADER_DRECAS=n
59CARDREADER_INTERNAL=y
60# CARDREADER_SC8IN1=n
61# CARDREADER_MP35=n
62# CARDREADER_SMARGO=n
63# CARDREADER_DB2COM=n
64# CARDREADER_STAPI=n
65# CARDREADER_STAPI5=n
66CARDREADER_STINGER=y
67"
68
69usage() {
70 echo \
71"OSCam config
72Usage: `basename $0` [parameters]
73
74 -g, --gui Start interactive configuration
75
76 -s, --show-enabled [param] Show enabled configuration options.
77 -Z, --show-disabled [param] Show disabled configuration options.
78 -S, --show-valid [param] Show valid configuration options.
79 Possible params: all, addons, protocols,
80 readers, card_readers
81
82 -l, --list-config List active configuration variables.
83 -e, --enabled [option] Check if certain option is enabled.
84 -d, --disabled [option] Check if certain option is disabled.
85
86 -E, --enable [option] Enable config option.
87 -D, --disable [option] Disable config option.
88
89 The following [option]s enable or disable multiple settings.
90 all - Everything.
91 addons - All addons.
92 protocols - All protocols.
93 readers - All readers.
94 card_readers - All card readers.
95
96 -R, --restore Restore default config.
97
98 -v, --oscam-version Display OSCam version.
99 -r, --oscam-revision Display OSCam SVN revision.
100
101 -O, --detect-osx-sdk-version Find where OS X SDK is located
102
103 -h, --help Display this help text.
104
105Examples:
106 # Enable WEBIF and SSL
107 ./config.sh --enable WEBIF WITH_SSL
108
109 # Disable WEBIF but enable WITH_SSL
110 ./config.sh --disable WEBIF --enable WITH_SSL
111
112 # Restore defaults and disable WEBIF and READER_NAGRA
113 ./config.sh --restore --disable WEBIF READER_NAGRA
114
115 # Use default config with only one enabled reader
116 ./config.sh --restore --disable readers --enable READER_BULCRYPT
117
118 # Disable everything and enable webif one module and one card reader
119 ./config.sh --disable all --enable WEBIF MODULE_NEWCAMD READER_BULCRYPT
120
121 # Disable all card readers except INTERNAL
122 ./config.sh -D card_readers -E CARDREADER_INTERNAL
123
124Available options:
125 addons: $addons
126 protocols: $protocols
127 readers: $readers
128 card_readers: $card_readers
129"
130}
131
132# Output directory for config.mak set by --objdir parameter
133OBJDIR=.
134
135# Use flags set by --use-flags parameter
136USE_FLAGS=
137
138have_flag() {
139 for FLAG in $USE_FLAGS
140 do
141 [ "$FLAG" = "$1" ] && return 0
142 done
143 return 1
144}
145
146have_all_flags() {
147 for opt ; do
148 have_flag $opt || return 1
149 done
150 return 0
151}
152
153have_any_flags() {
154 for opt ; do
155 have_flag $opt && return 0
156 done
157 return 1
158}
159
160not_have_flag() {
161 for FLAG in $USE_FLAGS
162 do
163 [ "$FLAG" = "$1" ] && return 1
164 done
165 return 0
166}
167
168not_have_all_flags() {
169 for opt ; do
170 not_have_flag $opt || return 1
171 done
172 return 0
173}
174
175not_have_any_flags() {
176 for opt ; do
177 not_have_flag $opt && return 0
178 done
179 return 1
180}
181
182# Config functions
183enabled() {
184 grep "^\#define $1 1$" config.h >/dev/null 2>/dev/null
185 return $?
186}
187
188disabled() {
189 grep "^\#define $1 1$" config.h >/dev/null 2>/dev/null
190 test $? = 0 && return 1
191 return 0
192}
193
194enabled_all() {
195 for opt ; do
196 enabled $opt || return 1
197 done
198 return 0
199}
200
201disabled_all() {
202 for opt ; do
203 disabled $opt || return 1
204 done
205 return 0
206}
207
208enabled_any() {
209 for opt ; do
210 enabled $opt && return 0
211 done
212 return 1
213}
214
215disabled_any() {
216 for opt ; do
217 disabled $opt && return 0
218 done
219 return 1
220}
221
222list_enabled() {
223 for OPT in $@
224 do
225 enabled $OPT && echo $OPT
226 done
227}
228
229list_disabled() {
230 for OPT in $@
231 do
232 disabled $OPT && echo $OPT
233 done
234}
235
236write_enabled() {
237 defined_file="webif/is_defined.txt"
238 pages_c="webif/pages.c"
239 rm -f $defined_file $pages_c 2>/dev/null
240 for OPT in $(get_opts) WITH_CARDREADER
241 do
242 enabled $OPT && printf "%s\n" $OPT >> $defined_file
243 done
244}
245
246valid_opt() {
247 [ "$1" = "WITH_CARDREADER" ] && return 0 # Special case
248 echo $addons $protocols $readers $card_readers | grep -w "$1" >/dev/null
249 return $?
250}
251
252enable_opt() {
253 valid_opt $1 && disabled $1 && {
254 sed -e "s|//#define $1 1$|#define $1 1|g" config.h > config.h.tmp && \
255 mv config.h.tmp config.h
256 echo "Enable $1"
257 }
258}
259
260enable_opts() {
261 for OPT in $@
262 do
263 enable_opt $OPT
264 done
265}
266
267disable_opt() {
268 valid_opt $1 && enabled $1 && {
269 sed -e "s|#define $1 1$|//#define $1 1|g" config.h > config.h.tmp && \
270 mv config.h.tmp config.h
271 echo "Disable $1"
272 }
273}
274
275disable_opts() {
276 for OPT in $@
277 do
278 disable_opt $OPT
279 done
280}
281
282get_opts() {
283 OPTS=""
284 case "$1" in
285 'addons') OPTS="$addons" ; ;;
286 'protocols') OPTS="$protocols" ; ;;
287 'readers') OPTS="$readers" ; ;;
288 'card_readers') OPTS="$card_readers" ; ;;
289 *) OPTS="$addons $protocols $readers $card_readers" ; ;;
290 esac
291 echo $OPTS
292}
293
294update_deps() {
295 # Calculate dependencies
296 enabled_any $(get_opts readers) $(get_opts card_readers) && enable_opt WITH_CARDREADER >/dev/null
297 disabled_all $(get_opts readers) $(get_opts card_readers) && disable_opt WITH_CARDREADER >/dev/null
298 disabled WEBIF && disable_opt WEBIF_LIVELOG >/dev/null
299 disabled WEBIF && disable_opt WEBIF_JQUERY >/dev/null
300 enabled MODULE_CCCSHARE && enable_opt MODULE_CCCAM >/dev/null
301 enabled_any CARDREADER_DB2COM CARDREADER_MP35 CARDREADER_SC8IN1 CARDREADER_STINGER && enable_opt CARDREADER_PHOENIX >/dev/null
302 enabled CS_CACHEEX_AIO && enable_opt CS_CACHEEX >/dev/null
303}
304
305list_config() {
306 update_deps
307 # Handle use flags
308 have_flag USE_STAPI && echo "CONFIG_WITH_STAPI=y" || echo "# CONFIG_WITH_STAPI=n"
309 have_flag USE_STAPI5 && echo "CONFIG_WITH_STAPI5=y" || echo "# CONFIG_WITH_STAPI5=n"
310 have_flag USE_COOLAPI && echo "CONFIG_WITH_COOLAPI=y" || echo "# CONFIG_WITH_COOLAPI=n"
311 have_flag USE_COOLAPI2 && echo "CONFIG_WITH_COOLAPI2=y" || echo "# CONFIG_WITH_COOLAPI2=n"
312 have_flag USE_SU980 && echo "CONFIG_WITH_SU980=y" || echo "# CONFIG_WITH_SU980=n"
313 have_flag USE_AZBOX && echo "CONFIG_WITH_AZBOX=y" || echo "# CONFIG_WITH_AZBOX=n"
314 have_flag USE_MCA && echo "CONFIG_WITH_MCA=y" || echo "# CONFIG_WITH_MCA=n"
315 have_flag USE_LIBCRYPTO && echo "CONFIG_WITH_LIBCRYPTO=y" || echo "# CONFIG_WITH_LIBCRYPTO=n"
316 for OPT in $addons $protocols WITH_CARDREADER $readers
317 do
318 enabled $OPT && echo "CONFIG_$OPT=y" || echo "# CONFIG_$OPT=n"
319 done
320 for OPT in $card_readers
321 do
322 if [ $OPT = CARDREADER_INTERNAL ]
323 then
324 # Internal card reader is actually three different readers depending on USE flags
325 enabled $OPT && have_flag USE_AZBOX && echo "CONFIG_${OPT}_AZBOX=y" || echo "# CONFIG_${OPT}_AZBOX=n"
326 enabled $OPT && have_any_flags USE_COOLAPI USE_SU980 && echo "CONFIG_${OPT}_COOLAPI=y" || echo "# CONFIG_${OPT}_COOLAPI=n"
327 enabled $OPT && have_flag USE_COOLAPI2 && echo "CONFIG_${OPT}_COOLAPI2=y" || echo "# CONFIG_${OPT}_COOLAPI2=n"
328 enabled $OPT && not_have_all_flags USE_AZBOX USE_COOLAPI USE_COOLAPI2 USE_SU980 && echo "CONFIG_${OPT}_SCI=y" || echo "# CONFIG_${OPT}_SCI=n"
329 continue
330 fi
331 if [ $OPT = CARDREADER_STAPI ]
332 then
333 # Enable CARDREADER_STAPI only if USE_STAPI is set
334 enabled $OPT && have_flag USE_STAPI && echo "CONFIG_$OPT=y" || echo "# CONFIG_$OPT=n"
335 continue
336 fi
337 if [ $OPT = CARDREADER_STAPI5 ]
338 then
339 # Enable CARDREADER_STAPI5 only if USE_STAPI5 is set
340 enabled $OPT && have_flag USE_STAPI5 && echo "CONFIG_$OPT=y" || echo "# CONFIG_$OPT=n"
341 continue
342 fi
343 enabled $OPT && echo "CONFIG_$OPT=y" || echo "# CONFIG_$OPT=n"
344 done
345 have_flag USE_LIBUSB && echo "CONFIG_CARDREADER_SMART=y" || echo "# CONFIG_CARDREADER_SMART=n"
346 have_flag USE_PCSC && echo "CONFIG_CARDREADER_PCSC=y" || echo "# CONFIG_CARDREADER_PCSC=n"
347 # Extra modules/libraries
348 enabled_any MODULE_GBOX WEBIF && echo "CONFIG_LIB_MINILZO=y" || echo "# CONFIG_LIB_MINILZO=n"
349 not_have_flag USE_LIBCRYPTO && echo "CONFIG_LIB_AES=y" || echo "# CONFIG_LIB_AES=n"
350 enabled MODULE_CCCAM && echo "CONFIG_LIB_RC6=y" || echo "# CONFIG_LIB_RC6=n"
351 not_have_flag USE_LIBCRYPTO && enabled MODULE_CCCAM && echo "CONFIG_LIB_SHA1=y" || echo "# CONFIG_LIB_SHA1=n"
352 enabled_any READER_DRE MODULE_SCAM READER_VIACCESS READER_NAGRA READER_NAGRA_MERLIN READER_VIDEOGUARD READER_CONAX && echo "CONFIG_LIB_DES=y" || echo "# CONFIG_LIB_DES=n"
353 enabled_any MODULE_CCCAM READER_NAGRA READER_NAGRA_MERLIN READER_SECA && echo "CONFIG_LIB_IDEA=y" || echo "# CONFIG_LIB_IDEA=n"
354 not_have_flag USE_LIBCRYPTO && enabled_any READER_CONAX READER_CRYPTOWORKS READER_NAGRA READER_NAGRA_MERLIN && echo "CONFIG_LIB_BIGNUM=y" || echo "# CONFIG_LIB_BIGNUM=n"
355 enabled READER_NAGRA_MERLIN && echo "CONFIG_LIB_MDC2=y" || echo "# CONFIG_LIB_MDC2=n"
356 enabled READER_NAGRA_MERLIN && echo "CONFIG_LIB_FAST_AES=y" || echo "# CONFIG_LIB_FAST_AES=n"
357 enabled READER_NAGRA_MERLIN && echo "CONFIG_LIB_SHA256=y" || echo "# CONFIG_LIB_SHA256=n"
358 enabled_any READER_NAGRA READER_NAGRA_MERLIN && echo "CONFIG_READER_NAGRA_COMMON=y" || echo "# CONFIG_READER_NAGRA_COMMON=n"
359}
360
361make_config_c() {
362 OPENSSL=$(which openssl 2>/dev/null)
363 if [ "$OPENSSL" = "" ]
364 then
365 echo "// openssl not found!"
366 echo "const char *config_mak = \"CFG: openssl not found in PATH!\";"
367 else
368 echo "// This file is generated by ./config.sh --objdir $OBJDIR --make-config.mak"
369 echo "const char *config_mak ="
370 printf " \"\\\nCFG: strings FILE | sed -n 's/^CFG~//p' | openssl enc -d -base64 | gzip -d\\\n\"\n"
371 gzip -9 < $OBJDIR/config.mak | $OPENSSL enc -base64 | while read LINE
372 do
373 printf " \"CFG~%s\\\\n\"\n" "$LINE"
374 done
375 echo " ;"
376 fi
377}
378
379make_config_mak() {
380 TMPFILE=$(mktemp -t config.mak.XXXXXX) || exit 1
381 list_config > $TMPFILE
382 [ ! -d $OBJDIR ] && mkdir -p $OBJDIR 2>/dev/null
383 cmp $TMPFILE $OBJDIR/config.mak >/dev/null 2>/dev/null
384 if [ $? != 0 ]
385 then
386 cat $TMPFILE > $OBJDIR/config.mak
387 make_config_c > $OBJDIR/config.c
388 else
389 make_config_c > $TMPFILE
390 cmp $TMPFILE $OBJDIR/config.c >/dev/null 2>/dev/null
391 [ $? != 0 ] && cat $TMPFILE > $OBJDIR/config.c
392 fi
393 rm -rf $TMPFILE
394}
395
396check_test() {
397 if [ "$(cat $tempfileconfig | grep "^#define $1 1$")" != "" ]; then
398 echo "on"
399 else
400 echo "off"
401 fi
402}
403
404disable_all() {
405 for i in $1; do
406 sed -e "s/^#define ${i} 1$/\/\/#define ${i} 1/g" $tempfileconfig > ${tempfileconfig}.tmp && \
407 mv ${tempfileconfig}.tmp $tempfileconfig
408 done
409}
410
411enable_package() {
412 for i in $(cat $tempfile); do
413 strip=$(echo $i | sed "s/\"//g")
414 sed -e "s/\/\/#define ${strip} 1$/#define ${strip} 1/g" $tempfileconfig > ${tempfileconfig}.tmp && \
415 mv ${tempfileconfig}.tmp $tempfileconfig
416 done
417}
418
419print_components() {
420 clear
421 echo "You have selected the following components:"
422 echo
423 echo "Add-ons:"
424 for i in $addons; do
425 printf "\t%-20s: %s\n" $i $(check_test "$i")
426 done
427
428 echo
429 echo "Protocols:"
430 for i in $protocols; do
431 printf "\t%-20s: %s\n" $i $(check_test "$i")
432 done
433
434 echo
435 echo "Readers:"
436 for i in $readers; do
437 printf "\t%-20s: %s\n" $i $(check_test "$i")
438 done
439
440 echo
441 echo "Card readers:"
442 for i in $card_readers; do
443 printf "\t%-20s: %s\n" $i $(check_test "$i")
444 done
445
446 cp -f $tempfileconfig $configfile
447}
448
449menu_addons() {
450 ${DIALOG} --checklist "\nChoose add-ons:\n " $height $width $listheight \
451 WEBIF "Web Interface" $(check_test "WEBIF") \
452 WEBIF_LIVELOG "LiveLog" $(check_test "WEBIF_LIVELOG") \
453 WEBIF_JQUERY "Jquery onboard (if disabled webload)" $(check_test "WEBIF_JQUERY") \
454 TOUCH "Touch Web Interface" $(check_test "TOUCH") \
455 WITH_SSL "OpenSSL support" $(check_test "WITH_SSL") \
456 HAVE_DVBAPI "DVB API" $(check_test "HAVE_DVBAPI") \
457 WITH_NEUTRINO "Neutrino support" $(check_test "WITH_NEUTRINO") \
458 READ_SDT_CHARSETS "DVB API read-sdt charsets" $(check_test "READ_SDT_CHARSETS") \
459 IRDETO_GUESSING "Irdeto guessing" $(check_test "IRDETO_GUESSING") \
460 CS_ANTICASC "Anti cascading" $(check_test "CS_ANTICASC") \
461 WITH_DEBUG "Debug messages" $(check_test "WITH_DEBUG") \
462 MODULE_MONITOR "Monitor" $(check_test "MODULE_MONITOR") \
463 WITH_LB "Loadbalancing" $(check_test "WITH_LB") \
464 CS_CACHEEX "Cache exchange" $(check_test "CS_CACHEEX") \
465 CS_CACHEEX_AIO "Cache exchange aio (depend on Cache exchange)" $(check_test "CS_CACHEEX_AIO") \
466 CW_CYCLE_CHECK "CW Cycle Check" $(check_test "CW_CYCLE_CHECK") \
467 LCDSUPPORT "LCD support" $(check_test "LCDSUPPORT") \
468 LEDSUPPORT "LED support" $(check_test "LEDSUPPORT") \
469 CLOCKFIX "Clockfix (disable on old systems!)" $(check_test "CLOCKFIX") \
470 IPV6SUPPORT "IPv6 support (experimental)" $(check_test "IPV6SUPPORT") \
471 2> ${tempfile}
472
473 opt=${?}
474 if [ $opt != 0 ]; then return; fi
475
476 disable_all "$addons"
477 enable_package
478}
479
480menu_protocols() {
481 ${DIALOG} --checklist "\nChoose protocols:\n " $height $width $listheight \
482 MODULE_CAMD33 "camd 3.3" $(check_test "MODULE_CAMD33") \
483 MODULE_CAMD35 "camd 3.5 UDP" $(check_test "MODULE_CAMD35") \
484 MODULE_CAMD35_TCP "camd 3.5 TCP" $(check_test "MODULE_CAMD35_TCP") \
485 MODULE_NEWCAMD "newcamd" $(check_test "MODULE_NEWCAMD") \
486 MODULE_CCCAM "CCcam" $(check_test "MODULE_CCCAM") \
487 MODULE_CCCSHARE "CCcam share" $(check_test "MODULE_CCCSHARE") \
488 MODULE_GBOX "gbox" $(check_test "MODULE_GBOX") \
489 MODULE_RADEGAST "radegast" $(check_test "MODULE_RADEGAST") \
490 MODULE_SERIAL "Serial" $(check_test "MODULE_SERIAL") \
491 MODULE_CONSTCW "constant CW" $(check_test "MODULE_CONSTCW") \
492 MODULE_PANDORA "Pandora" $(check_test "MODULE_PANDORA") \
493 MODULE_GHTTP "Ghttp" $(check_test "MODULE_GHTTP") \
494 MODULE_SCAM "scam" $(check_test "MODULE_SCAM") \
495 2> ${tempfile}
496
497 opt=${?}
498 if [ $opt != 0 ]; then return; fi
499
500 disable_all "$protocols"
501 enable_package
502}
503
504menu_readers() {
505 ${DIALOG} --checklist "\nChoose readers (CA systems):\n " $height $width $listheight \
506 READER_NAGRA "Nagravision" $(check_test "READER_NAGRA") \
507 READER_NAGRA_MERLIN "Nagra Merlin" $(check_test "READER_NAGRA_MERLIN") \
508 READER_IRDETO "Irdeto" $(check_test "READER_IRDETO") \
509 READER_CONAX "Conax" $(check_test "READER_CONAX") \
510 READER_CRYPTOWORKS "Cryptoworks" $(check_test "READER_CRYPTOWORKS") \
511 READER_SECA "Seca" $(check_test "READER_SECA") \
512 READER_VIACCESS "Viaccess" $(check_test "READER_VIACCESS") \
513 READER_VIDEOGUARD "NDS Videoguard" $(check_test "READER_VIDEOGUARD") \
514 READER_DRE "DRE Crypt" $(check_test "READER_DRE") \
515 READER_TONGFANG "Tongfang" $(check_test "READER_TONGFANG") \
516 READER_BULCRYPT "Bulcrypt" $(check_test "READER_BULCRYPT") \
517 READER_GRIFFIN "Griffin" $(check_test "READER_GRIFFIN") \
518 READER_DGCRYPT "DGCrypt" $(check_test "READER_DGCRYPT") \
519 2> ${tempfile}
520
521 opt=${?}
522 if [ $opt != 0 ]; then return; fi
523
524 disable_all "$readers"
525 enable_package
526}
527
528menu_card_readers() {
529 ${DIALOG} --checklist "\nChoose card reader drivers:\n " $height $width $listheight \
530 CARDREADER_PHOENIX "Phoenix/mouse" $(check_test "CARDREADER_PHOENIX") \
531 CARDREADER_INTERNAL "Internal (Sci,Azbox,Cool)" $(check_test "CARDREADER_INTERNAL") \
532 CARDREADER_SC8IN1 "SC8in1" $(check_test "CARDREADER_SC8IN1") \
533 CARDREADER_MP35 "AD-Teknik MP 3.6/USB Phoenix" $(check_test "CARDREADER_MP35") \
534 CARDREADER_SMARGO "Argolis Smargo Smartreader" $(check_test "CARDREADER_SMARGO") \
535 CARDREADER_DB2COM "dbox2" $(check_test "CARDREADER_DB2COM") \
536 CARDREADER_STAPI "STAPI" $(check_test "CARDREADER_STAPI") \
537 CARDREADER_STAPI5 "STAPI5" $(check_test "CARDREADER_STAPI5") \
538 CARDREADER_STINGER "STINGER" $(check_test "CARDREADER_STINGER") \
539 CARDREADER_DRECAS "DRECAS" $(check_test "CARDREADER_DRECAS") \
540 2> ${tempfile}
541
542 opt=${?}
543 if [ $opt != 0 ]; then return; fi
544
545 disable_all "$card_readers"
546 enable_package
547}
548
549
550config_dialog() {
551 height=30
552 width=65
553 listheight=16
554
555 DIALOG=${DIALOG:-`which dialog`}
556 if [ -z "${DIALOG}" ]; then
557 echo "Please install dialog package." 1>&2
558 exit 1
559 fi
560
561 configfile=config.h
562 tempfile=$(mktemp -t oscam-config.dialog.XXXXXX) || exit 1
563 tempfileconfig=$(mktemp -t oscam-config.h.XXXXXX) || exit 1
564 trap 'rm -f $tempfile $tempfileconfig $tempfileconfig.bak 2>/dev/null' INT TERM EXIT
565 cp -f $configfile $tempfileconfig
566
567 while true; do
568 ${DIALOG} --menu "\nSelect category:\n " $height $width $listheight \
569 Add-ons "Add-ons" \
570 Protocols "Network protocols" \
571 Readers "Readers (CA systems)" \
572 CardReaders "Card reader drivers" \
573 Save "Save" \
574 2> ${tempfile}
575
576 opt=${?}
577 if [ $opt != 0 ]; then clear; exit; fi
578
579 menuitem=$(cat $tempfile)
580 case $menuitem in
581 Add-ons) menu_addons ;;
582 Protocols) menu_protocols ;;
583 Readers) menu_readers ;;
584 CardReaders) menu_card_readers ;;
585 Save)
586 print_components
587 update_deps
588 write_enabled
589 exit 0
590 ;;
591 esac
592 done
593}
594
595# Change working directory to the directory where the script is
596cd $(dirname $0)
597
598if [ $# = 0 ]
599then
600 usage
601 exit 1
602fi
603
604while [ $# -gt 0 ]
605do
606 case "$1" in
607 '-g'|'--gui'|'--config'|'--menuconfig')
608 config_dialog
609 break
610 ;;
611 '-s'|'--show-enabled'|'--show')
612 shift
613 list_enabled $(get_opts $1)
614 # Take special care of USE_xxx flags
615 if [ "$1" = "card_readers" ]
616 then
617 have_flag USE_LIBUSB && echo "CARDREADER_SMART"
618 have_flag USE_PCSC && echo "CARDREADER_PCSC"
619 fi
620 break
621 ;;
622 '-Z'|'--show-disabled')
623 shift
624 list_disabled $(get_opts $1)
625 break
626 ;;
627 '-S'|'--show-valid')
628 shift
629 for OPT in $(get_opts $1)
630 do
631 echo $OPT
632 done
633 break
634 ;;
635 '-E'|'--enable')
636 shift
637 while [ "$1" != "" ]
638 do
639 case "$1" in
640 -*)
641 update_deps
642 continue 2
643 ;;
644 all|addons|protocols|readers|card_readers)
645 enable_opts $(get_opts $1)
646 ;;
647 *)
648 enable_opt "$1"
649 ;;
650 esac
651 shift
652 done
653 update_deps
654 write_enabled
655 ;;
656 '-D'|'--disable')
657 shift
658 while [ "$1" != "" ]
659 do
660 case "$1" in
661 -*)
662 update_deps
663 continue 2
664 ;;
665 all|addons|protocols|readers|card_readers)
666 disable_opts $(get_opts $1)
667 ;;
668 *)
669 disable_opt "$1"
670 ;;
671 esac
672 shift
673 done
674 update_deps
675 write_enabled
676 ;;
677 '-R'|'--restore')
678 echo $defconfig | sed -e 's|# ||g' | xargs printf "%s\n" | grep "=y$" | sed -e 's|^CONFIG_||g;s|=.*||g' |
679 while read OPT
680 do
681 enable_opt "$OPT"
682 done
683 echo $defconfig | sed -e 's|# ||g' | xargs printf "%s\n" | grep "=n$" | sed -e 's|^CONFIG_||g;s|=.*||g' |
684 while read OPT
685 do
686 disable_opt "$OPT"
687 done
688 update_deps
689 write_enabled
690 ;;
691 '-e'|'--enabled')
692 enabled $2 && echo "Y" && exit 0 || echo "N" && exit 1
693 break
694 ;;
695 '-d'|'--disabled')
696 disabled $2 && echo "Y" && exit 0 || echo "N" && exit 1
697 break
698 ;;
699 '-v'|'--oscam-version')
700 grep CS_VERSION globals.h | cut -d\" -f2
701 break
702 ;;
703 '-r'|'--oscam-revision')
704 revision=`(svnversion -n . 2>/dev/null || printf 0) | sed 's/.*://; s/[^0-9]*$//; s/^$/0/'`
705 if [ "$revision" = "0" ]
706 then
707 which git > /dev/null 2>&1 && revision=`git log -10 --pretty=%B | grep git-svn-id | head -n 1 | sed -n -e 's/^.*trunk@\([0-9]*\) .*$/\1/p'`
708 fi
709 echo $revision
710 break
711 ;;
712 '-O'|'--detect-osx-sdk-version')
713 shift
714 OSX_VER=${1:-10.10}
715 for DIR in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX{$OSX_VER,10.10,10.9,10.8,10.7}.sdk /Developer/SDKs/MacOSX{$OSX_VER,10.6,10.5}.sdk
716
717 do
718 if test -d $DIR
719 then
720 echo $DIR
721 exit 0
722 fi
723 done
724 echo Cant_find_OSX_SDK
725 break
726 ;;
727 '-l'|'--list-config')
728 list_config
729 exit 0
730 ;;
731 '-m'|'--make-config.mak')
732 make_config_mak
733 exit 0
734 ;;
735 '--use-flags')
736 shift
737 USE_FLAGS=$1
738 ;;
739 '--objdir')
740 shift
741 OBJDIR=$1
742 ;;
743 '-h'|'--help')
744 usage
745 break
746 ;;
747 *)
748 echo "[WARN] Unknown parameter: $1" >&2
749 ;;
750 esac
751 # Some shells complain when there are no more parameters to shift
752 test $# -gt 0 && shift
753done
754
755exit 0
Note: See TracBrowser for help on using the repository browser.