summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2023-03-04 22:53:43 -0700
committerAaron Ball <nullspoon@oper.io>2023-03-04 22:53:43 -0700
commit6a4cfe33c524fc8653f8bf50554e8b31e96c8bf4 (patch)
treed22a0f3891abb0f5838972a3a756042bf720e4dd /init
parent2edd418c12164fbd5b854e9cf24c43ace94b9fb9 (diff)
downloadmkinitramfs-6a4cfe33c524fc8653f8bf50554e8b31e96c8bf4.tar.gz
mkinitramfs-6a4cfe33c524fc8653f8bf50554e8b31e96c8bf4.tar.xz
Remove requirement for blkid and cut commands
With the `/dev/disk` directory tree now filled out, we no longer need blkid and cut to determine device paths based on aliases such as partlabel or uuid. This also simplifies the code, using bash-native parameter expansion to cut substrings.
Diffstat (limited to 'init')
-rwxr-xr-xinit16
1 files changed, 6 insertions, 10 deletions
diff --git a/init b/init
index b221bb1..8330797 100755
--- a/init
+++ b/init
@@ -69,29 +69,25 @@ parse_cmdline() {
root=*)
if [ "${i:5:4}" == 'UUID' ]; then
# mount by uuid
- local uuid=$(echo ${i} | cut -d '=' -f 3)
- ROOTDEV="$(blkid -U ${uuid})"
+ ROOTDEV="/dev/disk/by-uuid/${i##*=}"
elif [ "${i:5:5}" == 'LABEL' ]; then
# mount by label
- local label=$(echo ${i} | cut -d '=' -f 3)
- ROOTDEV="$(blkid -L ${label})"
+ ROOTDEV=/dev/disk/by-partlabel/${i##*=}
else
# mount by dev
- ROOTDEV="$(echo ${i} | cut -d '=' -f 2)"
+ ROOTDEV="${i##*=}"
fi
;;
cryptroot=*)
if [ "${i:10:4}" == 'UUID' ]; then
# mount by uuid
- local uuid=$(echo ${i} | cut -d '=' -f 3)
- CRYPTROOT="$(blkid -U ${uuid})"
+ CRYPTROOT="/dev/disk/by-uuid/${i##*=}"
elif [ "${i:10:5}" == 'LABEL' ]; then
# mount by label
- local label=$(echo ${i} | cut -d '=' -f 3)
- CRYPTROOT="$(blkid -L ${label})"
+ CRYPTROOT=/dev/disk/by-partlabel/${i##*=}
else
# mount by dev
- CRYPTROOT="$(echo ${i} | cut -d '=' -f 2)"
+ CRYPTROOT="${i##*=}"
fi
;;
subvol=*)

Generated by cgit