This repository was archived by the owner on Apr 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_config.bash
executable file
·703 lines (584 loc) · 20.2 KB
/
setup_config.bash
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
#!/bin/bash
# Copyright (c) by Maxim Sokolsky (2:5020/828.777). This file is part of fidoip. It is free software and it is covered
# by the GNU general public license. See the file LICENSE for details. */
# Usage: bash ./setup_config.bash
# Bash only!!! Do not use sh interpretator
# Script for creation FIDONet IP point configuration
CWD=$(pwd)
HOMEDIR=$(cd ../; pwd) # Fidoip installation directory
TMP=$(mktemp -d) # Location of temp's files
SYSOS=$(uname -s) # Packages architecture
date=$(date +%Y%m%d%m%s)
ARCH=$(uname -m) # Packages architecture
OSTYPE=$(uname -o 2>/dev/null || uname -p)
BUILD=${BUILD:-fido_my1} # Build number packages initials
IDN=$(id -un) # User's name
IDG=$(id -gn) # User's group
SEDT="gsed" # Sed program type
T1="root"
T2="Linux"
T3="FreeBSD"
T4="DragonFly"
if [ "$SYSOS" = "$T2" ]; then
Z1="Linux"
SEDT="sed"
fi
if [ "$SYSOS" = "$T3" ]; then
Z1="BSD"
SEDT="gsed"
fi
if [ "$SYSOS" = "$T4" ]; then
Z1="BSD"
Z2="PKGSRC"
SEDT="gsed"
fi
## make sure unzip extractor available
unziploc=$(which unzip)
if [ -x "$unziploc" ]
then
echo "unzip extractor found: $unziploc"
else
echo "WARNING: unzip not found."
echo "So it will not be possible to extract fidoip on this machine."
echo " You should take steps to get unzip installed,"
echo " as it described in fidoip documentation."
exit
fi
echo ""
echo "-----------------------------------"
## make sure zip archiver available
ziploc=$(which zip)
if [ -x "$ziploc" ]
then
echo "zip packer found: $ziploc"
else
echo "WARNING: zip not found."
echo "So it will not be possible to pack fido packets on this machine."
echo " You should take steps to get zip installed,"
echo " as it described in fidoip documentation."
exit
fi
echo ""
echo "-----------------------------------"
## make sure bzip2 archiver available
bzip2loc=$(which bzip2)
if [ -x "$bzip2loc" ]
then
echo "bzip2 packer found: $bzip2loc"
else
echo "WARNING: bzip2 not found."
echo "So it will not be possible extract fidoip sources on this machine."
echo " You should take steps to get bzip2 installed,"
echo " as it described in fidoip documentation."
exit
fi
echo ""
echo "-----------------------------------"
## make sure sed available
sedloc=$(which "$SEDT")
if [ -x "$sedloc" ]
then
echo "Sed found: "$SEDT": ""$sedloc"""
else
echo "WARNING: "$SEDT" not found."
echo "So it will not be possible extract fidoip sources on this machine."
echo " You should take steps to get "$SEDT" installed,"
echo " as it described in fidoip documentation."
exit
fi
echo ""
echo "-----------------------------------"
shortdate=$(echo "${date}" | "$SEDT" s/^...//)
shortname=fidoip_configs_${shortdate}.tar
cd "$CWD"
if [ "$T1" = "$IDN" ]; then
echo 'Please DO NOT RUN this script as root. Usually it is not needed as FIDO'
echo ' may be installed under unprivileged user to home directory. In case you'
echo 'whould like to install fido as root just wait for 15 seconds.'
sleep 5
echo "Or else now press CTRL-C and later run this script under unprivileged user".
echo " as it described in fidoip documentation."
sleep 15
else
echo
fi
if [ -e "$HOMEDIR"/fido ]; then
echo
else
echo
echo 'Seems fidoip package from fidoip-*/packages/ directory do not installed.'
echo 'Please install them first and then run this script again.'
echo 'Note: fido packages may be installed to:'
echo "$HOMEDIR/usr"
echo "$HOMEDIR/fido"
echo
exit
fi
set -e
set -u
# Declaration of allowed symbol for user input scrubbing
declare -r AllowedChars="-1234567890/., :-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
declare -r AllowedNumbers="1234567890/.:"
declare -r AllowedFtnNumbers="1234567890/:"
declare -r Alloweddns="-1234567890/. :-abcdefghijklmnopqrstuvwxyz"
declare -r Allowedsymbol="-1234567890 _abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
declare -r AllowedPwd="-1234567890_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
echo "--------------------------------------------------------------------"
echo ""
echo "This script setup fidoip's configuration files for you."
echo ""
echo "--------------------------------------------------------------------"
echo ""
echo "Enter your first and last name and press [ENTER]."
echo -n "Sample - Vasiliy Pampasov: "
read fullname
if [ -z "$fullname" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
# Checking user input&scrubbing
ScrubbedCheck="${fullname//[^$Allowedsymbol]/}"
if [ "$fullname" = "$ScrubbedCheck" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n """$Allowedsymbol"""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
# Inserting \ before space
#echo "$fullname" | $SEDT 's_ _\\ _g' > "$TMP"/fidoiptmp
echo "$fullname" | $SEDT 's/ /\\ /g' > "$TMP"/fidoiptmp
fullname1=$(cat "$TMP"/fidoiptmp)
# Inserting space instead of space
echo "$fullname" | $SEDT 's/ /\_/g' > "$TMP"/fidoiptmp
fullname2=$(cat "$TMP"/fidoiptmp)
echo "Enter your station name and press[ENTER]."
echo -n "Sample - MyStation: "
read stationname
if [ -z "$stationname" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
# Checking user input&scrubbing
ScrubbedCheck1="${stationname//[^$Allowedsymbol]/}"
if [ "$stationname" = "$ScrubbedCheck1" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n """$Allowedsymbol"""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
# Inserting _ instead space
echo "$stationname" | $SEDT 's/ /\_/g' > "$TMP"/fidoiptmp
stationname1=$(cat "$TMP"/fidoiptmp)
echo "Enter your location and press[ENTER]."
echo -n "Sample - Moscow, Russia: "
read locationname
if [ -z "$locationname" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
# Checking user input&scrubbing
ScrubbedCheck2="${locationname//[^$AllowedChars]/}"
if [ "$locationname" = "$ScrubbedCheck2" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n """$AllowedChars"""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
# Inserting _ instead space
echo "$locationname" | $SEDT 's/ /\_/g' > "$TMP"/fidoiptmp
locationname1=$(cat "$TMP"/fidoiptmp)
# Inserting space instead -
echo "$locationname1" | $SEDT 's/_/\ /g' > "$TMP"/fidoiptmp
locationname2=$(cat "$TMP"/fidoiptmp)
# Deleting spaces
echo "$locationname" | $SEDT 's/\ //g' > "$TMP"/fidoiptmp
locationname3=$(cat "$TMP"/fidoiptmp)
# Deleting
echo "$locationname3" | $SEDT 's/\,//g' > "$TMP"/fidoiptmp
locationname4=$(cat "$TMP"/fidoiptmp)
echo "Enter your FTN address and press [ENTER]."
echo -n "Sample - 2:5020/828.555: "
read ftnaddress
if [ -z "$ftnaddress" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
CHECKFTN=$(echo "$ftnaddress" | grep "\\/" )
if [ -z "$CHECKFTN" ]
then
echo 'No symbol / in FTN number.'
echo "Try to input next try. Exiting."
rm -rf "$TMP"
exit
fi
CHECKFTN1=$(echo "$ftnaddress" | grep ":" )
if [ -z "$CHECKFTN1" ]
then
echo 'No symbol : in FTN number.'
echo "Try to input next try. Exiting."
rm -rf "$TMP"
exit
fi
CHECKFTN2=$(echo "$ftnaddress" | grep "\." )
if [ -z "$CHECKFTN2" ]
then
echo 'No symbol dot . in FTN number.'
echo "Try to input next try. Exiting."
rm -rf "$TMP"
exit
fi
# Checking user input&scrubbing
ScrubbedCheck3="${ftnaddress//[^$AllowedNumbers]/}"
if [ "$ftnaddress" = "$ScrubbedCheck3" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n ""$AllowedNumbers""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
# Select zone number
zonenumber=$(echo "$ftnaddress" | $SEDT 's|\:.*||')
# Inserting \ before / in a FTN address
echo "$ftnaddress" | $SEDT 's|/|\\/|g' > "$TMP"/fidoiptmp
ftnaddress1=$(cat "$TMP"/fidoiptmp)
# Deleting everting before / and /
echo "$ftnaddress" | $SEDT 's/.*\///' > "$TMP"/fidoiptmp
pointaddress=$(cat "$TMP"/fidoiptmp)
# Deleting everithing after .
echo "$pointaddress" | $SEDT 's/\..*//' > "$TMP"/fidoiptmp
nodeaddress=$(cat "$TMP"/fidoiptmp)
echo -e "Enter uplink full name and press press [ENTER]."
echo -n "Sample - Kirill Temnenkov: "
read uplinkname
if [ -z "$uplinkname" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
# Checking user input&scrubbing
ScrubbedCheck4="${uplinkname//[^$Allowedsymbol]/}"
if [ "$uplinkname" = "$ScrubbedCheck4" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n """$Allowedsymbol"""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
# Inserting \ before space
echo "$uplinkname" | $SEDT 's/ /\\ /g' > "$TMP"/fidoiptmp
uplinkname1=$(cat "$TMP"/fidoiptmp)
# Changing all space to _
echo "$uplinkname" | $SEDT 's/ /\_/g' > "$TMP"/fidoiptmp
uplinkname2=$(cat "$TMP"/fidoiptmp)
echo -e "Enter uplink FTN address and press [ENTER]."
echo -n "Sample - 2:5020/828: "
read uplinkftnaddress
if [ -z "$uplinkftnaddress" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
CHECKFTN3=$(echo "$ftnaddress" | grep "\\/" )
if [ -z "$CHECKFTN3" ]
then
echo 'No symbol / in FTN number.'
echo "Try to input next try. Exiting."
rm -rf "$TMP"
exit
fi
CHECKFTN4=$(echo "$ftnaddress" | grep ":" )
if [ -z "$CHECKFTN4" ]
then
echo 'No symbol : in FTN number.'
echo "Try to input next try. Exiting."
rm -rf "$TMP"
exit
fi
# Checking user input&scrubbing
ScrubbedCheck5="${uplinkftnaddress//[^$AllowedFtnNumbers]/}"
if [ "$uplinkftnaddress" = "$ScrubbedCheck5" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n ""$AllowedFtnNumbers""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
# Inserting \ before space
echo "$uplinkftnaddress" | $SEDT 's|/|\\/|g' > "$TMP"/fidoiptmp
uplinkftnaddress1=$(cat "$TMP"/fidoiptmp)
echo "Enter uplink server name or IP-address and press [ENTER]."
echo -n "Sample - f828.n5020.z2.binkp.net: "
read uplinkdnsaddress
if [ -z "$uplinkdnsaddress" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
# Checking user input&scrubbing
ScrubbedCheck6="${uplinkdnsaddress//[^$Alloweddns]/}"
if [ "$uplinkdnsaddress" = "$ScrubbedCheck6" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n """$Alloweddns"""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
echo "Enter uplink password and press [ENTER]."
echo -n "Sample - 12345678: "
read uplinkpassword
if [ -z "$uplinkpassword" ]
then
echo 'You input nothing.'
echo 'Please run this script again and input something.'
exit
fi
# Checking user input&scrubbing
ScrubbedCheck7="${uplinkpassword//[^$AllowedPwd]/}"
if [ "$uplinkpassword" = "$ScrubbedCheck7" ]; then
echo ''
else
echo ' '
echo " Error. You entered wrong symbols. Allowed symbols are: "
echo -n ' '
echo -n ""$AllowedPwd""
echo -n ' '
echo 'Please run this script again and be more carefull during inputing.'
echo -n ' '
exit
fi
echo ""
echo "--------------------------------------------------------------------"
echo ""
echo -n "Your full name is : "
echo "$fullname"
echo -n "Your system station name : "
echo "$stationname"
echo -n "Your FTN address is: "
echo "$ftnaddress"
echo -n "Your location is : "
echo "$locationname"
echo -n "Uplink name is : "
echo "$uplinkname"
echo -n "Uplink FTN address is : "
echo "$uplinkftnaddress"
echo -n "Uplink server name or IP-address is: "
echo "$uplinkdnsaddress"
echo -n "Your password is: "
echo "$uplinkpassword"
echo ""
echo "--------------------------------------------------------------------"
echo ""
# asks if you want to change the original files and acts accordingly.
echo "OK? "
echo "[y/n]"
read reply
echo ""
if [ "$reply" = "y" ];
then
if [ -e "$HOMEDIR"/usr/etc/binkd.cfg ]; then
echo '------------------------------------------------------------------------'
echo 'Previos configuration files saved to file:'
echo ''
echo "$CWD"/"$shortname"
echo ''
echo '------------------------------------------------------------------------'
echo ''
tar -cf "$CWD"/"$shortname" "$HOMEDIR"/usr/etc/binkd.cfg "$HOMEDIR"/usr/etc/golded+/g* "$HOMEDIR"/usr/etc/fido/config "$HOMEDIR"/usr/bin/recv "$HOMEDIR"/usr/bin/send > /dev/null 2>&1
sleep 3
fi
cp -p "$CWD"/binkd/binkd.cfg "$HOMEDIR"/usr/etc/
cp -p "$CWD"/husky/config "$HOMEDIR"/usr/etc/fido/
cp -p "$CWD"/golded/decode.txt "$HOMEDIR"/usr/etc/golded+/golded.cfg
cp -p "$CWD"/golded/fidohelp.hlp "$HOMEDIR"/fido/
cp -p "$CWD"/binkd/recv "$HOMEDIR"/usr/bin/
cp -p "$CWD"/binkd/send "$HOMEDIR"/usr/bin/
cp -p "$CWD"/binkd/fidomail "$HOMEDIR"/usr/bin/
cp -p "$CWD"/node/fidohelp "$HOMEDIR"/usr/bin/
cp -p "$CWD"/binkd/*.sh "$HOMEDIR"/usr/bin/
cp -p "$CWD"/binkd/*.pl "$HOMEDIR"/usr/bin/
cp -p "$CWD"/husky/*.pl "$HOMEDIR"/usr/bin/
cp -p "$CWD"/husky/*.sh "$HOMEDIR"/usr/bin/
rm -f "$HOMEDIR"/usr/bin/build.sh
$SEDT -i "s/Vasiliy\ Pampasov"/"$fullname1""/g" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s/Moscow"/"$locationname4""/" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s/Vasiliy\ Pampasov"/"$fullname1""/" "$HOMEDIR"/usr/etc/golded+/golded.cfg
$SEDT -i "s/Falcon"/"$stationname1""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/Moscow"/"$locationname1""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/$locationname1"/"$locationname2""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/2:5020\/828.555"/"$ftnaddress1""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/2:5020\/828.555"/"$ftnaddress1""/g" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s/2:5020\/828.555"/"$ftnaddress1""/" "$HOMEDIR"/usr/etc/golded+/golded.cfg
$SEDT -i "2s|ZONE-NUMBER|""$zonenumber""|" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/etc/golded+/golded.cfg
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/recv
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/send
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/fidomail
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/fidohelp
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/*.sh
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/*.pl
$SEDT -i "s/828\.local"/"$nodeaddress"\.local"/g" "$HOMEDIR"/usr/etc/golded+/golded.cfg
$SEDT -i "s/Kirill\ Temnenkov"/"$uplinkname1""/" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s/Kirill_Temnenkov"/"$fullname2""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/2:5020\/828"/"$uplinkftnaddress1""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/2:5020\/828"/"$uplinkftnaddress1""/" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s/2:5020\/828"/"$uplinkftnaddress1""/" "$HOMEDIR"/usr/etc/golded+/golded.cfg
$SEDT -i "s/2:5020\/828"/"$uplinkftnaddress1""/" "$HOMEDIR"/usr/bin/recv
$SEDT -i "s/2:5020\/828"/"$uplinkftnaddress1""/" "$HOMEDIR"/usr/bin/send
$SEDT -i "s/f828.n5020.z2.binkp.net"/"$uplinkdnsaddress""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/12345678"/"$uplinkpassword""/" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s/12345678"/"$uplinkpassword""/g" "$HOMEDIR"/usr/etc/golded+/golded.cfg
$SEDT -i "s/12345678"/"$uplinkpassword""/" "$HOMEDIR"/usr/etc/fido/config
$SEDT -i "s/828\.local"/"$nodeaddress"\.local"/" "$HOMEDIR"/usr/etc/fido/config
cp "$CWD"/node/toss "$HOMEDIR"/usr/bin/toss
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/toss
cat "$CWD"/golded/.screenrc | sed "s|INSTALLDIR|$HOMEDIR|g" > "$HOMEDIR"/usr/etc/golded+/.screenrc
cat "$CWD"/golded/ge | sed "s|INSTALLDIR|$HOMEDIR|g" > "$HOMEDIR"/usr/bin/ge
cat "$CWD"/golded/g | sed "s|INSTALLDIR|$HOMEDIR|g" > "$HOMEDIR"/usr/bin/g
cat "$CWD"/golded/gl | sed "s|INSTALLDIR|$HOMEDIR|g" > "$HOMEDIR"/usr/bin/gl
cat "$CWD"/golded/nodelist.sh | sed "s|INSTALLDIR|$HOMEDIR|g" > "$HOMEDIR"/usr/bin/nodelist.sh
cp "$HOMEDIR"/usr/bin/send "$HOMEDIR"/usr/bin/rs
cp "$CWD"/husky/checkhpt.sh "$HOMEDIR"/usr/bin/
$SEDT -i "s|INSTALLDIR|$HOMEDIR|g" "$HOMEDIR"/usr/bin/checkhpt.sh
if [ "$OSTYPE" = "Android" ]; then
$SEDT -i "s|/var/run/|/data/data/com.termux/files/usr/var/run/|" "$HOMEDIR"/usr/etc/binkd.cfg
$SEDT -i "s|/var/run/|/data/data/com.termux/files/usr/var/run/|" "$HOMEDIR"/usr/etc/fidoip/binkd.cfg.template
else
sed -i "s|/var/run/|$HOMEDIR/fido/|" "$HOMEDIR"/usr/etc/binkd.cfg
sed -i "s|/var/run/|$HOMEDIR/fido/|" "$HOMEDIR"/usr/etc/fidoip/binkd.cfg.template
fi
rm -f "$HOMEDIR"/usr/bin/binkdsrv
echo
echo "=================================================="
echo "Setting permissions... "
echo "=================================================="
echo
set +e
if [ -e "$HOMEDIR"/fido ]; then
chmod -R 755 "$HOMEDIR"/fido
fi
if [ "$HOMEDIR" = "/" ]; then
echo
else
if [ -e "$HOMEDIR"/usr ]; then
chmod -R 755 "$HOMEDIR"/usr
fi
fi
chmod 644 "$HOMEDIR"/fido/*.log
chmod 644 "$HOMEDIR"/fido/*.hlp
chmod 644 "$HOMEDIR"/fido/nodelist/nodelist.[0-9][0-9][0-9]
chmod 644 "$HOMEDIR"/fido/nodelist/*.g*
chmod 644 "$HOMEDIR"/usr/etc/*.cfg
chmod 644 "$HOMEDIR"/usr/etc/*.conf-dist
chmod 644 "$HOMEDIR"/usr/etc/fido/config
chmod 644 "$HOMEDIR"/usr/etc/fido/*.cfg
chmod 644 "$HOMEDIR"/usr/etc/fidoip/*.eng
chmod 644 "$HOMEDIR"/usr/etc/fidoip/*.tpl
chmod 644 "$HOMEDIR"/usr/etc/fidoip/*.template
chmod 644 "$HOMEDIR"/usr/etc/golded+/.screenrc
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.txt
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.cc
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.bat
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.cfg
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.cfm
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.tpl
chmod 644 "$HOMEDIR"/usr/etc/golded+/*.sh
chmod 644 "$HOMEDIR"/usr/etc/golded+/Makefile
chmod 644 "$HOMEDIR"/usr/etc/golded+/golded
chmod 644 "$HOMEDIR"/usr/etc/golded+/map/*
chmod 644 "$HOMEDIR"/usr/etc/golded+/cfgs/File_id.diz
chmod 644 "$HOMEDIR"/usr/etc/golded+/cfgs/*/*
chmod 644 "$HOMEDIR"/usr/include/*/*.h
chmod 644 "$HOMEDIR"/usr/lib/*.a
chmod 644 "$HOMEDIR"/usr/share/doc/fidoconf/*.html
chmod 644 "$HOMEDIR"/usr/share/info/*.info
chmod 644 "$HOMEDIR"/usr/share/man/man1/*.1
set -e
#echo "Generating welcome message"
echo
$SEDT "s|Vasiliy\ Pampasov|$fullname|" "$CWD"/golded/welcome.tpl.template > "$TMP"/welcome.tpl.template
$SEDT -i "s|2:5020\/XXX|$uplinkftnaddress1|" "$TMP"/welcome.tpl.template
$SEDT -i "s|Kirill\ Temnenkov|$uplinkname1|" "$TMP"/welcome.tpl.template
$SEDT -i "s|2:5020\/YYY.ZZZ|$ftnaddress1|" "$TMP"/welcome.tpl.template
$SEDT -i "s|INSTALLDIR|$HOMEDIR|" "$TMP"/welcome.tpl.template
export FIDOCONFIG=$HOMEDIR/usr/etc/fido/config
#������ Mail without INTL-Kludge. Assuming 2:5020/828.0 -> 2:0/0.0
#$HOMEDIR/usr/bin/txt2pkt -c $HOMEDIR/usr/etc/fido/config -nf "Developer of fidoip" -xf "$ftnaddress" -xt "$ftnaddress" -nt "$fullname" -t "Powered by fidoip package" -o "http://sourceforge.net/apps/mediawiki/fidoip" -s "Welcome, new point!" -e "welcome.fido" -d $HOMEDIR/fido/localinb /tmp/welcome.tpl
"$HOMEDIR"/usr/bin/toss
echo
echo "========================================================"
echo "Setting up nodelist in GoldED+: "
echo "========================================================"
"$HOMEDIR"/usr/bin/nodelist.sh
echo
echo "========================================================"
echo "OK. Original configuration files modified successfully."
echo "Please review configuration files."
sleep 1
"$HOMEDIR"/usr/bin/fidohelp
echo " Please add to variable PATH=""$PATH"" this raw:"
echo """$HOMEDIR""/usr/bin or use this command:"
echo "export PATH=\$PATH:""$HOMEDIR""/usr/bin"
echo "Then put the line PATH=\$PATH:""$HOMEDIR""/usr/bin in ~/.profile,"
echo "or in ~/.bash_profile and start GoldEd with ge, g or gl command."
echo "========================================================"
if [ -e "$TMP" ]; then
rm -rf "$TMP"
fi
elif [ "$reply" = "n" ];
then
echo "Please modify configuration files manually or run this script again."
if [ -e "$TMP" ]; then
rm -rf "$TMP"
fi
fi