summaryrefslogtreecommitdiff
path: root/build/preseed.awk
diff options
context:
space:
mode:
authorJoey Hess <joeyh@debian.org>2005-10-07 19:51:38 +0000
committerJoey Hess <joeyh@debian.org>2005-10-07 19:51:38 +0000
commit1ea73eea5ecc6a8ed901316049259aee737ee554 (patch)
tree03a077f0b1b1548f3c806bd1c5795964fba0fb52 /build/preseed.awk
downloadinstallation-guide-1ea73eea5ecc6a8ed901316049259aee737ee554.zip
move manual to top-level directory, split out of debian-installer package
Diffstat (limited to 'build/preseed.awk')
-rw-r--r--build/preseed.awk61
1 files changed, 61 insertions, 0 deletions
diff --git a/build/preseed.awk b/build/preseed.awk
new file mode 100644
index 000000000..1619865fe
--- /dev/null
+++ b/build/preseed.awk
@@ -0,0 +1,61 @@
+# Extract the preseeding example from appendix/example-preseed-*.xml.
+# During extraction "line continuations" - that were added for improved
+# readability - will be removed, rejoining the split lines.
+
+# If variable lckeep is passed with value "1", line continuations are
+# ignored, i.e. the lines in the example are not reformatted.
+
+BEGIN {
+ inexample="0"
+ inseq="0"
+ totline=""
+}
+
+# Ignore everything before the line opening the example
+# Note: this assumes that <informalexample><screen> is on one line
+/<informalexample.*><screen>/ {
+ inexample="1"
+ getline
+}
+
+# Ignore everything after the line closing the example
+# Note: this assumes that </screen></informalexample> is on one line
+/<\/screen><\/informalexample>/ {
+ inexample="0"
+}
+
+# Handling of lines not ending with a line continuation character
+! /\\[[:space:]]*$/ {
+ if ( inexample == "1" ) {
+ if ( lckeep == "1" ) {
+ print $0
+ } else {
+ if ( inseq == "1" ) {
+ sub(/^[[:space:]]*/, "")
+ sub(/^#[[:space:]]*/, "")
+ }
+ totline = totline $0
+
+ print totline
+ totline=""
+ inseq="0"
+ }
+ }
+}
+
+# Handling of lines ending with a line continuation character
+/\\[[:space:]]*$/ {
+ if ( inexample == "1" ) {
+ if ( lckeep == "1" ) {
+ print $0
+ } else {
+ if ( inseq == "1" ) {
+ sub(/^[[:space:]]*/, "")
+ sub(/^#[[:space:]]*/, "")
+ }
+ inseq="1"
+ gsub(/[[:space:]]*\\[[:space:]]*$/, " ")
+ totline = totline $0
+ }
+ }
+}