aboutsummaryrefslogtreecommitdiffstats
path: root/s2i/bin/assemble
blob: f4604ba27869c38e4828c9be4204d2f9db6a8a45 (plain)
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
#!/bin/bash -e
#
# For more information refer to the documentation:
#	https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
#

source ${0}.pre

echo "---> Installing application source ..."
mv /tmp/src ./virtio-spec

echo "---> Building virtio spec ..."
(cd virtio-spec;
	export SPECDOC=$(cat REVISION);
	if test "$OPENSHIFT_BUILD_REFERENCE" != ""; then
		SPECDOC="$SPECDOC-$OPENSHIFT_BUILD_REFERENCE";
	fi;
	echo "-----> SPECDOC=$SPECDOC <-----";
	sh makepdf.sh
	sh makehtml.sh)

echo "---> Move docs output ..."
mkdir output
cp -av virtio-spec/*.{html,css,pdf} virtio-spec/images output
stylesheet=$(cd output; ls *.css)

echo "---> CSS fixup ..."
cp /usr/libexec/s2i/darkmode.css output
/usr/libexec/s2i/better-css.sh output/$stylesheet

echo "---> add HEADER ..."
cat <<EOF > output/HEADER.html
<h1>virtio specification</h1>
<p>
  Built from <a href="$OPENSHIFT_BUILD_SOURCE">$OPENSHIFT_BUILD_SOURCE</a>,
  branch ${OPENSHIFT_BUILD_REFERENCE-master},
  <br>
  commit hash is ${OPENSHIFT_BUILD_COMMIT}.
</p>
<ul>
  <li><a href="$(cd output; ls *.html)">online version (html)</a>.
  <li><a href="$(cd output; ls *.pdf)">print version (pdf)</a>.
</ul>
<hr>
<h3>Directory index</h3>
EOF

echo "---> add README ..."
cat <<EOF > output/README.html
<!--
<h3>[debug] build environment</h3>
<pre>
$(set | egrep '^(OPENSHIFT|DESC|SUMMARY)')
</pre>
-->
EOF

echo "---> Fix permissions ..."
chmod +x . output
chmod -R +r .
find output | xargs ls -ld