Merge pull request #153095 from Madouura/dev/bcachefs-init

nixos/stage-1: colon-separated multi-device support

authored by Janne Heß and committed by GitHub 45048dfd 85459d00

+22 -17
+22 -17
nixos/modules/system/boot/stage-1-init.sh
··· 81 touch /etc/udev/hwdb.bin # to shut up udev 82 touch /etc/initrd-release 83 84 - # Function for waiting a device to appear. 85 waitDevice() { 86 local device="$1" 87 88 # USB storage devices tend to appear with some delay. It would be 89 # great if we had a way to synchronously wait for them, but 90 # alas... So just wait for a few seconds for the device to 91 # appear. 92 - if test ! -e $device; then 93 - echo -n "waiting for device $device to appear..." 94 - try=20 95 - while [ $try -gt 0 ]; do 96 - sleep 1 97 - # also re-try lvm activation now that new block devices might have appeared 98 - lvm vgchange -ay 99 - # and tell udev to create nodes for the new LVs 100 - udevadm trigger --action=add 101 - if test -e $device; then break; fi 102 - echo -n "." 103 - try=$((try - 1)) 104 - done 105 - echo 106 - [ $try -ne 0 ] 107 - fi 108 } 109 110 # Mount special file systems.
··· 81 touch /etc/udev/hwdb.bin # to shut up udev 82 touch /etc/initrd-release 83 84 + # Function for waiting for device(s) to appear. 85 waitDevice() { 86 local device="$1" 87 + # Split device string using ':' as a delimiter as bcachefs 88 + # uses this for multi-device filesystems, i.e. /dev/sda1:/dev/sda2:/dev/sda3 89 + local IFS=':' 90 91 # USB storage devices tend to appear with some delay. It would be 92 # great if we had a way to synchronously wait for them, but 93 # alas... So just wait for a few seconds for the device to 94 # appear. 95 + for dev in $device; do 96 + if test ! -e $dev; then 97 + echo -n "waiting for device $dev to appear..." 98 + try=20 99 + while [ $try -gt 0 ]; do 100 + sleep 1 101 + # also re-try lvm activation now that new block devices might have appeared 102 + lvm vgchange -ay 103 + # and tell udev to create nodes for the new LVs 104 + udevadm trigger --action=add 105 + if test -e $dev; then break; fi 106 + echo -n "." 107 + try=$((try - 1)) 108 + done 109 + echo 110 + [ $try -ne 0 ] 111 + fi 112 + done 113 } 114 115 # Mount special file systems.