| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # This script builds and minifies CSS and JS that we bundle to HTML report and guide. |
| 3 | set -e |
| 4 | |
| 5 | if ! type yuicompressor > /dev/nullscip-shell filesystem . . `/dev/null`.; then |
| 6 | echoscip-shell system . . echo. "Please install yuicompressor utility" |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
| 10 | ALL_CSS=`mktempscip-shell system . . mktemp.` |
| 11 | ALL_CSS_MIN=`mktempscip-shell system . . mktemp.` |
| 12 | ALL_JS=`mktempscip-shell system . . mktemp.` |
| 13 | ALL_JS_MIN=`mktempscip-shell system . . mktemp.` |
| 14 | |
| 15 | echoscip-shell system . . echo. "" > $ALL_CSS |
| 16 | catscip-shell system . . cat. xccdf-resources/jquery.treetable.css >> $ALL_CSS |
| 17 | catscip-shell system . . cat. xccdf-resources/jquery.treetable.theme.css >> $ALL_CSS |
| 18 | catscip-shell system . . cat. xccdf-resources/openscap.css >> $ALL_CSS |
| 19 | yuicompressor --type css $ALL_CSS > $ALL_CSS_MIN |
| 20 | rmscip-shell system . . rm. $ALL_CSS |
| 21 | echoscip-shell system . . echo. "" > $ALL_JS |
| 22 | catscip-shell system . . cat. xccdf-resources/jquery.treetable.js >> $ALL_JS |
| 23 | catscip-shell system . . cat. xccdf-resources/bootstrap.min.js >> $ALL_JS |
| 24 | catscip-shell system . . cat. xccdf-resources/openscap.js >> $ALL_JS |
| 25 | yuicompressor --type js $ALL_JS > $ALL_JS_MIN |
| 26 | rmscip-shell system . . rm. $ALL_JS |
| 27 | |
| 28 | XCCDF_RESOURCES="xccdf-resources.xsl" |
| 29 | |
| 30 | echoscip-shell system . . echo. "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" > $XCCDF_RESOURCES |
| 31 | echoscip-shell system . . echo. "<!-- This file was autogenerated! See the xccdf-resources/ folder! -->" >> $XCCDF_RESOURCES |
| 32 | |
| 33 | echoscip-shell system . . echo. "<xsl:stylesheet version=\"1.1\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" >> $XCCDF_RESOURCES |
| 34 | echoscip-shell system . . echo. "<xsl:template name=\"css-sources\"><![CDATA[" >> $XCCDF_RESOURCES |
| 35 | # bootstrap.min.css can't be minified further without breaking behavior |
| 36 | catscip-shell system . . cat. xccdf-resources/bootstrap.min.css >> $XCCDF_RESOURCES |
| 37 | catscip-shell system . . cat. $ALL_CSS_MIN >> $XCCDF_RESOURCES |
| 38 | echoscip-shell system . . echo. "]]></xsl:template>" >> $XCCDF_RESOURCES |
| 39 | echoscip-shell system . . echo. "<xsl:template name=\"js-sources\"><![CDATA[" >> $XCCDF_RESOURCES |
| 40 | # jquery.min.js can't be minified further without breaking behavior |
| 41 | catscip-shell system . . cat. xccdf-resources/jquery.min.js >> $XCCDF_RESOURCES |
| 42 | catscip-shell system . . cat. $ALL_JS_MIN >> $XCCDF_RESOURCES |
| 43 | echoscip-shell system . . echo. "]]></xsl:template>" >> $XCCDF_RESOURCES |
| 44 | |
| 45 | echoscip-shell system . . echo. "</xsl:stylesheet>" >> $XCCDF_RESOURCES |
| 46 | |
| 47 | rmscip-shell system . . rm. $ALL_CSS_MIN |
| 48 | rmscip-shell system . . rm. $ALL_JS_MIN |