update-ca-trust: return errors on a unsupported argument

Resolves: RHEL-50293

update-ca-trust: return error on a unsupported argument
This commit is contained in:
Frantisek Krenzelok 2024-08-19 12:02:07 +02:00
parent 3941eed963
commit 59744b459d
2 changed files with 16 additions and 9 deletions

View File

@ -445,6 +445,9 @@ fi
%ghost %{catrustdir}/extracted/pem/directory-hash/ca-certificates.crt %ghost %{catrustdir}/extracted/pem/directory-hash/ca-certificates.crt
%changelog %changelog
*Tue Aug 27 2024 Frantisek Krenzelok <fkrenzel@redhat.com> - 2024.2.69_v8.0.303-101.1
- update-ca-trust: return warnings on a unsupported argument instead of error
*Tue Aug 27 2024 Frantisek Krenzelok <fkrenzel@redhat.com> - 2024.2.69_v8.0.303-101.1 *Tue Aug 27 2024 Frantisek Krenzelok <fkrenzel@redhat.com> - 2024.2.69_v8.0.303-101.1
- Temporarily generate the directory-hash files in %%install ...(next item) - Temporarily generate the directory-hash files in %%install ...(next item)
- Add list of ghost files from directory-hash to %%files - Add list of ghost files from directory-hash to %%files

22
update-ca-trust Normal file → Executable file
View File

@ -19,7 +19,7 @@ usage() {
Update the system trust store in $DEST. Update the system trust store in $DEST.
COMMANDS COMMANDS
(absent/empty command): Same as the extract command described below. (absent/empty command): Same as the extract command without arguments.
extract: Instruct update-ca-trust to scan the source configuration in extract: Instruct update-ca-trust to scan the source configuration in
/usr/share/pki/ca-trust-source and /etc/pki/ca-trust/source and produce /usr/share/pki/ca-trust-source and /etc/pki/ca-trust/source and produce
@ -42,6 +42,11 @@ extract() {
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case "$1" in case "$1" in
"-o"|"--output") "-o"|"--output")
if [ $# -lt 2 ]; then
echo >&2 "Error: missing argument for '$1' option. See 'update-ca-trust --help' for usage."
echo >&2
exit 1
fi
USER_DEST=$2 USER_DEST=$2
shift 2 shift 2
continue continue
@ -51,7 +56,7 @@ extract() {
break break
;; ;;
*) *)
usage echo >&2 "Error: unknown extract argument '$1'. See 'update-ca-trust --help' for usage."
exit 1 exit 1
;; ;;
esac esac
@ -98,6 +103,7 @@ extract() {
/usr/bin/chmod u-w "$DEST/pem/directory-hash" /usr/bin/chmod u-w "$DEST/pem/directory-hash"
fi fi
} }
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
set -- extract set -- extract
fi fi
@ -105,16 +111,14 @@ fi
case "$1" in case "$1" in
"extract") "extract")
shift shift
extract $@ extract "$@"
;; ;;
"--"*|"-"*) "--help")
# First parameter seems to be an option, assume the command is 'extract' usage
extract $@ exit 0
;; ;;
*) *)
echo >&2 "Error: Unknown command: $1" echo >&2 "Error: unknown command: '$1', see 'update-ca-trust --help' for usage."
echo >&2
usage
exit 1 exit 1
;; ;;
esac esac