mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 19:46:31 +01:00
fix(payload-import): remove mount(8) dependency and import by kernel-enumerated block devices via /proc/partitions
This commit is contained in:
parent
45ba6a367d
commit
6b37393704
2 changed files with 170 additions and 54 deletions
|
|
@ -7,41 +7,8 @@ set -ex
|
|||
|
||||
if [ "${PAYLOAD_REQUIRED}" = True ]; then
|
||||
mkdir -p /external/distfiles
|
||||
mkdir -p /proc
|
||||
|
||||
# Reliable enumeration in Fiwix: mount procfs and read /proc/partitions.
|
||||
if [ ! -r /proc/partitions ]; then
|
||||
mount -t proc proc /proc
|
||||
fi
|
||||
if [ ! -r /proc/partitions ]; then
|
||||
echo "payload-import failed: /proc/partitions is unavailable." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
found_payload=0
|
||||
while read -r major minor blocks name; do
|
||||
case "${name}" in
|
||||
""|name|ram*|loop*|fd*|sr*|md*|dm-*|nbd*)
|
||||
continue
|
||||
;;
|
||||
*[0-9])
|
||||
# Skip partitions (hda1, sdb2, ...); payload is a whole disk.
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
dev_path="/dev/${name}"
|
||||
[ -b "${dev_path}" ] || mknod -m 600 "${dev_path}" b "${major}" "${minor}"
|
||||
|
||||
if payload-import --probe "${dev_path}"; then
|
||||
payload-import --device "${dev_path}" /external/distfiles
|
||||
found_payload=1
|
||||
break
|
||||
fi
|
||||
done < /proc/partitions
|
||||
|
||||
if [ "${found_payload}" != 1 ]; then
|
||||
echo "payload-import failed: no payload image found in /proc/partitions." >&2
|
||||
if ! payload-import /external/distfiles; then
|
||||
echo "payload-import failed: no payload image found on block devices." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue