| 1 | #!/bin/sh -eu |
| 2 | |
| 3 | temp="$(mktemp)" |
| 4 | trap 'rm -f "$temp"' EXIT |
| 5 | |
| 6 | # Copy everything above the existing flag checks. |
| 7 | sed -rne '/^ +_check /q; p' \ |
| 8 | < debian/templates/image.bug/include-1tainted >"$temp" |
| 9 | |
| 10 | # Generate flag checks from the table in tainted-kernels.rst. We |
| 11 | # could alternatively extract them from sysctl/kernel.rst or in the C |
| 12 | # sources, but this is easy to find and parse and is likely to have |
| 13 | # the most useful descriptions. |
| 14 | sed -rne '/^Bit +Log +Number +Reason/,/^$/ { |
| 15 | s/^ *([0-9]+) +.\/(.) +[0-9]+ +(.*)/ _check \1 \2 '\''\3'\''/p |
| 16 | }' \ |
| 17 | < Documentation/admin-guide/tainted-kernels.rst >>"$temp" |
| 18 | |
| 19 | # Copy everything below the existing flag checks. |
| 20 | sed -rne '/^ +echo "\*\* Tainted:/,$p' \ |
| 21 | < debian/templates/image.bug/include-1tainted >>"$temp" |
| 22 | |
| 23 | # Update the bug script in-place. |
| 24 | cp "$temp" debian/templates/image.bug/include-1tainted |