diff options
Diffstat (limited to 'doc/initbuildboot.sh')
-rw-r--r-- | doc/initbuildboot.sh | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/doc/initbuildboot.sh b/doc/initbuildboot.sh deleted file mode 100644 index 72606a6..0000000 --- a/doc/initbuildboot.sh +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | VER="R0.06" | ||
3 | |||
4 | BBTEMPLATE= | ||
5 | BBXML= | ||
6 | |||
7 | USAGE="`basename $0` -xml buildbootxml-to-create -template templatexml-file ($VER) | ||
8 | Currently only supports sequence types Build-command: and Boot-command: | ||
9 | Both files should have path book-*release-info/doc/ | ||
10 | Creates the XML file from the template, inserting build/boot commands | ||
11 | from the various s_targets/XXXtargetXXX/README files | ||
12 | at the place in template with >SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE< | ||
13 | ignoring rest of template | ||
14 | The code tries to fold too long lines, but this is not perfect. Best would | ||
15 | be if the command lines already in README are short enough, e.g. by | ||
16 | using short variables, which work both on shell and uboot command lines" | ||
17 | |||
18 | while echo "x$1" | egrep '^x-' >/dev/null 2>&1 | ||
19 | do | ||
20 | OPT="$1" ; shift | ||
21 | if [ "$OPT" = "--help" -o "$OPT" = "-h" -o "$OPT" = "-help" ] ; then echo "$USAGE" ; exit ; fi | ||
22 | if [ "$OPT" = "-xml" ] ; then BBXML="$1" ; shift; fi | ||
23 | if [ "$OPT" = "-template" ] ; then BBTEMPLATE="$1" ; shift; fi | ||
24 | done | ||
25 | if [ "$BBTEMPLATE" = "" ]; then echo "ERROR: Missing option -template templatefile"; exit ; fi | ||
26 | if [ "$BBXML" = "" ]; then echo "ERROR: Missing option -xml buildbootxml-to-create"; exit ; fi | ||
27 | if [ ! -f "$BBTEMPLATE" ]; then echo "ERROR: Missing templatefile '$BBTEMPLATE'"; exit; fi | ||
28 | if [ ! -d "`dirname \"$BBXML\"`" ]; then echo "ERROR: Missing parent directory for '$BBXML'"; exit ; fi | ||
29 | |||
30 | echo "`basename $0` Creating $BBXML from" | ||
31 | TARGETREADMES=`cd s_targets ; ls -d */README | tr '\n' ' '` | ||
32 | echo " $TARGETREADMES" | ||
33 | |||
34 | # README file formats: | ||
35 | # a) Sequence starts: ___ XXXX:yyyy or ___ XXXX:yyyy conffile | ||
36 | # where XXXX is a type, yyyy is text to be in title | ||
37 | # b) Inside sequence: ___ END ends the sequence (ignore rest of line) | ||
38 | # c) Inside sequence: # Documentation line | ||
39 | # d) Inside sequence: Anything else is command or config lines | ||
40 | # Conv.to XML: ">" "<" "&" and put all inside <programlisting> | ||
41 | # *) Anywhere ____xxxx Leading 4 underlines or more, always ignored | ||
42 | # unless one of the recognized XXXX | ||
43 | # *) Anywhere outside sequence, ignore all | ||
44 | # *) There can be multiple of each type of sequence in each README file | ||
45 | # with different yyyy | ||
46 | |||
47 | |||
48 | cat $BBTEMPLATE | awk ' | ||
49 | />SCRIPT_INCLUDES_BUILD_BOOT_SECTIONS_HERE</ {exit 0; } | ||
50 | { print $0; } | ||
51 | ' >$BBXML | ||
52 | |||
53 | |||
54 | # Long command lines: The awk code below breaks too long lines, but this is not perfect. | ||
55 | extractcmds_filter() { | ||
56 | echo " <programlisting>" | tr -d '\n' | ||
57 | sed '/^___/d;s/\&/\&/g' | sed 's/</\</g;s/>/\>/g;/^$/d' | \ | ||
58 | awk 'BEGIN { MAX=90; } | ||
59 | ( length($0) > MAX ) { | ||
60 | LINE=$0; | ||
61 | while (length(LINE) > MAX) { | ||
62 | if (index(LINE," ") == 0 ) { | ||
63 | print "ERROR: PROBLEM: No space in too long line:" LINE > "/dev/stderr"; | ||
64 | print $LINE; | ||
65 | next; | ||
66 | } | ||
67 | i=MAX; while ( substr(LINE,i,1) != " " ) { i=i-1; if (i==0) {break;} } | ||
68 | print substr(LINE,0,i) "\\"; | ||
69 | REST=substr(LINE,i+1); | ||
70 | if ( length(REST) == 0 ) { next ; } | ||
71 | LINE=" " REST; | ||
72 | } | ||
73 | if ( length(LINE) > 0 ) { print LINE; next ; } | ||
74 | } | ||
75 | { print;}' | ||
76 | echo "</programlisting>" | ||
77 | } | ||
78 | |||
79 | extractcmds_for_type() { # target/README BOOTorBUILD | ||
80 | README=s_targets/"$1" | ||
81 | CMDTYPE="$2" | ||
82 | COMMANDSFOR=`egrep "___$CMDTYPE:" $README` | ||
83 | for CMDS in $COMMANDSFOR | ||
84 | do | ||
85 | cmdsfor=`echo "$CMDS" | sed 's/[^:]*://'` | ||
86 | echo " <para>$CMDTYPE for $cmdsfor</para>" | ||
87 | cat "$README" | sed -n "/$COMMANDSFOR/,/___END/p" | extractcmds_filter | ||
88 | done | ||
89 | } | ||
90 | |||
91 | for targetreadme in $TARGETREADMES | ||
92 | do | ||
93 | TARGET=`dirname $targetreadme` | ||
94 | echo "" >>$BBXML | ||
95 | echo " <section id=\"target_$TARGET\">" >>$BBXML | ||
96 | echo " <title>Target $TARGET - Build and Boot Instructions</title>" >>$BBXML | ||
97 | echo " <remark>NOTE: DO NOT EDIT THIS GENERATED FILE! Only edit the template file.</remark>" >>$BBXML | ||
98 | echo " <section>" >>$BBXML | ||
99 | echo " <title>Build Instructions</title>" >>$BBXML | ||
100 | extractcmds_for_type $targetreadme Build-command >>$BBXML | ||
101 | echo " </section>" >>$BBXML | ||
102 | echo "" >>$BBXML | ||
103 | echo " <section>" >>$BBXML | ||
104 | echo " <title>Boot Instructions</title>" >>$BBXML | ||
105 | extractcmds_for_type $targetreadme Boot-command >>$BBXML | ||
106 | echo " </section>" >>$BBXML | ||
107 | echo " </section>" >>$BBXML | ||
108 | done | ||
109 | |||
110 | echo "</chapter>" >>$BBXML | ||
111 | echo "Ready created $BBXML" | ||