summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2023-11-02 10:09:01 +0100
committercos <cos>2023-11-02 10:16:22 +0100
commit24d96791c318c39b4c6d7c6bdf5b66059541a4da (patch)
tree153abb0d4576ad7c7c4b6ebf4b9842eb60c5ce2d
parent30b064a0d8951f3e14fa00cd5b06c0e4e58488d4 (diff)
downloadvim-preseed-24d96791c318c39b4c6d7c6bdf5b66059541a4da.zip
Adapt to findings from preseed.debian.net
* Comment on questions not meeting the syntax. * Add period `.` as allowed character when matching fields, as those are actively used in question namnes. After fetching all files from preseed.debian.net, the following: ``` cat **/* | sed -n 's/#\s*d-i\s*\([^ ]\+\).*/\1/p' | grep -v '^\([[:alnum:]._-]\+/\)\+[[:alnum:]._-]\+$' ``` returns only the documented anomaly.
-rw-r--r--syntax/preseed.vim37
1 files changed, 27 insertions, 10 deletions
diff --git a/syntax/preseed.vim b/syntax/preseed.vim
index d716866..4690280 100644
--- a/syntax/preseed.vim
+++ b/syntax/preseed.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Debian preseed
" Maintainer: cos <cos>, https://www.netizen.se/#contact
-" Last Change: 2023 Oct 15
+" Last Change: 2023 Nov 2
" Remark: https://wiki.debian.org/DebianInstaller/Preseed
" quit when a syntax file was already loaded
@@ -9,11 +9,28 @@ if exists('b:current_syntax')
finish
endif
-
" The syntax of each line in a preseed file follows:
" <owner> <question name> <question type> <value>
-
-" Create clusters for two of these four parts of a preseed line.
+" Lets sloppily refer to them as columns.
+
+" Out in the wild, there appears to be two preseed questions which fail to
+" match the syntax rules. According to preseed.debian.net, these two are:
+"
+" debian-installer/shell-plugin and sitesummary-client/nagios-server
+"
+" The first one takes the `terminal` question type (rather than `boolean`,
+" `string`, `password`, `select`, `multiselect` or `note`). Attempting to ask
+" about this on #debian-boot gave the classic (non-)warm welcoming from one of
+" the regulars there. That person claimed to have investigated the issue and
+" stated that it is correct as it is. Followed up with a polite but clear
+" instruction to shut-up.
+"
+" The second one is described as an internal hidden debconf question, and has
+" 'db_get' injected between the owner and the question name fields. That could
+" either be a clever hack or a bug. No investigation has been done to figure
+" out which.
+
+" Create clusters for two of these four columns of a preseed line.
syntax cluster preseedSecond contains=preseedQuestion,preseedOwnerLC
syntax cluster preseedThird contains=preseedBooleanType,preseedStrLikeType,preseedMultiSelType,preseedNote,preseedSelectType,preseedQuestionLC
@@ -21,20 +38,20 @@ syntax cluster preseedThird contains=preseedBooleanType,preseedStrLikeType,prese
" Define the highlighting. Doesn't map perfectly to the group's intents, but
" arguably close enough?
-" First, <owner>
+" First column, <owner>
hi! def link preseedOwner Label
-" Second, <question name>
+" Second column, <question name>
hi! def link preseedQuestion Identifier
-" Third, <question type>
+" Third column, <question type>
hi! def link preseedBooleanType Type
hi! def link preseedMultiSelType Type
hi! def link preseedNote Type
hi! def link preseedSelectType Type
hi! def link preseedStrLikeType Type
-" Fourth, <value>
+" Fourth column, <value>
hi! def link preseedBooleanVal Special
hi! def link preseedMultiSelVal Special
hi! def link preseedStrLikeVal String
@@ -54,10 +71,10 @@ hi! def link preseedStrLikeLC Operator
" Add the syntax matching rules.
" First, <owner>
-sy match preseedOwner /^\s*[[:alnum:]_-]\+\(\s\|$\)/ nextgroup=@preseedSecond,preseedOwnerLC
+sy match preseedOwner /^\s*[[:alnum:]._-]\+\(\s\|$\)/ nextgroup=@preseedSecond,preseedOwnerLC
" Second, <question name>
-sy match preseedQuestion contained "\s*\([[:alnum:]_-]\+/\)\+[[:alnum:]_-]\+\(\s\|$\)" nextgroup=@preseedThird,preseedQuestionLC
+sy match preseedQuestion contained "\s*\([[:alnum:]._-]\+/\)\+[[:alnum:]._-]\+\(\s\|$\)" nextgroup=@preseedThird,preseedQuestionLC
" Third, <question type>
" (boolean, multiselect, note, password, select, string)