Skip to content
Snippets Groups Projects
Commit a88073f0 authored by Walter Lozano's avatar Walter Lozano
Browse files

Rework keyring check to support busybox cmp


Apertis uses busybox cmp which lacks of long options in general and does not
support --bytes. Under this circumstances rework its use to avoid these
limitations.

Signed-off-by: default avatarWalter Lozano <walter.lozano@collabora.com>
parent 30f41c6e
No related branches found
No related tags found
3 merge requests!51Merge changes from apertis/v2022-updates into apertis/v2022,!49Merge changes from v2023dev3,!47T8146: Rework keyring check to support busybox cmp
......@@ -325,16 +325,20 @@ is_supported_keyring() {
local FILEEXT="${1##*.}"
if [ "$FILEEXT" = 'gpg' ]; then
# 0x98, 0x99 and 0xC6 via octal as hex isn't supported by dashs printf
if printf '\231' | cmp --silent --bytes=1 - "$1"; then
local BYTE_TMP_FILE=$(mktemp)
head -c 1 "$1" > "$BYTE_TMP_FILE"
if printf '\231' | cmp -s - "$BYTE_TMP_FILE"; then
true
elif printf '\230' | cmp --silent --bytes=1 - "$1"; then
elif printf '\230' | cmp -s - "$BYTE_TMP_FILE"; then
true
elif printf '\306' | cmp --silent --bytes=1 - "$1"; then
elif printf '\306' | cmp -s - "$BYTE_TMP_FILE"; then
true
else
apt_warn "The key(s) in the keyring $1 are ignored as the file has an unsupported filetype."
rm "$BYTE_TMP_FILE"
return 1
fi
rm "$BYTE_TMP_FILE"
elif [ "$FILEEXT" = 'asc' ]; then
true #dearmor_filename will deal with them
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment