-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathINSTALL.sh
executable file
·1418 lines (1335 loc) · 55.6 KB
/
INSTALL.sh
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
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
#?
#? File generated data by %M% %I% from usr/INSTALL-template.sh
#?
#? NAME
#? $0 - install script for O-Saft
#?
#? SYNOPSIS
#? $0 [options] [/path/to/installation/directory]
#?
#? DESCRIPTION
#? Some people want to have an installation script, in particular named
#? INSTALL.sh, even O-Saft should work without a specific installation.
#? Here we go.
#?
#? This script does nothing except printing some messages unless called
#? with an argument. The arguments are:
#?
#? /path/to/installation/directory
#? - copy all necessary files into specified directory
#? --install - copy all necessary files into default directory
#? default if no other option given
#? --check - check current installation
#? --clean - move files not necessary to run O-Saft into subdir
#? ./.files_to_be_removed
# This is the behaviour of the old INSTALL-devel.sh script.
#? --openssl - calls usr/install_openssl.sh which builds and
#? installs openssl and Net::SSLeay ; this doesn't
#? support other options and arguments of
#? usr/install_openssl.sh
#? --cgi - prepare directory to be used in CGI mode
#? --expected - show sample output expected for --check
# All lines starting with #= are the sample output.
#? --checkdev - check system for development (make) requirements
#? --check=tools - just check main tools
#? --check=self - just check main tool versions
#? --check=perl - just check Perl required modules
#? --check=modules - just check all required modules
#? --check=rc - just check resource files
#? --check=inst - just check installation in specified dir
#? --check=openssl - just check openssl ; ;;
#? --check=usr - just check tools in usr/
#? --check=podtools - just check for tools to view POD files
#? --check=SID - list SIDs and md5sum of installed files
#? --check=SID --changes - list SIDs and md5sum of changed files
#?
#? With --install only warnings or errors are reported. Use option --v
#? to get a detailed report.
#=
#=# check for O-Saft programs found via environment variable PATH
#=#--------------------------------------------------------------
#=# wish /usr/bin
#=# o-saft.pl not found in PATH, consider adding /opt/o-saft to PATH
#=# o-saft.tcl not found in PATH, consider adding /opt/o-saft to PATH
#=# o-saft not found in PATH, consider adding /opt/o-saft to PATH
#=# ./usr/o-saft-standalone.pl .
#=# Note: all found executables in PATH are listed
#=#--------------------------------------------------------------
#=
#=# check installation in /opt/o-saft
#=#--------------------------------------------------------------
#=# (warnings are ok if »git clone« will be used for development)
#= contrib/.o-saft.tcl found; file from previous installation
#=# Dockerfile found; file for development
#=# Makefile found; file for development
#=# t/ found; file for development
#=# usr/critic.sh found; file for development
#=# CHANGES found; file for development
#=# README found; file for development
#=# consider running »INSTALL.sh --clean«
#=#--------------------------------------------------------------
#=
#=# check for used O-Saft programs (according $PATH)
#=#----------------------+---------------------------------------
#=# o-saft.pl 24.01.24 /opt/o-saft/o-saft.pl
#=# o-saft.tcl 3.18 /opt/o-saft/o-saft.tcl
#=# o-saft 3.1 /opt/o-saft/o-saft
#=# o-saft-docker 1.49 /opt/o-saft/o-saft-docker
#=# usr/o-saft-standalone.pl 24.01.24 usr/o-saft-standalone.pl
#=#----------------------+---------------------------------------
#=
#=# check for installed O-Saft resource files
#=#----------------------+---------------------------------------
#=# ./.o-saft.pl will be used when started in . only
#=# /opt/o-saft/.o-saft.pl will be used when started in /opt/o-saft only
#=# /home/USER/.o-saft.tcl missing, consider generating: »o-saft.tcl --rc > /home/USER/.o-saft.tcl«
#=#----------------------+---------------------------------------
#=
#=# check for important Perl modules used by installed O-Saft
#=#----------------------+---------------------------------------
#=# testing /opt/o-saft/o-saft.pl ...
#=# Net::DNS 1.29 /usr/local/share/perl/5.24.1/Net/DNS.pm
#=# Net::SSLeay 1.88 /usr/local/lib/x86_64-linux-gnu/perl/5.24.1/Net/SSLeay.pm
#=# IO::Socket::INET 1.41 /usr/local/lib/x86_64-linux-gnu/perl-base/IO/Socket/INET.pm
#=# IO::Socket::SSL 2.069 /usr/share/perl5/IO/Socket/SSL.pm
#=# Time::Local 1.28 /usr/share/perl/5.24/Time/Local.pm
#=# testing /opt/o-saft/o-saft.pl in /opt/o-saft ...
#=# Net::DNS 1.29 /usr/local/share/perl/5.24.1/Net/DNS.pm
#=# Net::SSLeay 1.88 /usr/local/lib/x86_64-linux-gnu/perl/5.24.1/Net/SSLeay.pm
#=# IO::Socket::SSL 2.069 /usr/share/perl5/IO/Socket/SSL.pm
#=# Time::Local 1.28 /usr/share/perl/5.24/Time/Local.pm
#=#----------------------+---------------------------------------
#=
#=# check for installed Perl modules (started in '$inst_directory')
#=#----------------------+---------------------------------------
#=# Net::DNS 1.36 /usr/local/share/perl/5.24.1/Net/DNS.pm
#=# Net::SSLeay 1.94 /usr/local/lib/x86_64-linux-gnu/perl/5.24.1/Net/SSLeay.pm
#=# IO::Socket::INET 1.49 /usr/local/lib/x86_64-linux-gnu/perl-base/IO/Socket/INET.pm
#=# ancient module found, try installing newer version, at least 1.49
#=# IO::Socket::SSL 2.081 /usr/share/perl5/IO/Socket/SSL.pm
#=# Time::Local 1.30 /usr/share/perl/5.24/Time/Local.pm
#=# OCfg 24.01.24 lib/OCfg.pm
#=# Ciphers 24.01.24 lib/Ciphers.pm
#=# error_handler 24.01.24 lib/error_handler.pm
#=# SSLinfo 24.01.24 lib/SSLinfo.pm
#=# SSLhello 24.01.24 lib/SSLhello.pm
#=# OData 24.01.24 lib/OData.pm
#=# ODoc 24.01.24 lib/ODoc.pm
#=# OMan 24.01.24 lib/OMan.pm
#=# OText 24.01.24 lib/OText.pm
#=# OTrace 24.01.24 lib/OTrace.pm
#=# OUsr 24.01.24 lib/OUsr.pm
#=#----------------------+---------------------------------------
#=
#=# summary of warnings from installed O-Saft (should be empty)
#=#----------------------+---------------------------------------
#=# testing /opt/o-saft/o-saft.pl in /opt/o-saft ...
#=# **WARNING: 841: used openssl version '805306448' differs from compiled Net::SSLeay '805306544'; ignored
#=#----------------------+---------------------------------------
#=
#=# check for openssl executable in PATH
#=#----------------------+---------------------------------------
#=# openssl /usr/bin/openssl (OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024))
#=#----------------------+---------------------------------------
#=
#=# check for openssl executable used by O-Saft
#=#----------------------+---------------------------------------
#=# ./o-saft.pl /usr/local/openssl/bin/openssl (1.0.2k-dev)
#=# /opt/o-saft/o-saft.pl /usr/local/openssl/bin/openssl (1.0.2k-dev)
#=#----------------------+---------------------------------------
#=
#=# check for optional tools to view documentation
#=#----------------------+---------------------------------------
#=# aha /usr/bin/aha
#=# perldoc /usr/bin/perldoc
#=# pod2html /usr/bin/pod2html
#=# pod2man /usr/bin/pod2man
#=# pod2text /usr/bin/pod2text
#=# pod2usage /usr/bin/pod2usage
#=# podman missing
#=# podviewer /usr/bin/podviewer
#=# stty /bin/stty
#=# tkpod /usr/bin/tkpod
#=# tput /usr/bin/tput
#=#
#=# Note: podman is a tool to view pod files, it's not the container engine
#=#----------------------+---------------------------------------
#=
#=# check for contributed files (in /opt/o-saft/usr )
#=#----------------------+---------------------------------------
#=# Cert-beautify.awk /opt/o-saft/usr/Cert-beautify.awk
#=# Cert-beautify.pl /opt/o-saft/usr/Cert-beautify.pl
#=# HTML-simple.awk /opt/o-saft/usr/HTML-simple.awk
#=# HTML-table.awk /opt/o-saft/usr/HTML-table.awk
#=# HTML4-table.awk /opt/o-saft/usr/HTML4-table.awk
#=# HTML5-table.awk /opt/o-saft/usr/HTML5-table.awk
#=# JSON-array.awk /opt/o-saft/usr/JSON-array.awk
#=# JSON-struct.awk /opt/o-saft/usr/JSON-struct.awk
#=# XML-attribute.awk /opt/o-saft/usr/XML-attribute.awk
#=# XML-value.awk /opt/o-saft/usr/XML-value.awk
#=# alertscript.cfg /opt/o-saft/usr/alertscript.cfg
#=# alertscript.pl /opt/o-saft/usr/alertscript.pl
#=# bash_completion_o-saft /opt/o-saft/usr/bash_completion_o-saft
#=# bunt.pl /opt/o-saft/usr/bunt.pl
#=# bunt.sh /opt/o-saft/usr/bunt.sh
#=# checkAllCiphers.pl /opt/o-saft/usr/checkAllCiphers.pl
#=# cipher_check.sh /opt/o-saft/usr/cipher_check.sh
#=# dash_completion_o-saft /opt/o-saft/usr/dash_completion_o-saft
#=# filter_examples /opt/o-saft/usr/filter_examples
#=# fish_completion_o-saft /opt/o-saft/usr/fish_completion_o-saft
#=# lazy_checks.awk /opt/o-saft/usr/lazy_checks.awk
#=# symbol.pl /opt/o-saft/usr/symbol.pl
#=# tcsh_completion_o-saft /opt/o-saft/usr/tcsh_completion_o-saft
#=# usage_examples /opt/o-saft/usr/usage_examples
#=# zap_config.sh /opt/o-saft/usr/zap_config.sh
#=# zap_config.xml /opt/o-saft/usr/zap_config.xml
#=# o-saft-standalone.pl /opt/o-saft/usr/o-saft-standalone.pl
#=#----------------------+---------------------------------------
#=
#=# checks passed
#=# default installation directory »/opt/o-saft« used
#=
#=#-------------------+--------------------- not part of output {
#=# Note: above examples are from 2018, more modern (2024) versions are:
#=# openssl 3.0.11
#=# Perl 5.38
#=# Tcl/Tk (wish) 8.6.13/8.6.13
#=# Net::DNS 1.36
#=# Net::SSLeay 1.94
#=# Socket 2.033
#=# IO::Socket 1.49
#=# IO::Socket::SSL 2.081
#=# Time::Local 1.30
#=#-------------------+--------------------- not part of output }
#?
#? OPTIONS
#? --h got it
# --help got it
#? --n do not execute, just show (ignored for --check)
#? --i ignore error while installing; default: exit with status 4
#? --v print verbose information about performed actions
#? -x debug using shell's "set -x"
#? --check --checkdev --clean --cgi --expected --install --openssl
#? - these are commands, see DESCRIPTION above
#? --force - install RC-FILEs .o-saft.pl and .o-saft.tcl in
#? $HOME, overwrites existing ones
#? --instdev - copy also all files necessary for development into
#? specified directory; implies --install
#? --changes - report only changes with --check=SID
#? --no-colour - do not use coloured texts; default
#? --colour - use coloured texts (red, yellow, blue|green)
#? --colour-blind - same as --colour
#? --colour-not-blind - use green instead of blue coloured texts
#? --other - check for other SSL-related tool with --checkdev
#? --useenv - change #! (shebang) lines to #!/usr/bin/env
#? Involves --install .
#? Applies only to files with following extensions:
#? .awk .cgi .pl .sh .tcl .txt
#? also applies to all Makefile* .
#? The shebang line will only be changed when there
#? are no arguments given.
#? Examples of changed lines:
#? #!/bin/sh
#? #! /bin/sh
#? #!/bin/cat
#? #!/usr/bin/make
#? #!/usr/bin/perl
#? Examples of lines not to be changed:
#? #!/usr/bin/gawk -f
#? #!/usr/bin/make -rRf
#? #! /usr/bin/perl -w
#? #!/usr/bin/perl -w
#? #!/usr/bin/perl -w -I .
#? --gnuenv - change #! (shebang) lines to #!/usr/bin/env -S
#? Involves --install --useenv .
#? Applies the change to shebang lines with arguments.
#?
#? Please see doc/concepts.txt for details about /usr/bin/env .
#? It's up to the user then, which solution fits better.
#?
#? ENVIRONMENT
#? Environment variable OSAFT_DIR is used for the default installation
#? directory.
#? env OSAFT_DIR=/some/dir $0 --install
#? env OSAFT_DIR=. $0 --check
#?
#? EXAMPLES
#? $0
#? $0 --clean
#? $0 --check
#? $0 --install
#? $0 /opt/bin/
#? $0 /opt/bin/ --force
#? $0 /opt/bin/ --useenv
#? $0 /opt/bin/ --gnuenv
#? $0 --install /opt/bin/
#? $0 --install /tmp/dir/ --instdev
#? $0 --check /opt/bin/
#? $0 --check /opt/bin/ --colour
#? $0 --checkdev
#? $0 --cgi /opt/bin/
#? $0 --cgi .
#?
#? SEE ALSO
#? usr/install_openssl.sh
#?
# HACKER's INFO
# This file is generated from INSTALL-template.sh .
# The generator (make) inserts most values for internal variables. In
# particular the list of source files to be installed. See the strings
# and scopes containing "generated data from %M% %I%" .
#
# All output is pretty printed. Yes, this adds some complexity, but it
# is assumed that mainly humans read the output.
#
# Silently accepts the options -n or -h or --x also.
# Silently accepts the options --usage to simulate empty arguments.
#
# echo vs /bin/echo
# echo is a pain, depending on the platform. The shell's built-in echo
# does not have the -n option, usually. /bin/echo doesn't know about
# ANSI escape sequences, usually. \-escaped characters, like \t , are
# another problem, some shells support them, others do not.
# I.g. we'd like to use traditional bourne shell, where all behaviours
# are well defined. Unfortunately, some platforms seem to be a hostage
# of their developers who believe that their favorite shell has to be
# used by all users (for example by using a symbolic link for /bin/sh
# to whatever, without informing the user).
# Best effort to get this script working on most platforms was:
# * mainly use /bin/echo (aliased to echo, to keep code readable)
# * TABs (aka \t aka 0x09) are used verbatim (see $t variable)
# * shell's built-in echo used when ANSI escape sequences are used
# There's no guarantee that it works flawless on everywhere, currently
# (8/2019) it works for BSD, debian (including Mac OSX).
# Functionality of this script is not harmed, if the output with echo
# fails (prints ANSI escapes and/or \-escapes verbatim, and/or prints
# -n verbatim, etc.).
#
# INSTALL.sh.lock
# If the file INSTALL.sh.lock exists in the source or destination dir
# mv and rm commands will not be executed (--cgi, --clean --install).
# This is not officially described with --help because it is used to
# to protect the develepopment directory for unintended use.
#
#
#? DEPENDENCIES
#? Following tools are required for proper functionality:
#? awk, cat, perl, sed, tr, which, /bin/echo
#?
#? VERSION
# added with --help
#?
#? AUTHOR
#? 16-sep-16 Achim Hoffmann
#?
# -----------------------------------------------------------------------------
#_____________________________________________________________________________
#_____________________________________________ internal variables; defaults __|
SID="@(#) INSTALL-template.sh 3.39 24/08/27 11:06:56"
try=''
ich=${0##*/}
dir=${0%/*}
[ "$dir" = "$0" ] && dir="." # $0 found via $PATH in .
# note that all variables are used global
lock="INSTALL.sh.lock"
src_directory="$dir"
clean_directory=".files_to_be_removed" # must be set after reading arguments
_break=0 # 1 if screen width < 50; then use two lines as output
colour="" # 32 green, 34 blue for colour-blind
useenv=0 # 1 to change shebang lines to /usr/bin/env
gnuenv=0 # 1 to change shebang lines to /usr/bin/env -S
ignore=0 # 1 ignore errors, continue script instead of exit
other=0
force=0
instdev=0 # 1 install development files also
changes=0 # 1 show only changed file with --check=SID
optn=""
optv= # 1 print verbose information
mode="" # "", cgi, check, clean-up, install, openssl
alias echo=/bin/echo # need special echo which has -n option;
# TODO: check path for each platform
tab=" " # need a real TAB (0x09) for /bin/echo
unset OSAFT_OPTIONS # may be set by make, distorts some strings here
text_miss="missing, try installing from/with";
text_old="ancient module found, try installing newer version, at least "
text_one="missing, consider generating with »make standalone«"
text_path="Note: all found executables in PATH are listed"
text_prof="Note: Devel::DProf Devel::NYTProf and GraphViz2 may wrongly be missing"
text_podm="Note: podman is a tool to view pod files, it's not the container engine"
text_dev="file for development"
text_alt="from previous installation"
# generated data from %M% %I% {
osaft_sh="o-saft"
osaft_pm="lib/OCfg.pm lib/Ciphers.pm lib/error_handler.pm lib/SSLinfo.pm lib/SSLhello.pm lib/OData.pm lib/ODoc.pm lib/OMan.pm lib/OText.pm lib/OTrace.pm lib/OUsr.pm"
osaft_exe="o-saft.pl"
osaft_cgi="o-saft.cgi"
osaft_gui="o-saft.tcl"
osaft_rel="doc/o-saft.rel"
osaft_one="usr/o-saft-standalone.pl"
osaft_dock="o-saft-docker"
doc_dir="doc"
lib_dir="lib"
usr_dir="usr"
tst_dir="t"
log_dir="t/log"
inst_directory=${OSAFT_DIR:="/usr/local/o-saft"} # use environment varaibale OSAFT_DIR if set
perl_modules="Net::DNS Net::SSLeay IO::Socket::INET IO::Socket::SSL Time::Local"
osaft_subdirs="lib doc doc/img usr t"
osaft_libdir="lib"
osaft_modules="
OCfg Ciphers error_handler SSLinfo SSLhello OData ODoc OMan OText OTrace OUsr
"
files_contrib="
usr/Cert-beautify.awk usr/Cert-beautify.pl usr/Dockerfile.alpine-3.6 usr/HTML-simple.awk usr/HTML-table.awk usr/HTML4-table.awk usr/HTML5-table.awk usr/INSTALL-template.sh usr/JSON-array.awk usr/JSON-struct.awk usr/XML-attribute.awk usr/XML-value.awk usr/alertscript.cfg usr/alertscript.pl usr/bash_completion_o-saft usr/bunt.pl usr/bunt.sh usr/checkAllCiphers.pl usr/cipher_check.sh usr/critic.sh usr/dash_completion_o-saft usr/distribution_install.sh usr/filter_examples usr/fish_completion_o-saft usr/gen_standalone.sh usr/install_openssl.sh usr/install_perl_modules.pl usr/lazy_checks.awk usr/symbol.pl usr/tcsh_completion_o-saft usr/usage_examples usr/zap_config.sh usr/zap_config.xml
"
files_install="
.o-saft.pl Dockerfile doc/coding.txt doc/concepts.txt doc/glossary.txt doc/help.txt doc/links.txt doc/misc.txt doc/openssl.txt doc/rfc.txt doc/tools.txt lib/Ciphers.pm lib/OCfg.pm lib/OData.pm lib/ODoc.pm lib/OMan.pm lib/OText.pm lib/OTrace.pm lib/OUsr.pm lib/SSLhello.pm lib/SSLinfo.pm lib/error_handler.pm lib/o-saft-img.tcl o-saft o-saft-docker o-saft-docker-dev o-saft.pl o-saft.tcl
"
files_install_cgi="
doc/o-saft.cgi.html usr/o-saft.php
"
files_install_doc="
doc/o-saft.1 doc/o-saft.html doc/o-saft.pod
"
files_install_dev="
CHANGES Makefile README.md t/.perlcriticrc t/Makefile t/Makefile.FQDN t/Makefile.cgi t/Makefile.cipher t/Makefile.cmd t/Makefile.critic t/Makefile.dev t/Makefile.docker t/Makefile.etc t/Makefile.examples t/Makefile.exit t/Makefile.ext t/Makefile.gen t/Makefile.help t/Makefile.hlp t/Makefile.inc t/Makefile.init t/Makefile.inst t/Makefile.legacy t/Makefile.make t/Makefile.misc t/Makefile.mod t/Makefile.opt t/Makefile.pod t/Makefile.tcl t/Makefile.template t/Makefile.testssl t/Makefile.testssl.botan t/Makefile.testssl.libressl t/Makefile.testssl.mbedtls t/Makefile.testssl.wolfssl t/Makefile.warnings t/SSLinfo.pl t/cloc-total.awk t/gen-graph-annotations.sh t/gen-graph-sub-calls.sh t/get-SIDs.sh t/o-saft_bench.sh t/test-bunt.pl.txt
"
files_all_src="
o-saft.pl o-saft.tcl lib/o-saft-img.tcl o-saft o-saft-docker o-saft.cgi usr/o-saft.php usr/o-saft-standalone.pl o-saft-docker o-saft-docker-dev Dockerfile lib/OCfg.pm lib/Ciphers.pm lib/error_handler.pm lib/SSLinfo.pm lib/SSLhello.pm lib/OData.pm lib/ODoc.pm lib/OMan.pm lib/OText.pm lib/OTrace.pm lib/OUsr.pm doc/coding.txt doc/concepts.txt doc/glossary.txt doc/help.txt doc/links.txt doc/misc.txt doc/openssl.txt doc/rfc.txt doc/tools.txt .o-saft.pl README.md CHANGES doc/o-saft_CLI_data_flow.odg doc/o-saft_GUI_data_flow.odg doc/o-saft_docker.de.odg doc/o-saft_docker.en.odg usr/o-saft-standalone.pl doc/o-saft.pod doc/o-saft.html doc/o-saft.cgi.html doc/o-saft.txt doc/o-saft.wiki doc/o-saft.1 doc/o-saft.pl.--help doc/o-saft.pl.--help=opts doc/o-saft.pl.--help=commands doc/o-saft.pl.--help=glossar doc/o-saft.pl.--help=alias doc/o-saft.pl.--help=data doc/o-saft.pl.--help=data doc/o-saft.pl.--help=checks doc/o-saft.pl.--help=regex doc/o-saft.pl.--help=rfc doc/o-saft.pl.--help=ciphers-html doc/o-saft.pl.--help=ciphers-text doc/o-saft.pl.--help=warnings tags Makefile t/Makefile t/Makefile.inc t/Makefile.help t/Makefile.hlp t/Makefile.cipher t/Makefile.cgi t/Makefile.cmd t/Makefile.dev t/Makefile.critic t/Makefile.etc t/Makefile.ext t/Makefile.exit t/Makefile.docker t/Makefile.gen t/Makefile.init t/Makefile.inst t/Makefile.legacy t/Makefile.make t/Makefile.misc t/Makefile.mod t/Makefile.warnings t/Makefile.opt t/Makefile.pod t/Makefile.tcl t/Makefile.template t/Makefile.FQDN t/Makefile.examples t/SSLinfo.pl t/o-saft_bench.sh t/cloc-total.awk t/gen-graph-annotations.sh t/gen-graph-sub-calls.sh t/get-SIDs.sh t/test-bunt.pl.txt t/.perlcriticrc usr/bash_completion_o-saft usr/dash_completion_o-saft usr/fish_completion_o-saft usr/tcsh_completion_o-saft usr/filter_examples usr/usage_examples usr/Cert-beautify.awk usr/HTML-simple.awk usr/HTML-table.awk usr/HTML4-table.awk usr/HTML5-table.awk usr/JSON-struct.awk usr/JSON-array.awk usr/XML-attribute.awk usr/XML-value.awk usr/lazy_checks.awk usr/Cert-beautify.pl usr/alertscript.pl usr/alertscript.cfg usr/bunt.pl usr/bunt.sh usr/symbol.pl usr/checkAllCiphers.pl usr/cipher_check.sh usr/critic.sh usr/gen_standalone.sh usr/distribution_install.sh usr/install_openssl.sh usr/install_perl_modules.pl usr/INSTALL-template.sh usr/Dockerfile.alpine-3.6 usr/zap_config.sh usr/zap_config.xml
"
tools_intern="
t/cloc-total.awk t/gen-graph-annotations.sh t/gen-graph-sources.sh t/gen-graph-sub-calls.sh t/get-SIDs.sh t/o-saft_bench.sh t/test-bunt.pl.txt usr/bunt.pl usr/gen_standalone.sh
"
tools_extern="
cloc ctags diff docker dot dotty dprofpp gmake gpg graph-easy make mgdiff nytprofhtml perl-analyzer perl-analyzer-output perlcritic podchecker sccs sha256sum tkdiff xdot xvcg xxdiff
"
tools_modules="
Data::Dumper Debug::Trace Devel::DProf Devel::NYTProf Devel::Size Devel::Trace File::Find Getopt::Simple GraphViz JSON Perl::Analyzer Perl::Critic Pod::Perldoc Storable Text::MicroTemplate Tk::Pod
"
tools_optional="
aha perldoc pod2html pod2man pod2pdf pod2text pod2usage podman podviewer stty tkpod tput
"
tools_other="
OSSL_CCS_InjectTest.py SSLAudit.exe SSLAudit.pl SSLCertScanner.exe SSLPressure.exe TLSSLed_v1.3.sh TestSSLServer.exe TestSSLServer.jar analyze-ssl.pl athena-ssl-cipher-check_v062.jar bash-heartbleed.sh beast.pl ccs-injection.sh check-ssl-heartbleed.pl chksslkey cnark.pl manyssl poet robot-detect smtp_tls_cert.pl ssl-cert-check ssl-check-heartbleed.pl ssl-cipher-check.pl ssl-dos ssl-renegotiation.sh sslcat ssldiagnos.exe sslmap.py sslscan sslscan.exe sslsniff sslstrip ssltest.pl ssltest_heartbeat.py sslthing.sh sslyze.py stunnel testssl.sh tls-check.pl tls-scan tlsenum vessl
"
# generated data from %M% %I% }
# HARDCODED {
# because newer Makefiles may no longer know about them
dirs__ancient="contrib Net OSaft/Doc OSaft"
files_ancient="
generate_ciphers_hash openssl_h-to-perl_hash o-saft-README
o-saft-dbx.pm o-saft-lib.pm o-saft-man.pm o-saft-usr.pm osaft.pm
checkAllCiphers.pl INSTALL-devel.sh .perlcriticrc o-saft_bench
contrib/.o-saft.tcl contrib/o-saft.cgi
"
# first, dirty hack to make tests in development mode possible
# remember the inserted "" to avoid substitutions here
[ "INSERTED_""BY_MAKE_OSAFT_SH" = "$osaft_sh" ] && osaft_sh=o-saft
[ "INSERTED_""BY_MAKE_OSAFT_PL" = "$osaft_exe" ] && osaft_exe=o-saft.pl
[ "INSERTED_""BY_MAKE_OSAFT_CGI" = "$osaft_cgi" ] && osaft_gui=o-saft.cgi
[ "INSERTED_""BY_MAKE_OSAFT_GUI" = "$osaft_gui" ] && osaft_gui=o-saft.tcl
[ "INSERTED_""BY_MAKE_OSAFT_DOCKER" = "$osaft_dock" ] && osaft_dock=o-saft-docker
[ "INSERTED_""BY_MAKE_OSAFT_rel" = "$osaft_rel" ] && osaft_rel=doc/o-saft.rel
[ "INSERTED_""BY_MAKE_USR_DIR" = "$usr_dir" ] && usr_dir=usr
# some files "not to be installed" are ancient, they are kept here in
# $files_not_installed to ensure that outdated content is also handled
# the generated "graph" files are also hardcoded here
files_not_installed="
$usr_dir/o-saft.cgi $usr_dir/o-saft.php $usr_dir/Dockerfile*
$usr_dir/distribution_install.sh $usr_dir/gen_standalone.sh
$usr_dir/install_perl_modules.pl $usr_dir/install_openssl.sh
$usr_dir/INSTALL-template.sh
$doc_dir/*graph-annotations.* $doc_dir/*graph-sub-call*
"
files_develop="o-saft-docker-dev Dockerfile Makefile t/ $usr_dir/critic.sh"
files_info="CHANGES README o-saft.tgz"
# HARDCODED }
osaft_exerc=".$osaft_exe"
osaft_guirc=".$osaft_gui"
build_openssl="$usr_dir/install_openssl.sh"
all_exe="$osaft_exe $osaft_gui $osaft_sh $osaft_dock $osaft_one"
# checking INSTALL.sh (myself) is pointless, somehow ...
_line='----------------------+-----------------'
_cols=0
\command -v \tput >/dev/null && _cols=`\tput cols`
if [ 0 -lt $_cols ]; then
# adapt _line to screen width
[ -n "$OSAFT_MAKE" ] && _cols=78 # SEE Make:OSAFT_MAKE
[ 51 -gt $_cols ] && _break=1 # see echo_label()
while [ 42 -lt $_cols ]; do
# FIXME: some terminal break line when colour is used
_line="$_line-"
_cols=`expr $_cols - 1`
done
fi
#_____________________________________________________________________________
#________________________________________________________ general functions __|
__exit () {
[ 0 -lt $ignore ] && return
exit $@
}
echo_grey () {
[ -z "$colour" ] && echo "$@" && return
\echo "\033[7;33m\033[1;30m$@\033[0m"
}
echo_info () {
[ -z "$optv" ] && return
if [ -z "$colour" ]; then
\echo "# $@"
else
echo_grey "# $@"
fi
}
echo_head () {
echo ""
if [ -z "$colour" ]; then
\echo "$@"
\echo "#$_line"
else
#echo_grey "$@"
#echo_grey "#$_line"
\echo "\033[7;37m\033[1;30m$@"
\echo "#$_line\033[0m"
fi
}
echo_foot () {
if [ -z "$colour" ]; then
echo "#$_line"
else
echo_grey "#$_line"
fi
}
echo_label () {
perl -le "printf'# %21s%c','$@',0x09" # use perl instead of echo for formatting
[ 0 -eq $_break ] && return
perl -le 'printf"\n\t"' # use additional line
}
# for escape sequences, shell's built-in echo must be used
echo_yellow () {
[ -z "$colour" ] && echo "$@" && return
\echo "\033[1;33m$@\033[0m"
}
echo_green () {
[ -z "$colour" ] && echo "$@" && return
\echo "\033[1;$colour$@\033[0m"
}
echo_red () {
[ -z "$colour" ] && echo "$@" && return
\echo "\033[1;31m$@\033[0m"
}
echo_error () {
# $1 number of errors
echo ""
echo -n "# checks$tab"
if [ $1 -eq 0 ]; then
echo_green "passed"
else
echo_red "failed , $1 error(s) detected"
fi
return
}
check_pm () {
# check if passed name is own perl module; return 0 if it is own module
# name can be path like Net/SSLinfo.pm or module name like lib/SSLinfo
# NOTE: extension in name (anything right of rightmost . including.) is
# removed; this assumes that module names (wether perl syntax or
# path name) cannot contain . (dot).
_m=$1
_m=`\echo "$_m" | \sed -e 's#::#/#g'`
_m=${_m%.*} # remove extension (.pm) if any
for _p in $osaft_pm ; do
_p=${_p%.*} # remove extension (.pm) if any
[ "$_p" = "$_m" ] && return 0
done
return 1
}
check_commands () {
for c in $* ; do
echo_label "$c"
is=$(\command -v $c)
[ -n "$is" ] && echo_green "$is" || echo_red "missing"
done
return
} # check_commands
check_development () {
# $1 is -d -e -f or -L ; $2 is name of directory, file, link, ...
# use own label instead of echo_label
perl -le "printf'# %25s%c','$2',0x09"
if [ $1 "$2" ]; then
echo_green "OK"
else
echo_red "missing; install with: »$0 $inst_directory --instdev«"
err=`expr $err + 1`
fi
return
} # check_development
check_exec () {
# TODO: this is a variant of check_development(), should be implemented there
for c in $* ; do
echo_label "$c"
[ -x "$c" ] && echo_green "OK" || echo_red "not executable"
[ -x "$c" ] || err=`expr $err + 1`
done
return
} # check_exec
copy_file () {
src=$1
dst=$2
convert=0
if [ 0 -lt $useenv ]; then
ext=${src##*.}
file=${src##*/}
# ugly hardcode match of extensions and names
case "$ext" in
awk | cgi | pl | pm | sh | tcl | pod | txt) convert=1 ; ;;
esac
case "$file" in
o-saft) convert=1 ; ;;
usage_examples) convert=1 ; ;;
o-saft-docker*) convert=1 ; ;;
Dockerfile*) convert=1 ; ;;
Makefile*) convert=1 ; ;;
*_completion_o-saft) convert=1 ; ;;
esac
fi
#dbx# \perl -lane 'if(1==$.){exit 1 if m|^#\!\s*/usr/bin/env |}' "$src" || echo skip $src ...
\perl -lane 'if(1==$.){exit 1 if m|^#\!\s*/usr/bin/env |}' "$src" || convert=0
if [ 1 -eq $convert ]; then
echo_info "install converted $src ..."
# only the very first line $. ist changed
if [ -n "$try" ]; then
echo 'perl -lane "if(1==$.){s|^.*?/([a-zA-Z0-9_.-]+$)|#\!/usr/bin/env $1|;}print;" '"'$src' > '$dst'"
return
fi
# convert only "#! /some/path/tool"
\perl -lane 'if(1==$.){s|^.*?/([a-zA-Z0-9_.-]+)\s*$|#\!/usr/bin/env $1|;}print;' \
"$src" > "$dst" || __exit 4
if [ 0 -lt $gnuenv ]; then
# convert only "#! /some/path/tool arg..."
\perl -lane 'if(1==$.){exit 1 if m|^#.*?/([a-zA-Z0-9_.-]+)\s(.*)$|;}' "$src" || \
\perl -lane 'if(1==$.){s|^#.*?/([a-zA-Z0-9_.-]+)\s(.*)$|#\!/usr/bin/env -S $1 $2|;}print;' \
"$src" > "$dst" || __exit 4
fi
# set proper modes
\chmod 555 "$dst" # assuming that it is and should be executable
else
echo_info " cp $src $dst"
$try \cp --preserve=all "$src" "$dst" || __exit 4
fi
return
} # copy_file
check_md5 () {
# compute md5sum and compare with value in *.rel file; increments $err
# TODO: md5sum useless for converted files, as it differs always
_rel=$1
_dst=$2
[ -e "$_dst" ] || echo_yellow "**WARNING: missing '$_dst'; checksum ignored"
[ -e "$_dst" ] || return
name=${_dst##*/} # filename without path because / causes problem in awk
[ ! -e "$_rel" ] && return # warning already printed
# get expected md5sum
# ^[0-9] - to ensure matching lines with SID
# SID %I (edited file) does not match and will be reported
# (^|.*\/) - to ensure matching path or bare name
# exit - to ensure only one (first) value is returned
md5sum=`\awk '/^[0-9]/{if($6~/(^|.*\/)'$name'$/){print $4;exit}}' $_rel`
newsum=`\md5sum $_dst` # compute m5sum of installed file
newsum=${newsum%% *} # remove trailing filename
#dbx# echo "# $name : $md5sum : $newsum."
[ "$md5sum" = "$newsum" ] || echo_red "# wrong checksum $newsum for '$_dst'"
[ "$md5sum" = "$newsum" ] || err=`expr $err + 1`
return
} # check_md5
#_____________________________________________________________________________
#__________________________________________________________ check functions __|
check_tools () {
[ "check" = "$mode" ] || echo_info "check_tools() ..."
echo_head "# check for O-Saft programs found via environment variable PATH"
_cnt=0
_gui=0
for p in `echo $PATH|tr ':' ' '` ; do
for o in $all_exe perl wish ; do
exe="$p/$o"
if [ -e "$exe" ]; then
_cnt=`expr $_cnt + 1`
echo_label "$exe" && echo_green "$p"
#echo_label "$exe" && echo_yellow "missing"
fi
[ "$o" != "wish" ] && continue
if [ -e "$exe" ]; then
_gui=`expr $_gui + 1`
echo_label "wish" && echo_green "$p"
fi
done
done
echo "#"
echo "# $text_path"
[ 0 -eq $_cnt -o 0 -eq $_gui ] && echo "#"
[ 0 -eq $_cnt ] && echo_label "$osaft_exe" \
&& echo_yellow "not found in PATH, consider adding $inst_directory to PATH"
[ 0 -eq $_gui ] && echo_label "wish" \
&& echo_yellow "not found in PATH, consider installing wish" \
&& osaft_gui=
[ -e "$osaft_one" ] || ( echo_label "$osaft_one" && echo_yellow "$text_one" )
echo_foot
return
} # check_tools
check_inst () {
[ "check" = "$mode" ] || echo_info "check_inst() ..."
echo_head "# check installation in $inst_directory"
echo "# (warnings are ok if »git clone« will be used for development)"
_cnt=0
# err=`expr $err + 1` ; # errors not counted here
for f in $dirs__ancient ; do
[ -d "$f" ] && echo_label "$f" \
&& echo_yellow "found; directory $text_alt" \
&& _cnt=`expr $_cnt + 1`
done
for f in $files_ancient ; do
[ -e "$f" ] && echo_label "$f" \
&& echo_yellow "found; file $text_alt" \
&& _cnt=`expr $_cnt + 1`
done
for f in $files_develop $files_info ; do
[ -e "$f" ] && echo_label "$f" \
&& echo_yellow "found; $text_dev" \
&& _cnt=`expr $_cnt + 1`
done
[ 0 -ne $_cnt ] && echo -n "# " \
&& echo_yellow "consider running »$0 --clean $inst_directory« "
echo_foot
return
} # check_inst
check_self () {
[ "check" = "$mode" ] || echo_info "check_self() ..."
echo_head '# check for used O-Saft programs (according $PATH)'
for o in $all_exe ; do
# $osaft_cgi cannot be checked here because it behaves different
_opt="+VERSION"
[ "o-saft-docker" = $o ] && _opt="+V" # has no own +VERSION, see source there
if [ "o-saft.tcl" = $o ]; then
[ -z "$osaft_gui" ] && \
echo_yellow "not checked because »wish« missing" && \
continue
fi
echo_label "$o"
e=$(\command -v $o)
if [ -n "$e" ] ; then
v=`$o $_opt`
_txt=`echo "$v $e"|awk '{printf("%8s %s",$1,$2)}'`
echo_green "$_txt"
else
err=`expr $err + 1`
echo_red "not found"
fi
done
echo_foot
return
} # check_self
check_rc () {
[ "check" = "$mode" ] || echo_info "check_rc() ..."
echo_head "# check for installed O-Saft resource files"
# currently no version check
_cnt=0
for p in `echo $HOME $PATH|tr ':' ' '` ; do
_rc="$p/$osaft_exerc"
if [ -e "$_rc" ]; then
_cnt=`expr $err + 1`
echo_label "$_rc" && echo_yellow "will be used when started in $p only"
fi
done
[ 0 -eq $_cnt ] && echo_yellow "$rc not found"
_rc="$HOME/$osaft_guirc"
if [ -e "$_rc" ]; then
v=`awk '/RCSID/{print $3}' $_rc | tr -d '{};'`
echo_label "$_rc" && echo_green "$v"
_txt="ancient"
else
_txt="missing"
fi
echo_label "$_rc" && echo_yellow "$_txt, consider generating: »$osaft_gui --rc > $_rc«"
echo_foot
return
} # check_rc
check_usr () {
[ "check" = "$mode" ] || echo_info "check_usr() ..."
echo_head "# check for contributed files (in $inst_directory/$usr_dir )"
for c in $files_contrib $osaft_one ; do
_skip=0
for f in $files_not_installed $files_develop ; do
[ "$f" = "$c" ] && _skip=1
done
[ $_skip -eq 1 ] && continue
_c=${c##*/}
echo_label "$_c" #&& echo_green "$openssl"
c="$inst_directory/$c"
[ -e "$c" ] && echo_green "$c" || echo_yellow "missing $c"
#err=`expr $err + 1` # not counted as error
done
echo_foot
return
} # check_usr
check_perl () {
[ "check" = "$mode" ] || echo_info "check_perl() ..."
echo_head "# check for important Perl modules used by installed O-Saft"
for p in `echo $inst_directory $PATH|tr ':' ' '` ; do
o="$p/$osaft_exe"
[ -e "$o" ] || continue
# NOTE: output format is slightly different, 'cause **WARNINGs are printed too
echo "# testing $o ...$tab"
for m in $perl_modules ; do
echo_label "$m"
w=`$o --no-warn +version 2>&1 | awk '/(ERROR|WARNING).*'$m'/{print}'`
v=`$o --no-warn +version 2>/dev/null | awk '($1=="'$m'"){printf"%8s %s",$2,$3}'`
if [ -n "$w" ]; then
# ERROR in $w most likely means that $m is not found by
# perl, then $v is empty
if [ -z "$v" ]; then
echo_red "$w"
else
echo_red "$v"
echo_yellow "$w"
fi
else
if [ -z "$v" ]; then
echo_yellow "missing?" # probaly due to ERROR
else
echo_green "$v"
fi
fi
#err=`expr $err + 1` # already counted in previous check
done
done
echo_foot
return
} # check_perl
check_modules () {
[ "check" = "$mode" ] || echo_info "check_modules() ..."
echo_head "# check for installed Perl modules (started in $inst_directory )"
for m in $perl_modules $osaft_modules ; do
echo_label "$m"
text_cpan="»cpan $m«"
v=`perl -I $osaft_libdir -M$m -le 'printf"%8s",$'$m'::VERSION' 2>/dev/null`
p=`perl -I $osaft_libdir -M$m -le 'my $idx='$m';$idx=~s#::#/#g;printf"%s",$INC{"${idx}.pm"}' 2>/dev/null`
if [ -n "$v" ]; then
if check_pm "$m" ; then c="green"; fi
case "$m" in
'IO::Socket::SSL') expect=1.90; ;; # 1.37 and newer work, somehow ...
'Net::SSLeay') expect=1.49; ;; # 1.33 and newer may work
'Net::DNS') expect=0.80; ;;
'Time::Local') expect=1.90; ;;
esac
case "$m" in
'Time::Local')
# has strange version numbering, needs ugly hack :-((
if [ 1.25 = $v \
-o 1.26 = $v \
-o 1.27 = $v \
-o 1.28 = $v ]; then
# 1.25 seems to be newer than 1.230 which is newer than 1.90
c="green";
else
c=`echo $expect $v | perl -anle '($e=$F[0])=~s#(\d+)#sprintf"%05d",$1#ge;($v=$F[1])=~s#(\d+)#sprintf"%05d",$1#ge;print (($e > $v) ? "red" : "green")'`;
fi
;;
*) # our own modules
c=`echo $expect $v | perl -anle '($e=$F[0])=~s#(\d+)#sprintf"%05d",$1#ge;($v=$F[1])=~s#(\d+)#sprintf"%05d",$1#ge;print (($e > $v) ? "red" : "green")'`; ;;
# NOTE: need to compare for example: 1.23 > 1.230
# Comparing version strings is tricky, best method would be
# to use Perl's Version module. But this script should work
# on limited systems too, hence above cumbersome code:
# 1. get the version strings on stdin
# 2. convert all number parts of the string to fixed 5-digit
# format with leading zeros: 1.230 > 00001.000230
# 3. compare converted strings
# Perl is clever enough to handle 00001.00023.42000 also
esac
[ "$c" = "green" ] && echo_green "$v $p"
[ "$c" = "red" ] && echo_red "$v $p, $text_old $expect"
[ "$c" = "red" ] && err=`expr $err + 1`
else
if check_pm "$m" ; then text_cpan="»o-saft.tgz«"; fi
echo_red "$text_miss $text_cpan"
err=`expr $err + 1`
fi
done
echo_foot
return
} # check_modules
check_summary () {
[ "check" = "$mode" ] || echo_info "check_summary() ..."
echo_head "# summary of warnings from installed O-Saft (should be empty)"
o="$inst_directory/$osaft_exe"
if [ -e "$o" ]; then
echo "# testing $o in $inst_directory ...$tab"
cd "$inst_directory"
w=`$o +version 2>&1 | awk '/WARNING:/{print}'`
[ -n "$w" ] && echo_yellow "$w"
fi
echo_foot
return
} # check_summary
check_openssl () {
[ "check" = "$mode" ] || echo_info "check_openssl() ..."
echo_head "# check for openssl executable in PATH"
echo_label "openssl" && echo_green "`which openssl`" "(`openssl version`)" \
|| echo_yellow "missing"
# TODO: error when openssl older than 0x01000000 has no SNI
echo_foot
#
echo_head "# check for openssl executable used by O-Saft"
for p in `echo $inst_directory $PATH|tr ':' ' '` ; do
o="$p/$osaft_exe"
r="$p/.$osaft_exe"
if [ -x "$o" ]; then
_pwd=`\pwd`
if [ "t" = `basename $_pwd` -a ".." = "$p" ]; then
# contribution to our make
o="${_pwd%/*}/$osaft_exe" # full path
echo_yellow "**WARNING: call in development directory t/.. assumed; using '$o'"
fi
# first call program to check if it is starting properly
# if it fails with a status, the corresponding error is printed
# and the extraction of the openssl executable is not done
(
cd "$p" # ensure that $r is used
$o --no-warn +version >/dev/null && \
openssl=`$o --no-warn +version 2>/dev/null | awk '/external executable/{if(3==NF){print $NF}}'` && \
version=`$o --no-warn +version 2>/dev/null | awk '/external executable/{if(4<NF){sub(/^.* O/,"");print}}'` && \
echo_label "$o" && echo_green "$openssl ($version)" || echo_red "missing"
)
fi
done
echo_foot
return
} # check_openssl
check_podtools () {
[ "check" = "$mode" ] || echo_info "check_podtools() ..."
echo_head "# check for optional tools to view documentation"
check_commands $tools_optional
echo "#"
echo "# $text_podm"
echo_foot
return
} # check_podtools
check_sids () {
[ "check" = "$mode" ] || echo_info "check_sids() ..."
#echo_head "# check SIDs of installed files"
echo_head "# SID\tdate\ttime\tmd5sum\tfilename\tpath"
if [ 0 -eq $changes ]; then
\echo "$files_all_src" | t/get-SIDs.sh
else
# show diff only (tested with GNU diff only)
\echo "$files_all_src" | t/get-SIDs.sh | \diff $osaft_rel -
fi
echo_foot
echo_grey "# some files in doc/ t/ and usr/ don't have a SID"
return
} # check_sids
mode_check () {
echo_info "mode_check() ..."
echo "# PATH$tab$PATH"
check_tools
PATH=${inst_directory}:$PATH # ensure that given directory is in PATH
echo "cd $inst_directory"
cd "$inst_directory" # must be done with --n too
check_inst
check_self
check_rc
# from here on, all **WARNINGS (from $osaft_exe) are not important
# and hence redirected to /dev/null
check_perl
check_modules
check_summary
check_openssl
check_podtools
check_usr
echo_error $err
# more hints, if no installation directory was given
[ -z "$new_dir" ] && echo "# default installation directory »$inst_directory« used"