File: generate_html_index_srg_mapping.sh

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (48 lines) | stat: -rwxr-xr-x 1,233 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash
# suppress stdout from pushd and popd commands
pushd () {
    command pushd "$@" > /dev/null
}

popd () {
    command popd "$@" > /dev/null
}

if [ -z "$1" ]; then
    echo "You must inform a directory to store built files."
    exit 1
fi
PAGES_DIR=$1

if [ -z "$2" ]; then
    echo "You must inform a list of products in double quotes."
    exit 1
fi
srg_products=$2 # space separated list of products

mkdir -p $PAGES_DIR

# Generate SRG Mapping Tables
pushd $PAGES_DIR
touch index.html
echo "<!DOCTYPE html>" > index.html
echo '<html lang="en">' >> index.html
echo "<head>" >> index.html
echo '<meta charset="utf-8" />' >> index.html
echo "<title>SRG Mapping Tables</title>" >> index.html
echo "</head>" >> index.html
echo "<body>" >> index.html
echo "<h1>SRG Mapping Tables</h1>" >> index.html
for product in $srg_products
do
echo "<h4>Product: ${product}</h4>" >> index.html
echo "<ul>" >> index.html
echo "<li><a href=\"srg-mapping-${product}.html\">srg-mapping-${product}.html</a></li>" >> index.html
echo "<li><a href=\"srg-mapping-${product}.xlsx\">srg-mapping-${product}.xlsx</a></li>" >> index.html
echo "</ul>" >> index.html
done
echo "</body>" >> index.html
echo "</html>" >> index.html
popd

exit 0