make blkid optional

This commit is contained in:
illiliti 2020-07-15 22:23:12 +03:00
parent 8f3b68dd38
commit 888cf4d878
3 changed files with 19 additions and 12 deletions

View File

@ -11,7 +11,7 @@ Features
- Easy to use configuration
- Build time and init time hooks
- LUKS (detached header, key), LVM
- mdev, mdevd, eudev
- mdev, mdevd, eudev, systemd-udevd
Dependencies
------------
@ -20,10 +20,11 @@ Dependencies
* POSIX shell
* `switch_root`
* `mount`
* `blkid`
* `cpio`
* POSIX SD `strip`
* `strip`
- Optional
* `blkid`
- Required for UUID, LABEL, PARTUUID support
* `mdev` OR `mdevd` OR `eudev` OR `systemd-udevd`
- systemd-udevd not tested
* `lvm2`

View File

@ -18,6 +18,13 @@ create_symlink()
{
[ -b "/dev/${dev_name=${DEVPATH##*/}}" ] || exit 1
read -r dm_name < "/sys/block/${dev_name}/dm/name" && {
mkdir -p /dev/mapper
ln -sf "../${dev_name}" "/dev/mapper/${dm_name:?}"
}
command -v blkid || exit 0
# prevent race condition
blkid "/dev/${dev_name}" || sleep 2
@ -26,9 +33,4 @@ create_symlink()
LABEL) create_symlink /dev/disk/by-label "${line##*=}" ;;
PARTUUID) create_symlink /dev/disk/by-partuuid "${line##*=}" ;;
esac; done
read -r dm_name < "/sys/block/${dev_name}/dm/name" && {
mkdir -p /dev/mapper
ln -sf "../${dev_name}" "/dev/mapper/${dm_name:?}"
}
} > /dev/null 2>&1

View File

@ -126,16 +126,20 @@ prepare_initramfs()
ln -s ../run/lock "${tmpdir}/var/lock"
ln -s bin "${tmpdir}/usr/sbin"
# TODO make blkid optional
# copy required binaries
for _binary in \
\[ sh ln env kill mkdir \
blkid sleep mount printf \
switch_root "${srcdir}/device-helper"
\[ sh ln env kill mkdir sleep mount \
printf switch_root "${srcdir}/device-helper"
do
copy_binary "$_binary"
done
if command -v blkid; then
copy_binary blkid
else
print "blkid not found. you will unable to use UUID, LABEL, PARTUUID"
fi
# copy init
cp "${srcdir}/init" "${tmpdir}/init"
chmod 755 "${tmpdir}/init"