ITL: apt: render vars.apt_[dist_]upgrade=true as --[dist-]upgrade, not --[dist-]upgrade=true

but preserve vars.apt_[dist_]upgrade=-s as --[dist-]upgrade=-s.
This commit is contained in:
Alexander A. Klimov 2022-07-19 17:28:37 +02:00
parent 32c7f7730d
commit e4c22e3973
1 changed files with 31 additions and 8 deletions

View File

@ -1923,20 +1923,43 @@ object CheckCommand "apt" {
command = [ PluginDir + "/check_apt" ]
arguments = {
"--extra-opts" = {
value = "$apt_extra_opts$"
description = "Read options from an ini file."
}
// apt-get takes only options starting with "-" (like "-sqq") before
// the upgrade command, so passing e.g. "foobar" as "--upgrade=foobar"
// makes no sense. This allows to easily decide between "-x=-y"
// (strings starting with "-") and "-x" (everything else).
"--upgrade" = {
value = "$apt_upgrade$"
separator = "="
set_if = {{
var v = macro("$apt_upgrade$")
return match("-*", string(v).trim()) ? false : v
}}
description = "[Default] Perform an upgrade. If an optional OPTS argument is provided, apt-get will be run with these command line options instead of the default."
}
"--dist-upgrade" = {
value = "$apt_dist_upgrade$"
separator = "="
set_if = {{
var v = macro("$apt_dist_upgrade$")
return match("-*", string(v).trim()) ? false : v
}}
description = "Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS can be provided to override the default options."
}
"--upgrade=OPTS" = {
set_if = {{ match("-*", string(macro("$apt_upgrade$")).trim()) }}
key = "--upgrade"
separator = "="
value = "$apt_upgrade$"
description = "[Default] Perform an upgrade. If an optional OPTS argument is provided, apt-get will be run with these command line options instead of the default."
}
"--dist-upgrade=OPTS" = {
set_if = {{ match("-*", string(macro("$apt_dist_upgrade$")).trim()) }}
key = "--dist-upgrade"
separator = "="
value = "$apt_dist_upgrade$"
description = "Perform a dist-upgrade instead of normal upgrade. Like with -U OPTS can be provided to override the default options."
}
"--extra-opts" = {
value = "$apt_extra_opts$"
description = "Read options from an ini file."
}
"--include" = {
value = "$apt_include$"
description = "Include only packages matching REGEXP. Can be specified multiple times the values will be combined together."