-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheciadsl-config-text.in
executable file
·906 lines (868 loc) · 29.6 KB
/
eciadsl-config-text.in
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
#!/bin/bash
#
# EciAdsl Linux driver configuration script.
# Same goal as eciadsl-config-tk, but can be run in a terminal / console.
#
# Usage :
# eciadsl-config-text <file.bin> change quickly .bin file to sync
# without parameter : interactive mode for configuration
#
# Author : FlashCode <[email protected]>
# Creation : 2002/10/06
# Licence : GPL
#
# <CONFIG>
BIN_DIR="@bindir@"
ETC_DIR="@sysconfdir@"
CONF_DIR="@sysconfdir@/eciadsl"
PPPD_DIR="@sysconfdir@/ppp"
VERSION="@PACKAGE_VERSION@"
# </CONFIG>
if [ "$1" == "--version" -o "$1" == "-v" ]; then
echo "$VERSION"
exit 0
fi
tmpbin=/tmp/binfile.tmp
gs_chipsets="GS7070|GS7470"
previous="Previous setting"
if [ $UID -ne 0 ]; then
echo -e "This script must be run as root.\nType in root password, please."
su - -c "DISPLAY=$DISPLAY PATH=$PATH $0 $*"
exit 1
fi
if [ -s "$CONF_DIR/eciadsl.conf" ]; then
prev_vpi=`grep -E "^[ \t]*VPI[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_vci=`grep -E "^[ \t]*VCI[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_vid1=`grep -E "^[ \t]*VID1[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_pid1=`grep -E "^[ \t]*PID1[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_vid2=`grep -E "^[ \t]*VID2[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_pid2=`grep -E "^[ \t]*PID2[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_mode=`grep -E "^[ \t]*MODE[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_firmware=`grep -E "^[ \t]*FIRMWARE[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_synch=`grep -E "^[ \t]*SYNCH[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_staticip=`grep -E "^[ \t]*STATICIP[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_gateway=`grep -E "^[ \t]*GATEWAY[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_use_staticip=`grep -E "^[ \t]*USE_STATICIP[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_use_dhcp=`grep -E "^[ \t]*USE_DHCP[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -d " \t"`
prev_modem=`grep -E "^[ \t]*MODEM[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_provider=`grep -E "^[ \t]*PROVIDER[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_dns1=`grep -E "^[ \t]*DNS1[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_dns2=`grep -E "^[ \t]*DNS2[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_pppd_user=`grep -E "^[ \t]*PPPD_USER[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_pppd_passwd=`grep -E "^[ \t]*PPPD_PASSWD[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_synch_opt=`grep -E "^[ \t]*SYNCH_OPTIONS[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_pppoeci_opt=`grep -E "^[ \t]*PPPOECI_OPTIONS[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
# new params for GS7470 GS7070 chipset driver integration - kolja
prev_altsynch=`grep -E "^[ \t]*SYNCH_ALTIFACE[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_altpppoeci=`grep -E "^[ \t]*PPPOECI_ALTIFACE[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
prev_chipset=`grep -E "^[ \t]*MODEM_CHIPSET[ \t]*=" "$CONF_DIR/eciadsl.conf" | tail -n 1 | cut -f 2 -d '=' | tr -s "\t" " "`
chipset="$prev_chipset"
fi
case "$1" in
"@menu@")
choice_ok=0
echo $2 | grep -E "^[^|]+(\|[^|]+)*\|[^|]+$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "*** internal error: invalid menu\n$2"
exit 255
fi
while [ $choice_ok -eq 0 ]; do
item=$(echo $2 | cut -f 1 -d '|')
echo -e "$item:\n"
i=0
fin=0
possible="|"
while [ $fin -eq 0 ]; do
i=$(expr $i + 1)
item=$(echo $2 | cut -f `expr $i + 1` -d '|')
if [ -n "$item" ]; then
echo "$i) $item"
possible="$possible$i|"
else
fin=1
fi
done
i=$(expr $i - 1)
echo -en "\nEnter your choice (1-$i, default is 1): "
read choice_menu
if [ -z "$choice_menu" ]; then
choice_menu=1
fi
echo $possible | grep "$choice_menu" > /dev/null 2>&1
if [ $? -eq 0 ]; then
choice_ok=1
else
echo -e "** Incorrect choice, try again\n"
fi
done
exit $choice_menu
;;
"@bin@")
echo
fichiers_bin=""
if [ "$chipset" == "GS7470" ]; then
for bin in $(find "$CONF_DIR" -type f -name "gs7470_*.bin" | grep -v "firmware"| grep -v "a.bin"| grep -v "b.bin"); do
fichiers_bin="$fichiers_bin|$bin"
done
else
if [ "$chipset" == "GS7070" ]; then
for bin in $(find "$CONF_DIR" -type f -name "*.bin" | grep -v "firmware"| grep -v "gs7470"| grep -v "a.bin"| grep -v "b.bin"); do
fichiers_bin="$fichiers_bin|$bin"
done
else
for bin in $(find "$CONF_DIR" -type f -name "*.bin" | grep -v "firmware"| grep -v "a.bin"| grep -v "b.bin"); do
fichiers_bin="$fichiers_bin|$bin"
done
fi
fi
if [ -z "$fichiers_bin" ]; then
echo "WARNING: no synch .bin file found in $CONF_DIR or subdirectories"
echo "Please check your driver installation!"
if [ -n "$prev_synch" ]; then
echo "Previous selection kept"
echo "$prev_synch" > $tmpbin
exit 0
else
echo "** skipping synch .bin selection"
:> $tmpbin
exit 255
fi
fi
if [ -n "$prev_synch" ]; then
fichiers_bin="|$previous ($prev_synch)$fichiers_bin"
fi
fichiers_bin="Select your .bin file for synch$fichiers_bin"
$0 @menu@ "$fichiers_bin"
ret=$?
test $ret -eq 255 && exit 255
bin=$(expr $ret + 1)
echo "$(echo $fichiers_bin | cut -f $bin -d '|')" > $tmpbin
exit 0
;;
"")
menu1="Your choice|Configure all settings|Remove dabusb module|Change synch .bin file"
if [ ! -d $CONF_DIR ]; then
echo -e "*** config directory not found\n"
exit 1
fi
OLDIFS="$IFS"
IFS="
"
providers_db="$CONF_DIR/providers.db"
providers="Select your provider"
servers_dns1="*"
servers_dns2="*"
if [ -n "$prev_provider" -a -n "$prev_dns1" -o -n "$prev_dns2" ]; then
test -z "$prev_dns1" && prev_dns1="?"
test -z "$prev_dns2" && prev_dns2="?"
# if the saved provider label is known but the saved DNS don't match,
# assume Other and keep DNS
dns1_="$(grep -v -E "^[ \t]*#" "$providers_db" | grep "$prev_provider" | tr -s "\t" "|" | cut -d '|' -f 2)"
dns2_="$(grep -v -E "^[ \t]*#" "$providers_db" | grep "$prev_provider" | tr -s "\t" "|" | cut -d '|' -f 3)"
if [ "$prev_provider" != "Other" -a "$dns1_" != "$prev_dns1" -o "$dns2_" != "$prev_dns2" ]; then
prev_provider="Other"
servers_dns1="$servers_dns1|$prev_dns1"
servers_dns2="$servers_dns2|$prev_dns2"
else
servers_dns1="$servers_dns1|$dns1_"
servers_dns2="$servers_dns2|$dns2_"
fi
providers="$providers|$previous ($prev_provider)"
fi
for LINE in $(grep -v -E "^[ \t]*#" "$providers_db" | tr -s "\t" "|" | cut -d '|' -f 1); do
providers="$providers|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$providers_db" | tr -s "\t" "|" | cut -d '|' -f 2); do
servers_dns1="$servers_dns1|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$providers_db"| tr -s "\t" "|" | cut -d '|' -f 3); do
servers_dns2="$servers_dns2|$LINE"
done
providers="$providers|Other"
servers_dns1="$servers_dns1|?"
servers_dns2="$servers_dns2|?"
modems_db="$CONF_DIR/modems.db"
modems="Select your modem"
vid1pid1="*"
vid2pid2="*"
chipset_all="*"
altsynch_all="*"
altpppoeci_all="*"
if [ -n "$prev_modem" -a -n "$prev_vid1" -o -n "$prev_pid1" -o -n "$prev_vid2" -o -n "$prev_pid2" -o -n "$prev_altsynch" -o -n "$prev_altpppoeci" -o -n "$prev_chipset" ]; then
test -z "$prev_vid1" && prev_vid1="????"
test -z "$prev_pid1" && prev_pid1="????"
test -z "$prev_vid2" && prev_vid2="????"
test -z "$prev_pid2" && prev_pid2="????"
test -z "$prev_altsynch" && prev_altsynch="?"
test -z "$prev_altppoeci" && prev_altppoeci="?"
test -z "$prev_chipset" && prev_chipset="GS????"
# if the saved modem label is known but the saved VIDPID, altsynch, altpppoeci & modem chipset don't match,
# assume Other and keep prev fields
vid1_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 2)"
pid1_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 3)"
vid2_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 4)"
pid2_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 5)"
chipset_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 6)"
altsynch_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 7)"
altpppoeci_="$(grep -v -E "^[ \t]*#" "$modems_db" | grep "$prev_modem" | tr -s "\t" "|" | cut -d '|' -f 8)"
if [ "$prev_modem" != "Other" -a "$vid1_" != "$prev_vid1" -o "$pid1_" != "$prev_pid1" -o "$vid2_" != "$prev_vid2" -o "$pid2_" != "$prev_pid2" -o "altsynch_" != "$prev_altsynch" -o "altpppoeci_" != "$prev_altpppoeci" -o "chipset_" != "$prev_chipset" ]; then
prev_modem="Other"
vid1pid1="$vid1pid1|$prev_vid1$prev_pid1"
vid2pid2="$vid2pid2|$prev_vid2$prev_pid2"
chipset_all="$chipset_all|$prev_chipset"
altsynch_all="$altsynch_all|$prev_altsynch"
altpppoeci_all="$altsynch_all|$prev_altpppoeci"
else
vid1pid1="$vid1pid1|$vid1_$pid1_"
vid2pid2="$vid2pid2|$vid2_$pid2_"
chipset_all="$chipset_all|$chipset_"
altsynch_all="$altsynch_all|$altsynch_"
altpppoeci_all="$altsynch_all|$altpppoeci_"
fi
modems="$modems|$previous ($prev_modem)"
fi
for LINE in $(grep -v -E "^[ \t]*#" "$modems_db" | tr -s "\t" "|" | cut -d "|" -f 1); do
modems="$modems|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$modems_db" | tr -s "\t" "|" | cut -d "|" -f 2-3 | tr -d "| "); do
vid1pid1="$vid1pid1|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$modems_db" | tr -s "\t" "|" | cut -d "|" -f 4-5 | tr -d "| "); do
vid2pid2="$vid2pid2|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$modems_db" | tr -s "\t" "|" | cut -d "|" -f 6); do
chipset_all="$chipset_all|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$modems_db" | tr -s "\t" "|" | cut -d "|" -f 7); do
altsynch_all="$altsynch_all|$LINE"
done
for LINE in $(grep -v -E "^[ \t]*#" "$modems_db" | tr -s "\t" "|" | cut -d "|" -f 8); do
altpppoeci_all="$altpppoeci_all|$LINE"
done
IFS="$OLDIFS"
modems="$modems|Other"
vid1pid1="$vid1pid1|????????"
vid2pid2="$vid2pid2|????????"
echo -e "\n===== Welcome to the EciAdsl Linux driver configuration =====\n"
echo -e "At any time, press Ctrl+C to quit this script without saving modifications.\n"
echo -e "Tip: you can run eciadsl-config-text with a .bin file as parameter to change\nyour .bin quickly.\n"
$0 @menu@ "$menu1"
ret=$?
test $ret -eq 255 && exit 1
config=$ret
### Global EciAdsl configuration ###
if [ $config -eq 1 ]; then
echo -e "\n===> EciAdsl driver setup <===\n"
user=""
while [ -z "$user" ]; do
if [ -n "$prev_pppd_user" ]; then
echo "Current user name is: $prev_pppd_user"
TMP=", press ENTER to keep the previous one"
else
TMP=""
fi
echo -n "Type in your user name (given by your provider$TMP): "
read user
if [ -z "$user" -a -n "$prev_pppd_user" ]; then
user="$prev_pppd_user"
echo "* user name unchanged"
fi
done
echo
pwdmatch=0
while [ $pwdmatch -eq 0 ]; do
if [ -n "$prev_pppd_passwd" ]; then
echo "Current password is: $prev_pppd_passwd"
TMP=", press ENTER to keep the previous one"
else
TMP=""
fi
stty -echo
password1=""
while [ -z "$password1" ]; do
echo -n "Type in your password (given by your provider$TMP): "
read password1
echo
if [ -z "$password1" -a -n "$prev_pppd_passwd" ]; then
password1="$prev_pppd_passwd"
echo "* password unchanged"
fi
done
if [ "$password1" == "$prev_pppd_passwd" ]; then
password2="$password1"
else
password2=""
while [ -z "$password2" ]; do
echo -n "Type in your password again (for verification$TMP): "
read password2
echo
done
fi
stty echo
if [ "$password1" == "$password2" ]; then
pwdmatch=1
else
echo -e "** passwords don't match, try again\n"
fi
done
echo
$0 @menu@ "$providers"
ret=$?
test $ret -eq 255 && exit 1
provider=$(expr $ret + 1)
dns1="$(echo $servers_dns1 | cut -f $provider -d '|')"
dns2="$(echo $servers_dns2 | cut -f $provider -d '|')"
echo
echo "If your provider was not listed (or if you want to overwrite"
echo "defaults), you can type in your own DNS servers:"
echo
echo -n "DNS1 currently "
if [ "$dns1" == "?" ]; then
echo "unset"
TMP="skip"
else
echo "set to $dns1"
TMP="keep current value"
fi
i_dns1=""
while [ -z "$i_dns1" ]; do
echo -n "Type in an IP for DNS1 (press ENTER to $TMP): "
read i_dns1
if [ -z "$i_dns1" ]; then
if [ "$dns1" == "?" ]; then
dns1=""
else
echo "* DNS1 unchanged"
fi
break
else
echo $i_dns1 | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
i_dns1=""
echo -e "** invalid IP for DNS1, please retry\n"
else
if [ "$i_dns1" != "$dns1" ]; then
provider="Other"
dns1="$i_dns1"
fi
fi
fi
done
echo
i_dns2=""
echo -n "DNS2 currently "
if [ "$dns2" == "?" ]; then
echo "unset"
TMP="skip"
else
echo "set to $dns2"
TMP="keep current value"
fi
while [ -z "$i_dns2" ]; do
echo -n "Type in an IP for DNS2 (press ENTER to $TMP): "
read i_dns2
if [ -z "$i_dns2" ]; then
if [ "$dns2" == "?" ]; then
dns2=""
else
echo "* DNS2 unchanged"
fi
break
else
echo $i_dns2 | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
i_dns2=""
echo -e "** invalid IP for DNS2, please retry\n"
else
if [ "$i_dns2" != "$dns2" ]; then
provider="Other"
dns2="$i_dns2"
fi
fi
fi
done
echo
echo "Enter now your VPI/VCI (depending on your provider/country)"
echo "Example for France: 8 35 (VPI=8, VCI=35)"
echo "These values correspond to the number dialed under Windows."
echo
echo -n "VPI currently "
if [ -z "$prev_vpi" ]; then
echo "unset"
TMP=""
else
echo "set to $prev_vpi"
TMP=", press ENTER to keep the previous one"
fi
vpi=""
while [ -z "$vpi" ]; do
echo -n "Type in your VPI (given by your provider$TMP): "
read vpi
if [ -n "$prev_vpi" -a -z "$vpi" ]; then
vpi="$prev_vpi"
echo "* VPI unchanged"
else
echo $vpi | grep -E "^[0-9]+$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
vpi=""
echo -e "** invalid VPI, please enter it again\n"
else
if [ $vpi -ge 4096 ]; then
vpi=""
echo -e "** VPI not in range [0-4095], please enter it again\n"
fi
fi
fi
done
echo
echo -n "VCI currently "
if [ -z "$prev_vci" ]; then
echo "unset"
TMP=""
else
echo "set to $prev_vci"
TMP=", press ENTER to keep the previous one"
fi
vci=""
while [ -z "$vci" ]; do
echo -n "Type in your VCI (given by your provider$TMP): "
read vci
if [ -n "$prev_vci" -a -z "$vci" ]; then
vci="$prev_vci"
echo "* VCI unchanged"
else
echo $vci | grep -E "^[0-9]+$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
vci=""
echo -e "** invalid VCI, please enter it again\n"
else
if [ $vci -ge 65536 ]; then
vci=""
echo -e "** VCI not in range [0-65535], please enter it again\n"
fi
fi
fi
done
echo
$0 @menu@ "$modems"
ret=$?
test $ret -eq 255 && exit 1
modem=$(expr $ret + 1)
vid1="$(echo $vid1pid1 | cut -f $modem -d '|' | cut -c 1-4)"
pid1="$(echo $vid1pid1 | cut -f $modem -d '|' | cut -c 5-8)"
vid2="$(echo $vid2pid2 | cut -f $modem -d '|' | cut -c 1-4)"
pid2="$(echo $vid2pid2 | cut -f $modem -d '|' | cut -c 5-8)"
chipset="$(echo $chipset_all | cut -f $modem -d '|')"
altsynch="$(echo $altsynch_all | cut -f $modem -d '|')"
altpppoeci="$(echo $altpppoeci_all | cut -f $modem -d '|')"
echo
echo "If your modem was not listed (or if you want to overwrite defaults),"
echo "you can enter your own VID1/PID1/VID2/PID2 (use eciadsl-probe-device"
echo "to get them), Globespan chipset and USB alt interface values:"
echo
echo -n "VID1 currently "
if [ "$vid1" == "????" ]; then
echo "unset"
TMP=""
else
echo "set to $vid1"
TMP=", press ENTER to keep current value"
fi
i_vid1=""
while [ -z "$i_vid1" ]; do
echo -n "Type in a VID1 (4-digit hexadecimal$TMP): "
read i_vid1
if [ -z "$i_vid1" ]; then
if [ "$vid1" != "????" ]; then
echo "* VID1 unchanged"
break
else
echo -e "** VID1 still unset, please enter a value\n"
fi
else
echo $i_vid1 | grep -E "^([0-9A-Fa-f]{4})$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
vid1="$i_vid1"
else
i_vid1=""
echo -e "** invalid VID1, please enter it again\n"
fi
fi
done
echo
echo -n "PID1 currently "
if [ "$pid1" == "????" ]; then
echo "unset"
TMP=""
else
echo "set to $pid1"
TMP=", press ENTER to keep current value"
fi
i_pid1=""
while [ -z "$i_pid1" ]; do
echo -n "Type in a PID1 (4-digit hexadecimal$TMP): "
read i_pid1
if [ -z "$i_pid1" ]; then
if [ "$pid1" != "????" ]; then
echo "* PID1 unchanged"
break
else
echo -e "** PID1 still unset, please enter a value\n"
fi
else
echo $i_pid1 | grep -E "^([0-9A-Fa-f]{4})$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
pid1="$i_pid1"
else
i_pid1=""
echo -e "** invalid PID1, please enter it again\n"
fi
fi
done
echo
echo -n "VID2 currently "
if [ "$vid2" == "????" ]; then
echo "unset"
TMP=""
else
echo "set to $vid2"
TMP=", press ENTER to keep current value"
fi
i_vid2=""
while [ -z "$i_vid2" ]; do
echo -n "Type in a VID2 (4-digit hexadecimal$TMP): "
read i_vid2
if [ -z "$i_vid2" ]; then
if [ "$vid2" != "????" ]; then
echo "* VID2 unchanged"
break
else
echo -e "** VID2 still unset, please enter a value\n"
fi
else
echo $i_vid2 | grep -E "^([0-9A-Fa-f]{4})$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
vid2="$i_vid2"
else
i_vid2=""
echo -e "** invalid VID2, please enter it again\n"
fi
fi
done
echo
echo -n "PID2 currently "
if [ "$pid2" == "????" ]; then
echo "unset"
TMP=""
else
echo "set to $pid2"
TMP=", press ENTER to keep current value"
fi
i_pid2=""
while [ -z "$i_pid2" ]; do
echo -n "Type in a PID2 (4-digit hexadecimal$TMP): "
read i_pid2
if [ -z "$i_pid2" ]; then
if [ "$pid2" != "????" ]; then
echo "* PID2 unchanged"
break
else
echo -e "** PID2 still unset, please enter a value\n"
fi
else
echo $i_pid2 | grep -E "^([0-9A-Fa-f]{4})$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
pid2="$i_pid2"
else
i_pid2=""
echo -e "** invalid PID2, please enter it again\n"
fi
fi
done
#Add chipset & alt interfaces settings - kolja
echo
$0 @menu@ "Select your modem chipset|Previous setting ($chipset)|$gs_chipsets"
ret=$?
test $ret -eq 255 && exit 1
gs_chipsets="*|$chipset|$gs_chipsets"
chipset="$(echo $gs_chipsets | cut -f $(expr $ret + 1) -d '|')"
echo
echo -n "USB ALT INTERFACE for SYNCH process currently "
if [ "$altsynch" == "?" ]; then
if [ "$chipset" == "GS7070" ]; then
altsynch="4"
else
altsynch="5"
fi
fi
echo "set to $altsynch"
TMP=", press ENTER to keep current value"
i_altsynch=""
while [ -z "$i_altsynch" ]; do
echo -n "Type in the USB ALT INTERFACE for SYNCH (1-digit decimal (0-5) $TMP): "
read i_altsynch
if [ -z "$i_altsynch" ]; then
if [ "$altsynch" != "?" ]; then
echo "* USB ALT INTERFACE for SYNCH unchanged"
break
else
echo -e "** USB ALT INTERFACE for SYNCH still unset, please enter a value\n"
fi
else
echo $i_altsynch | grep -E "^([0-5]{1})$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
altsynch="$i_altsynch"
else
i_altsynch=""
echo -e "** invalid USB ALT INTERFACE for SYNCH, please enter it again\n"
fi
fi
done
echo
echo -n "USB ALT INTERFACE for PPPOECI process currently "
if [ "$altpppoeci" == "?" ]; then
if [ "$chipset" == "GS7070" ]; then
altpppoeci="4"
else
altpppoeci="1"
fi
fi
echo "set to $altpppoeci"
TMP=", press ENTER to keep current value"
i_altpppoeci=""
while [ -z "$i_altpppoeci" ]; do
echo -n "Type in the USB ALT INTERFACE for PPPOECI (1-digit decimal (0-5) $TMP): "
read i_altpppoeci
if [ -z "$i_altpppoeci" ]; then
if [ "$altpppoeci" != "?" ]; then
echo "* USB ALT INTERFACE for PPPOECI unchanged"
break
else
echo -e "** USB ALT INTERFACE for PPPOECI still unset, please enter a value\n"
fi
else
echo $i_altpppoeci | grep -E "^([0-5]{1})$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
altpppoeci="$i_altpppoeci"
else
i_altpppoeci=""
echo -e "** invalid USB ALT INTERFACE for PPPOECI, please enter it again\n"
fi
fi
done
$0 @bin@
ret=$?
binfile=$(cat $tmpbin)
rm -rf $tmpbin > /dev/null
OLDIFS="$IFS"
IFS="
"
modes="Select your PPP mode (use the DEFAULT one if you don't know what this means)"
if [ -n "$prev_mode" ]; then
modes="$modes|$previous ($prev_mode)"
fi
for LINE in $($BIN_DIR/eciadsl-pppoeci --modes 2>&1 | cut -d ' ' -f 1); do
modes="$modes|$LINE"
done
modes="$modes"
IFS="$OLDIFS"
$0 @menu@ "$modes"
ret=$?
test $ret -eq 255 && exit 1
mode=$(expr $ret + 1)
echo
if [ -n "$prev_use_dhcp" ]; then
echo -n "In current config, DHCP is "
if [ "$prev_use_dhcp" == "yes" ]; then
echo "enabled"
else
echo "disabled"
fi
TMP=" or press ENTER to keep current value"
else
TMP=""
fi
echo "Is DHCP used by your provider (MOST users should say NO)? "
use_dhcp=""
while [ -z "$use_dhcp" ]; do
echo -n "(y/n$TMP) "
read use_dhcp
case "$use_dhcp" in
y*|Y*) use_dhcp="yes"
;;
n*|N*) use_dhcp="no"
;;
"") if [ -n "$prev_use_dhcp" ]; then
use_dhcp="$prev_use_dhcp"
echo "* DHCP usage unchanged"
else
use_dhcp="no"
fi
;;
*) use_dhcp=""
echo -e "** invalid answer, try again\n"
;;
esac
done
if [ "$use_dhcp" != "yes" ]; then
echo
if [ -n "$prev_use_staticip" ]; then
echo -n "In current config, static IP is "
if [ "$prev_use_staticip" == "yes" ]; then
echo "used"
TMP=" or press ENTER to keep current setting"
else
echo "not used"
TMP=""
fi
else
TMP=""
fi
echo "Did you get a static IP from your provider (MOST users should say NO)? "
use_staticip=""
while [ -z "$use_staticip" ]; do
echo -n "(y/n$TMP) "
read use_staticip
case "$use_staticip" in
y*|Y*) use_staticip="yes"
;;
n*|N*) use_staticip="no"
;;
"") if [ -n "$prev_use_staticip" ]; then
use_staticip="$prev_use_staticip"
echo "* static IP usage unchanged"
else
use_staticip="no"
fi
;;
*) use_staticip=""
echo -e "** invalid answer, try again\n"
;;
esac
done
if [ "$use_staticip" == "yes" ]; then
if [ -n "$prev_staticip" ]; then
TMP=" (press ENTER to use $prev_staticip)"
else
TMP=""
fi
echo
echo -n "Type in your static IP$TMP: "
staticip=""
while [ -z "$staticip" ]; do
read staticip
case "$staticip" in
"") if [ -n "$prev_staticip" ]; then
staticip="$prev_staticip"
echo "* static IP unchanged"
fi
;;
*) echo "$staticip" | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
staticip=""
fi
;;
esac
test -z "$staticip" && echo -n "** invalid static IP, try again $TMP: "
done
if [ -n "$prev_gateway" ]; then
TMP=" (press ENTER to use $prev_gateway)"
else
TMP=""
fi
echo
echo -n "Type in your provider's gateway IP$TMP: "
gateway=""
while [ -z "$gateway" ]; do
read gateway
case "$gateway" in
"") if [ -n "$prev_gateway" ]; then
gateway="$prev_gateway"
echo "* gateway unchanged"
fi
;;
*) echo "$gateway" | grep -E "^([0-9]{1,3}\.){3}[0-9]{1,3}$" > /dev/null 2>&1
if [ $? -ne 0 ]; then
gateway=""
fi
;;
esac
test -z "$gateway" && echo -n "** invalid gateway IP, try again $TMP: "
done
fi
fi
# extract values from lists
mode="$(echo $modes | cut -f $mode -d '|')"
modem="$(echo $modems | cut -f $modem -d '|')"
test "$provider" != "Other" && provider="$(echo $providers | cut -f $provider -d '|')"
# remove "previous ()" is necessary
echo "$provider" | grep -E "^$previous \(.+\)$" > /dev/null 2>&1 && \
provider=$(echo "$provider" | cut -d '(' -f 2 | cut -d ')' -f 1)
echo "$modem" | grep -E "^$previous \(.+\)$" > /dev/null 2>&1 && \
modem=$(echo "$modem" | cut -d '(' -f 2 | cut -d ')' -f 1)
echo "$binfile" | grep -E "^$previous \(.+\)$" > /dev/null 2>&1 && \
binfile=$(echo "$binfile" | cut -d '(' -f 2 | cut -d ')' -f 1)
echo "$mode" | grep -E "^$previous \(.+\)$" > /dev/null 2>&1 && \
mode=$(echo "$mode" | cut -d '(' -f 2 | cut -d ')' -f 1)
echo
echo "==== Configuration will be created with these values :"
echo
echo " + User : $user"
echo " + Password : (hidden)"
echo " + Provider : $provider"
echo " DNS 1 : $dns1"
echo " DNS 2 : $dns2"
echo " + VPI/VCI : $vpi/$vci"
echo " + Modem : $modem"
echo " GS chipset : $chipset"
echo " VID1/PID1 : $vid1/$pid1"
echo " VID2/PID2 : $vid2/$pid2"
echo " ALT SYNCH : $altsynch"
echo " ALT PPPOECI : $altpppoeci"
echo " + .bin file : $binfile"
echo " + PPP mode : $mode"
echo " + use DHCP : $use_dhcp"
echo " + use static IP : $use_dhcp"
if [ "$use_staticip" == "yes" ]; then
echo " static IP : $staticip"
echo " gateway : $gateway"
fi
echo
echo "Press ENTER to create config files or Ctrl+C to exit now without saving."
read quitte
$BIN_DIR/eciadsl-makeconfig "$mode" "$user" "$password1" "$BIN_DIR/eciadsl-pppoeci" "$dns1" "$dns2" \
"$vpi" "$vci" "$vid1$pid1" "$vid2$pid2" "$binfile" "$firmware" \
"$staticip" "$gateway" "$use_staticip" "$use_dhcp" "$modem" "$provider" \
"$chipset" "$altsynch" "$altpppoeci"
if [ $? -eq 0 ]; then
echo
echo "==== eciadsl-config-text: Configuration updated with success !"
echo "You can now run eciadsl-start (as root) to connect to the internet."
else
echo "*** eciadsl-makeconfig reports error(s), please fix the problem and run eciadsl-config-text again."
fi
echo
elif [ $config -eq 2 ]; then
echo
echo "Please unplug your modem and then press ENTER"
read pause
eciadsl-remove-dabusb
echo
else
$0 @bin@
ret=$?
binfile=$(cat $tmpbin)
rm -rf $tmpbin > /dev/null
test $ret -eq 255 && exit 1
echo
$0 $binfile
echo
fi
;;
*)
# .bin change
$BIN_DIR/eciadsl-makeconfig --synch "$1"
exit $?
;;
esac
exit 0