aboutsummaryrefslogtreecommitdiffstats
path: root/s2i/bin/assemble
blob: 48e6ffd31d06395d66f4950b312863e7a6703463 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash -e
#
# S2I assemble script for the 'kraxel/s2i-jekyll' image.
# The 'assemble' script builds your application source so that it is ready to run.
#
# For more information refer to the documentation:
#	https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md
#

if [[ "$1" == "-h" ]]; then
	exec /usr/libexec/s2i/usage
fi

echo "--- debug ---"
id -a
echo "---"

export HOME=/opt/app-root/src
cd $HOME

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 makeall.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 ..."
cat <<EOF > output/kraxel.css
body {
	/* no extra long lines please */
	max-width: 100ch;

	/* center text */
	margin: 0px auto;

	/* beautify a bit */
	padding: 2ex 2em;
	border: 2pt #ccc solid;
}
EOF
cat output/kraxel.css >> 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