aboutgitcode
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-04-26 12:01:06 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-04-26 08:12:18 +0200
commited330eb79b75914b741f28679e724267ad2523df (patch)
tree7d88dd49130f01e5c4323d4836eb3258e8424122
parent9833a346d422acdfcd5a2a68cd184a884e33c025 (diff)
downloadmbuto-ed330eb79b75914b741f28679e724267ad2523df.tar
mbuto-ed330eb79b75914b741f28679e724267ad2523df.tar.gz
mbuto-ed330eb79b75914b741f28679e724267ad2523df.tar.bz2
mbuto-ed330eb79b75914b741f28679e724267ad2523df.tar.lz
mbuto-ed330eb79b75914b741f28679e724267ad2523df.tar.xz
mbuto-ed330eb79b75914b741f28679e724267ad2523df.tar.zst
mbuto-ed330eb79b75914b741f28679e724267ad2523df.zip
Remove stale archivemount support
mbuto has two ways of building the initramfs. One is the typical approach of staging its contents in a temporary directory, then building the initramfs with cpio. The other is to create an empty initramfs, mount it with archivemount, and copy things into the mounted archive. However, the archivemount approach is broken. I'm not entirely sure why, but it appears not to properly unmount the archive and retrieve the final. filled version. The upshot is that if archivemount is installed, then mbuto generates an empty, gzip-compressed initramfs instead of whatever it was supposed to. It appears the archivemount approach was there to allow some later changes to the archive without re-running mbuto. However, it's essentially impossible to use this safely - if archivemount still has the archive open for writing, it's not safe to read it concurrently. This appears to have worked by accident with some earlier versions, but doesn't work now. Just remove the archivemount approach entirely. Reported-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-xmbuto41
1 files changed, 5 insertions, 36 deletions
diff --git a/mbuto b/mbuto
index a6f80ab..49d032c 100755
--- a/mbuto
+++ b/mbuto
@@ -368,7 +368,6 @@ cmd_check() {
# cleanup() - Remove left-overs on exit, used from trap
cleanup() {
- [ -n "${ARCHIVEMOUNT}" ] && "${UMOUNT}" "${wd}" 2>/dev/null
"${RM}" -rf "${wd}"
[ -n "${pkg_tmp}" ] && "${RM}" -f "${pkg_tmp}"
[ -n "${compress_test1}" ] && "${RM}" -f "${compress_test1}"
@@ -564,16 +563,6 @@ cpio_init() {
else
OUT="$("${REALPATH}" "${OUT}")"
fi
-
- if [ -n "${ARCHIVEMOUNT}" ]; then
- : | "${CPIO}" --create -H newc --quiet | \
- "${GZIP}" > "${OUT}"
- fi
- fi
-
- if [ -n "${ARCHIVEMOUNT}" ]; then
- "${ARCHIVEMOUNT}" "${OUT}" "${wd}"
- info "Mounted CPIO archive ${OUT} at ${wd}"
fi
}
@@ -1099,26 +1088,17 @@ cmds() {
[ "${NOSTRIP}" != "y" ] && strip_all
- if [ -z "${ARCHIVEMOUNT}" ]; then
- ( __out="$("${REALPATH}" "${OUT}")"
- "${CD}" "${wd}"
- "${FIND}" . | "${CPIO}" --create -H newc --quiet > "${OUT}"
- cpio_compress "${__out}"
- )
- else
- "${SYNC}"
- fi
+ ( __out="$("${REALPATH}" "${OUT}")"
+ "${CD}" "${wd}"
+ "${FIND}" . | "${CPIO}" --create -H newc --quiet > "${OUT}"
+ cpio_compress "${__out}"
+ )
stats
printf "%s" "${OUTPUT}" | \
sed 's,__INITRD__,'"$("${REALPATH}" "${OUT}")"',g' | \
sed 's,__KERNEL__,/boot/vmlinuz-'"${KERNEL}"',g'
-
- if [ -n "${ARCHIVEMOUNT}" ]; then
- trap - EXIT
- notice "initramfs mounted at: ${wd}"
- fi
}
# usage() - Print usage and exit
@@ -1271,17 +1251,6 @@ else
eval "profile_${PROFILE}" || err "profile ${PROFILE} not found"
fi
-# Check if we can keep the CPIO mounted for convenience as we exit. This isn't
-# safe with fakeroot, as contents can't be touched before the environment
-# save-file is loaded again, so it needs root (and archivemount).
-if [ "${LD_PRELOAD}" = "libfakeroot-sysv.so" ]; then
- if command -v archivemount >/dev/null 2>&1; then
- notice "Not running as root, won't keep cpio mounted"
- fi
-elif ! ARCHIVEMOUNT="$(command -v archivemount)"; then
- warn "archivemount not available, won't keep cpio mounted"
-fi
-
trap cleanup EXIT
cmds "$@"