Skip to content

Commit cfed1b4

Browse files
tabrisnetigorpecovnik
authored andcommitted
framework mmdebstrap fetch_distro_keyring - ignore dpkg-deb/tar non-essential errors
1 parent 0551162 commit cfed1b4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/functions/rootfs/distro-specific.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ function fetch_distro_keyring() {
113113
run_host_command_logged curl "${PROXY[@]}" -fLOJ --output-dir "${CACHEDIR}" "${PKG_URL}" || \
114114
exit_with_error "fetch_distro_keyring failed" "unable to download ${PKG_URL}"
115115
KEYRING_DEB=$(basename "${PKG_URL}")
116-
dpkg-deb -x "${CACHEDIR}/${KEYRING_DEB}" "${CACHEDIR}" || \
117-
exit_with_error "fetch_distro_keyring" "dpkg-deb -x ${CACHEDIR}/${KEYRING_DEB} failed"
116+
# We ignore the failures of unpacking b/c we cannot tell the difference between unpack failures and chmod/chgrp failures
117+
dpkg-deb -x "${CACHEDIR}/${KEYRING_DEB}" "${CACHEDIR}" || /bin/true # ignore failures, we'll check a few lines down
118118
if [[ -e "${CACHEDIR}/usr/share/keyrings/debian-archive-keyring.pgp" ]]; then
119119
# yes, for 2025.1, the canonical name is .pgp, but our tools expect .gpg.
120120
# the package contains the .pgp and a .gpg symlink to it.
@@ -131,8 +131,7 @@ function fetch_distro_keyring() {
131131
run_host_command_logged curl "${PROXY[@]}" -fLOJ --output-dir "${CACHEDIR}" "${PKG_URL}" || \
132132
exit_with_error "fetch_distro_keyring failed" "unable to download ${PKG_URL}"
133133
KEYRING_DEB=$(basename "${PKG_URL}")
134-
dpkg-deb -x "${CACHEDIR}/${KEYRING_DEB}" "${CACHEDIR}" || \
135-
exit_with_error "fetch_distro_keyring" "dpkg-deb -x ${CACHEDIR}/${KEYRING_DEB} failed"
134+
dpkg-deb -x "${CACHEDIR}/${KEYRING_DEB}" "${CACHEDIR}" || /bin/true # see above about ignoring errors
136135
if [[ -e "${CACHEDIR}/usr/share/keyrings/debian-ports-archive-keyring.pgp" ]]; then
137136
# see above comment re .pgp vs .gpg
138137
cp -l "${CACHEDIR}/usr/share/keyrings/debian-ports-archive-keyring.pgp" "${CACHEDIR}/debian-ports-archive-keyring.gpg"
@@ -157,8 +156,10 @@ function fetch_distro_keyring() {
157156
run_host_command_logged curl "${PROXY[@]}" -fLOJ --output-dir "${CACHEDIR}" "${PKG_URL}" || \
158157
exit_with_error "fetch_distro_keyring failed" "unable to download ${PKG_URL}"
159158
KEYRING_DEB=$(basename "${PKG_URL}")
160-
dpkg-deb -x "${CACHEDIR}/${KEYRING_DEB}" "${CACHEDIR}" || \
161-
exit_with_error "fetch_distro_keyring" "dpkg-deb -x ${CACHEDIR}/${KEYRING_DEB} failed"
159+
dpkg-deb -x "${CACHEDIR}/${KEYRING_DEB}" "${CACHEDIR}" || /bin/true # see above in debian block about ignoring errors
160+
if [[ ! -e "${CACHEDIR}/usr/share/keyrings/ubuntu-archive-keyring.gpg" ]]; then
161+
exit_with_error "fetch_distro_keyring" "unable to find ubuntu-archive-keyring.gpg"
162+
fi
162163
cp -l "${CACHEDIR}/usr/share/keyrings/ubuntu-archive-keyring.gpg" "${CACHEDIR}/"
163164
display_alert "fetch_distro_keyring($release)" "extracted" "info"
164165
fi

0 commit comments

Comments
 (0)