-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNETCNFIG.LST
326 lines (326 loc) · 8.03 KB
/
NETCNFIG.LST
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
'
' MiNT-Net konfigurieren
'
> PROCEDURE net_config
LOCAL eing1&,eing2&
' ALERT 1," Soll MiNT-Net noch | konfiguriert werden? ",1," Ja | Nein ",eing1&
ALERT 1,alert14_1$,1,alert14_2$,eing1&
IF eing1&=1
mintnet_flag!=TRUE
' ALERT 1," Haben Sie eine Netz- | werkkarte oder ein Modem? ",1," NK | Modem ",eing2&
IF compi_var&<>10
ALERT 1,alert15_1$,2,alert15_2$,eing2&
IF eing2&=1
nk_flag!=TRUE
ELSE IF eing2&=2
nk_flag!=FALSE
ENDIF
ELSE
nk_flag!=TRUE
ENDIF
ELSE
mintnet_flag!=FALSE
ENDIF
RETURN
> PROCEDURE netzwerk_config
IF compi_var&=10 ! Wenn ARAnyM, IP Adressen vorbelegen und disablen
kuerzel_var$="eth0"
ipadr_var$=ipadr$
netmask_var$=netmask$
gateway_var$=gateway$
@rsc_setup_tree(nic&)
@rsc_ob_disable(nic&,kuerzel&,TRUE)
@rsc_ob_disable(nic&,netmask&,TRUE)
@rsc_ob_disable(nic&,gateway&,TRUE)
@rsc_ob_disable(nic&,ipadr&,TRUE)
ENDIF
nic_hdle&=@win_open_dialog(2,nic&,-1)
RETURN
> PROCEDURE modem_config
ppp_hdle&=@win_open_dialog(2,ppp&,-1)
RETURN
> PROCEDURE nic_driver_copy
LOCAL datei$
IF compi_var&<>10
datei$=@fileselector$("NIC Treiber?",boot$+":\*.*","",FALSE,"")
IF @exist(datei$,63)=0
@filename(datei$,match$)
@ug_copy1(datei$,boot$+":\MINT\"+match$)
ENDIF
ENDIF
RETURN
'
' Netzwerkkarte konfigurieren
'
> PROCEDURE nic_auswert
LOCAL fiha&,ipadr$,netmask$
'
ipadr$=@ip_fummel_back$(ipadr_var$)
netmask$=@ip_fummel_back$(netmask_var$)
dns$=@ip_fummel_back$(dns_var$)
'
@config.if_create(ipadr$,netmask$)
@domainname_create
@hostname_create
@defaultroute_create
@resolv.conf_create
'
RETURN
> PROCEDURE config.if_create(a1$,a2$)
LOCAL error%,config.if_path$
'
config.if_path$="u:\etc\sysconfig\config.if"
'
setup_interface$=kuerzel_var$+" "+a1$+" "+@ip_cut$(a1$,"0")+" "+a2$+" "+@ip_cut$(a1$,"255")
'
IF @exist(config.if_path$,63)=0
~@f_kill(config.if_path$)
ENDIF
'
fiha&=@f_create(config.if_path$)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# [ this file must follow the unix convention - save with no CR !!! ]",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# static interface configuration goes here",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# syntax:",TRUE)
error%=@f_println(fiha&,"# <interface> <ipaddr> <network> <netmask> <broadaddr>",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# example: ne0 192.168.0.10 192.168.0.0 255.255.255.0 192.168.0.255",TRUE)
error%=@f_println(fiha&,"# this setup interface ne0 with IP 192.168.0.10",TRUE)
error%=@f_println(fiha&,"#",TRUE)
'
error%=@f_println(fiha&,setup_interface$,TRUE)
'
~@f_close(fiha&)
RETURN
> PROCEDURE domainname_create
LOCAL fiha&,domainname_path$
'
domainname_path$="u:\etc\sysconfig\domainname"
'
IF @exist(domainname_path$,63)=0
~@f_kill(domainname_path$)
ENDIF
'
fiha&=@f_create(domainname_path$)
error%=@f_println(fiha&,domaine_var$,TRUE)
~@f_close(fiha&)
'
RETURN
> PROCEDURE hostname_create
LOCAL fiha&,hostname_path$
'
hostname_path$="u:\etc\sysconfig\hostname"
'
IF @exist(hostname_path$,63)=0
~@f_kill(hostname_path$)
ENDIF
'
fiha&=@f_create(hostname_path$)
error%=@f_println(fiha&,hn_var$,TRUE)
~@f_close(fiha&)
'
RETURN
> PROCEDURE defaultroute_create
LOCAL fiha&,defaultroute_path$
'
defaultroute_path$="u:\etc\sysconfig\defaultroute"
'
IF @exist(defaultroute_path$,63)=0
~@f_kill(defaultroute_path$)
ENDIF
'
fiha&=@f_create(defaultroute_path$)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# [ this file must follow the unix convention - save with no CR !!! ]",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# static default gateway configuration goes here",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# syntax:",TRUE)
error%=@f_println(fiha&,"# <interface> <gateway>",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,"# example: ne0 192.168.0.200",TRUE)
error%=@f_println(fiha&,"# this set the defaultroute over ne0 to IP 192.168.0.200",TRUE)
error%=@f_println(fiha&,"#",TRUE)
error%=@f_println(fiha&,kuerzel_var$+" "+@ip_fummel_back$(gateway_var$),TRUE)
~@f_close(fiha&)
RETURN
> PROCEDURE resolv.conf_create
LOCAL fiha&,resolv_path$
'
resolv_path$="u:\etc\resolv.conf"
'
IF @exist(resolv_path$,63)=0
~@f_kill(resolv_path$)
ENDIF
'
fiha&=@f_create(resolv_path$)
error%=@f_println(fiha&,"domain "+domaine_var$,TRUE)
error%=@f_println(fiha&,"nameserver "+@ip_fummel_back$(dns_var$),TRUE)
~@f_close(fiha&)
RETURN
'
' ppp konfigurieren
'
> PROCEDURE ppp_auswert
'
SELECT device_var&
CASE 1
device$="/dev/ttyS0"
CASE 2
device$="/dev/ttyS1"
CASE 3
device$="/dev/ttyS2"
CASE 4
device$="/dev/ttyS3"
CASE 5
device$="/dev/ttyS4"
ENDSELECT
'
SELECT speed_var&
CASE 1
speed$="9600"
CASE 2
speed$="19200"
CASE 3
speed$="38400"
CASE 4
speed$="57600"
CASE 5
speed$="76800"
CASE 6
speed$="115200"
CASE 7
speed$="230400"
ENDSELECT
'
@pap_secrets
@pppchat
@peers
@resolv
'
RETURN
> PROCEDURE pap_secrets
LOCAL fiha&,papsecrets_path$
'
papsecrets_path$="u:\etc\ppp\pap-secrets"
'
IF @exist(papsecrets_path$,63)=0
~@f_kill(papsecrets_path$)
ENDIF
'
fiha&=@f_create(papsecrets_path$)
error%=@f_println(fiha&,user_var$+CHR$(9)+"*"+CHR$(9)+passwd$,TRUE)
~@f_close(fiha&)
'
~@fchmod(papsecrets_path$,&O600)
RETURN
> PROCEDURE pppchat
LOCAL fiha&,pppchat_path$
'
pppchat_path$="u:\etc\ppp\pppchat"
quote$=CHR$(34)
'
IF @exist(pppchat_path$,63)=0
~@f_kill(pppchat_path$)
ENDIF
'
fiha&=@f_create(pppchat_path$)
error%=@f_println(fiha&,"TIMEOUT 60",TRUE)
error%=@f_println(fiha&,"ABORT "+quote$+"NO DIALTONE"+quote$,TRUE)
error%=@f_println(fiha&,"ABORT "+quote$+"NO CARRIER"+quote$,TRUE)
error%=@f_println(fiha&,"ABORT BUSY",TRUE)
error%=@f_println(fiha&,"ABORT ERROR",TRUE)
error%=@f_println(fiha&,quote$+quote$+" "+atz_var$,TRUE)
error%=@f_println(fiha&,"OK atdt"+ispnumber_var$,TRUE)
error%=@f_println(fiha&,"CONNECT",TRUE)
~@f_close(fiha&)
RETURN
> PROCEDURE peers
LOCAL fiha&,peers_path$
'
peers_path$="u:\etc\ppp\peers\"+ispname_var$
'
IF @exist(peers_path$,63)=0
~@f_kill(peers_path$)
ENDIF
'
fiha&=@f_create(peers_path$)
error%=@f_println(fiha&,device$,TRUE)
error%=@f_println(fiha&,speed$,TRUE)
error%=@f_println(fiha&,"crtscts",TRUE)
error%=@f_println(fiha&,"modem",TRUE)
error%=@f_println(fiha&,"defaultroute",TRUE)
error%=@f_println(fiha&,"noauth",TRUE)
error%=@f_println(fiha&,@ip_fummel_back$(localip_var$)+":"+@ip_fummel_back$(remoteip_var$),TRUE)
error%=@f_println(fiha&,"user "+user_var$,TRUE)
error%=@f_println(fiha&,"connect "+quote$+"/usr/sbin/chat -f /etc/ppp/pppchat"+quote$,TRUE)
~@f_close(fiha&)
RETURN
> PROCEDURE resolv
LOCAL fiha&,resolv_path$
'
resolv_path$="u:\etc\resolv.conf"
'
IF @exist(resolv_path$,63)=0
~@f_kill(resolv_path$)
ENDIF
'
fiha&=@f_create(resolv_path$)
error%=@f_println(fiha&,"domain "+pppdomain_var$,TRUE)
error%=@f_println(fiha&,"nameserver "+@ip_fummel_back$(nameserver_var$),TRUE)
~@f_close(fiha&)
RETURN
'
> FUNCTION ip_cut$(ip$,last$)
$F%
LOCAL last_p_pos&
'
last_p_pos&=LEN(ip$)-RINSTR(ip$,".")
'
cut$=LEFT$(ip$,LEN(ip$)-last_p_pos&)
cut$=cut$+last$
'
RETURN cut$
ENDFUNC
> FUNCTION ip_fummel$(fummel$)
$F%
LOCAL a&,i&,pos1&,pos2&,pos3&,eins$,zwei$,drei$,vier$
IF fummel$<>""
DIM punkt_pos&(3)
FOR i&=1 TO LEN(fummel$)
IF MID$(fummel$,i&,1)="."
INC a&
punkt_pos&(a&)=i&
ENDIF
NEXT i&
pos1&=punkt_pos&(1)
pos2&=punkt_pos&(2)
pos3&=punkt_pos&(3)
ERASE punkt_pos&()
eins$=SPACE$(3)
zwei$=SPACE$(3)
drei$=SPACE$(3)
vier$=SPACE$(3)
RSET eins$=LEFT$(fummel$,PRED(pos1&))
RSET zwei$=MID$(fummel$,SUCC(pos1&),PRED(pos2&-pos1&))
RSET drei$=MID$(fummel$,SUCC(pos2&),PRED(pos3&-pos2&))
RSET vier$=RIGHT$(fummel$,LEN(fummel$)-pos3&)
ret$=eins$+zwei$+drei$+vier$
ENDIF
RETURN ret$
ENDFUNC
> FUNCTION ip_fummel_back$(t$)
$F%
LOCAL eins$,zwei$,drei$,vier$
eins$=TRIM$(LEFT$(t$,3))
zwei$=TRIM$(MID$(t$,4,3))
drei$=TRIM$(MID$(t$,7,3))
vier$=TRIM$(MID$(t$,10,3))
bastel_ip$=eins$+"."+zwei$+"."+drei$+"."+vier$
IF bastel_ip$="..."
bastel_ip$=""
ENDIF
RETURN bastel_ip$
ENDFUNC