Skip to content

Commit 0be9c7e

Browse files
committed
Change error to a warning and fixup
This changes the error message to a warning and fixes up the user's mistake.
1 parent 66ee22a commit 0be9c7e

File tree

1 file changed

+58
-46
lines changed

1 file changed

+58
-46
lines changed

dom0-updates/qubes-dom0-update

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -58,56 +58,68 @@ FORCE_XEN_UPGRADE=
5858
REBOOT_REQUIRED=
5959
declare -A options_with_args
6060
options_with_args=(
61-
[--action]=
62-
[--advisory]=
63-
[--advisories]=
64-
[--bz]=
65-
[--bzs]=
66-
[--color]=
67-
[--comment]=
68-
[--cve]=
69-
[--cves]=
70-
[--debuglevel]=
71-
[--disableexcludes]=
72-
[--disableexcludepkgs]=
73-
[--disableplugin]=
74-
[--disablerepo]=
75-
[--downloaddir]=
76-
[--destdir]=
77-
[--errorlevel]=
78-
[--enableplugin]=
79-
[--enablerepo]=
80-
[--exclude]=
81-
[--excludepkgs]=
82-
[--forcearch]=
83-
[--installroot]=
84-
[--releasever]=
85-
[--repofrompath]=
86-
[--repo]=
87-
[--repoid]=
88-
[--rpmverbosity]=
89-
[--sec-severity]=
90-
[--secseverity]=
91-
[--setopt]=
61+
[action]=
62+
[advisory]=
63+
[advisories]=
64+
[bz]=
65+
[bzs]=
66+
[color]=
67+
[comment]=
68+
[cve]=
69+
[cves]=
70+
[debuglevel]=
71+
[disableexcludes]=
72+
[disableexcludepkgs]=
73+
[disableplugin]=
74+
[disablerepo]=
75+
[downloaddir]=
76+
[destdir]=
77+
[errorlevel]=
78+
[enableplugin]=
79+
[enablerepo]=
80+
[exclude]=
81+
[excludepkgs]=
82+
[forcearch]=
83+
[installroot]=
84+
[releasever]=
85+
[repofrompath]=
86+
[repo]=
87+
[repoid]=
88+
[rpmverbosity]=
89+
[sec-severity]=
90+
[secseverity]=
91+
[setopt]=
9292
)
9393

9494
# Filter out some dnf options and collect packages list
9595
while [ $# -gt 0 ]; do
96-
if [[ -v options_with_args["$1"] ]]; then
97-
if [[ "$#" -lt 2 ]]; then
98-
printf 'Missing argument to %s\n' "$1"
99-
else
100-
printf '%s %q must be passed as %s=%q\n' "$1" "$2" "$1" "$2"
101-
fi >&2
102-
exit 1
103-
elif [[ "$1" =~ ^-[^dexR]*[dexR]$ ]]; then
104-
if [[ "$#" -lt 2 ]]; then
105-
printf 'Missing argument to %q\n' "$1"
106-
else
107-
printf '%q %q must be written as %q%q\n' "$1" "$2" "$1" "$2"
108-
fi >&2
109-
exit 1
110-
fi
96+
case $1 in
97+
(--*)
98+
if [[ -v options_with_args["${1:2}"] ]]; then
99+
if [[ "$#" -lt 2 ]]; then
100+
printf 'Missing argument to %s\n' "$1"
101+
exit 1
102+
else
103+
printf 'WARNING: %s %q must be passed as %s=%q\n' "$1" "$2" "$1" "$2"
104+
printf 'This will be an error in a future version!\n'
105+
fi >&2
106+
set -- "$1=$2" "${@:3:$# - 2}"
107+
fi
108+
;;
109+
(-[!-]*)
110+
if [[ "$1" =~ ^-[^dexR]*[dexR]$ ]]; then
111+
if [[ "$#" -lt 2 ]]; then
112+
printf 'Missing argument to %q\n' "$1"
113+
exit 1
114+
else
115+
printf 'WARNING: %q %q must be written as %q%q\n' "$1" "$2" "$1" "$2"
116+
printf 'This will be an error in a future version!\n'
117+
fi >&2
118+
set -- "$1$2" "${@:3:$# - 2}"
119+
fi
120+
;;
121+
esac
122+
printf %q\\n "$1"
111123
case "$1" in
112124
--enablerepo=*|\
113125
--disablerepo=*)

0 commit comments

Comments
 (0)