diff --git a/README.md b/README.md index 0456796..c17f62c 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/device-helper b/device-helper index 0ec8b2c..610f1a7 100755 --- a/device-helper +++ b/device-helper @@ -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 diff --git a/tinyramfs b/tinyramfs index 1b7aef2..32beccc 100755 --- a/tinyramfs +++ b/tinyramfs @@ -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"