bufix:OMPUB-1127:Read blk_dev depend on ONIE-BOOT install device

This commit is contained in:
fumingwei
2024-01-25 19:46:02 +08:00
committed by 付明卫
parent 6d67dbabf9
commit a4bb56f78a

View File

@@ -1,23 +1,13 @@
#!/bin/sh #!/bin/sh
read_blk_dev()
install_device_platform()
{ {
# Virtual IO block device kernel_name_descriptor=$(blkid | grep ONIE-BOOT | awk -F ":" '{print $1}' | awk -F "/" '{print $NF}')
if grep -q vda /proc/partitions ; then major_device_number=$(cat /proc/partitions | grep ${kernel_name_descriptor} | awk '{print $1}')
echo /dev/vda disk_device_name=$(cat /proc/partitions | awk -v major="$major_device_number" '$1 == major && $2 == "0" {print $4}')
return 0 echo "/dev/${disk_device_name}"
fi
# SATA, SCSI, USB block device
if grep -q sda /proc/partitions ; then
echo /dev/sda
return 0
fi
echo /dev/sda
} }
blk_dev=$(install_device_platform) blk_dev=$(read_blk_dev)
echo "TSG-OS install on ${blk_dev}" echo "TSG-OS install on ${blk_dev}"
random_dev=/dev/urandom random_dev=/dev/urandom
root_disk=hd0 root_disk=hd0