Skip to content
Snippets Groups Projects

T8146: Rework keyring check to support busybox cmp

Merged Walter Lozano requested to merge wip/wlozano/cmp into apertis/v2023dev0
All threads resolved!
Files
2
+ 7
3
@@ -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
Loading