-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ort.sh
executable file
·114 lines (102 loc) · 6.49 KB
/
.ort.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
# Copyright (c) 2023 Dinesh Ravi
# Apache.2.0
SECONDS=0
reportname=bill-of-materials
if [[ $1 == "" ]]; then
echo "=============== Please choose run with below options ==============="
echo "1. bash .ort.sh scan -> to initiate new scan"
echo "2. bash .ort.sh debug -> to get the report for debug"
echo "3. bash .ort.sh bom -> to get bill of materials"
fi
if [[ $1 == "debug" ]]; then
echo "=============== ORT Debug Report ==============="
ort report --ort-file=.ort/evaluation-result.yml --output-dir=.ort --report-formats="WebApp,HtmlTemplate"
#"CtrlXAutomation,CycloneDx,DocBookTemplate,EvaluatedModel,FossId,FossIdSnippet,GitLabLicenseModel,HtmlTemplate,ManPageTemplate,Opossum,PdfTemplate,PlainTextTemplate,SpdxDocument,StaticHtml,TrustSource,WebApp"
echo "======================================================================="
echo "| Rectify the error present in .ort/scan-report-web-app.html |"
echo "| Rectify the error present in .ort/AsciiDoc_disclosure_document.html |"
echo "| run 'bash .ort.sh report' to get final report |"
echo "======================================================================="
fi
if [[ $1 == "bom" ]]; then
if [ -d $reportname ]; then
echo "=============== Stage 0: Clean previous $reportname folder ==============="
rm -rf $reportname
fi
echo "=============== ORT Final Report ==============="
ort report --ort-file=.ort/evaluation-result.yml --output-dir=$reportname --report-formats="PlainTextTemplate,SpdxDocument" -O "PlainTextTemplate=template.id=NOTICE_SUMMARY"
#"CtrlXAutomation,CycloneDx,DocBookTemplate,EvaluatedModel,FossId,FossIdSnippet,GitLabLicenseModel,HtmlTemplate,ManPageTemplate,Opossum,PdfTemplate,PlainTextTemplate,SpdxDocument,StaticHtml,TrustSource,WebApp"
fi
if [[ $1 == "advise" ]]; then
echo "==========================================================================================================="
echo "| Ensure ort and scancode is installed otherwise its waste of time you can do ctrl+c to cancel this script |"
echo "==========================================================================================================="
if [ -d $reportname ]; then
echo "=============== Stage 0: Clean previous report folder ==============="
rm -rf $reportname
fi
if [ -d ".ort" ]; then
echo "=============== Stage 0: Clean previous .ort folder ==============="
rm -rf .ort
fi
echo "=============== Stage 1: ORT Analyze ==============="
ort analyze --input-dir=. --output-dir=.ort
duration=$SECONDS
echo "until ort analyze $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "=============== Stage 2: ORT Advise ==============="
ort advise --output-dir=.ort --ort-file=.ort/analyzer-result.yml --advisors="OSV"
duration=$SECONDS
echo "until ort advise $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "=============== ORT Debug Report ==============="
ort report --ort-file=.ort/advisor-result.yml --output-dir=.ort --report-formats="WebApp,HtmlTemplate"
duration=$SECONDS
echo "until ort analyze $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
#"CtrlXAutomation,CycloneDx,DocBookTemplate,EvaluatedModel,FossId,FossIdSnippet,GitLabLicenseModel,HtmlTemplate,ManPageTemplate,Opossum,PdfTemplate,PlainTextTemplate,SpdxDocument,StaticHtml,TrustSource,WebApp"
echo "======================================================================="
echo "| Rectify the error present in .ort/scan-report-web-app.html |"
echo "| Rectify the error present in .ort/AsciiDoc_disclosure_document.html |"
echo "| run 'bash .ort.sh report' to get final report |"
echo "======================================================================="
fi
if [[ $1 == "scan" ]]; then
echo "==========================================================================================================="
echo "| Ensure ort and scancode is installed otherwise its waste of time you can do ctrl+c to cancel this script |"
echo "==========================================================================================================="
if [ -d $reportname ]; then
echo "=============== Stage 0: Clean previous report folder ==============="
rm -rf $reportname
fi
if [ -d ".ort" ]; then
echo "=============== Stage 0: Clean previous .ort folder ==============="
rm -rf .ort
fi
echo "=============== Stage 1: ORT Analyze ==============="
ort analyze --input-dir=. --output-dir=.ort
duration=$SECONDS
echo "until ort analyze $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "=============== Stage 2: ORT Scan ==============="
ort scan --ort-file=.ort/analyzer-result.yml --output-dir=.ort
duration=$SECONDS
echo "until ort scan $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "=============== Stage 3: ORT Advise ==============="
ort advise --output-dir=.ort --ort-file=.ort/scan-result.yml --advisors="OSV"
duration=$SECONDS
echo "until ort advise $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "=============== Stage 4: ORT Evaluate ==============="
ort evaluate --ort-file=.ort/advisor-result.yml --output-dir=.ort
duration=$SECONDS
echo "until ort evaluate $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "=============== Stage 5: ORT Debug Report ==============="
ort report --ort-file=.ort/evaluation-result.yml --output-dir=.ort --report-formats="WebApp,HtmlTemplate"
duration=$SECONDS
echo "until ort report $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "======================================================================="
echo "| Rectify the error present in .ort/scan-report-web-app.html |"
echo "| Rectify the error present in .ort/AsciiDoc_disclosure_document.html |"
echo "| run 'bash .ort.sh report' to get final report |"
echo "======================================================================="
#if [ -f ".ort/scan-report-web-app.html" ]; then
# echo "=============== Opening .ort/scan-report-web-app.html ==============="
# open .ort/scan-report-web-app.html
#fi
fi