加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-add-support-for-nvme-disk.patch 2.74 KB
一键复制 编辑 原始数据 按行查看 历史
zhangqiumiao 提交于 2022-06-23 11:43 . add support for nvme disk
From 9a79f592594de97520b38c8d09a8a36f7aabfcd2 Mon Sep 17 00:00:00 2001
From: Qiumiao Zhang <zhangqiumiao1@huawei.com>
Date: Thu, 23 Jun 2022 11:30:26 +0800
Subject: [PATCH] add support for nvme disk
---
usr/Euler/project/disk/hwcompatible.sh | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/usr/Euler/project/disk/hwcompatible.sh b/usr/Euler/project/disk/hwcompatible.sh
index 3b2da05..97f3b78 100644
--- a/usr/Euler/project/disk/hwcompatible.sh
+++ b/usr/Euler/project/disk/hwcompatible.sh
@@ -77,7 +77,11 @@ function DM_GetPartitionName()
echo "${disk_dev}p${partition_count}"
;;
*)
- echo "${disk_dev}${partition_count}"
+ if [[ ${disk_dev} == /dev/nvme* ]]; then
+ echo "${disk_dev}p${partition_count}"
+ else
+ echo "${disk_dev}${partition_count}"
+ fi
;;
esac
@@ -116,7 +120,11 @@ function DM_GetPartitionNumber()
echo "${partition_name}" | sed "s ${disk_dev}p "
;;
*)
- echo "${partition_name}" | sed "s ${disk_dev} "
+ if [[ ${disk_dev} == /dev/nvme* ]]; then
+ echo "${partition_name}" | sed "s ${disk_dev}p "
+ else
+ echo "${partition_name}" | sed "s ${disk_dev} "
+ fi
;;
esac
@@ -266,7 +274,11 @@ function DM_GetGrubInfo()
disk_dev="`hwinfo --disk --short | awk '{print $1}' | grep -w "${disk_dev}"`"
;;
*)
- disk_dev="`echo ${partition_info} | awk -F "/" '{print $NF}' | sed "s ${partition_id}$ "`"
+ if [[ ${partition_info} == */nvme* ]]; then
+ disk_dev="`echo ${partition_info} | awk -F "/" '{print $NF}' | sed "s p${partition_id}$ "`"
+ else
+ disk_dev="`echo ${partition_info} | awk -F "/" '{print $NF}' | sed "s ${partition_id}$ "`"
+ fi
harddisk_id="`echo ${disk_dev} | awk '{print substr($NF,length($NF),1)}'`"
command="`printf "%d" "'${harddisk_id}"` - `printf "%d" "'a"`"
disk_dev="`hwinfo --disk --short | awk '{print $1}' | grep -w "${disk_dev}"`"
@@ -282,7 +294,11 @@ function DM_GetGrubInfo()
command="`printf "%d" "'${harddisk_id}"` - `printf "%d" "'0"`"
;;
*)
- disk_dev="`echo ${partition_name} | sed "s ${partition_id}$ "`"
+ if [[ ${partition_name} == */nvme* ]]; then
+ disk_dev="`echo ${partition_name} | sed "s p${partition_id}$ "`"
+ else
+ disk_dev="`echo ${partition_name} | sed "s ${partition_id}$ "`"
+ fi
harddisk_id="`echo ${disk_dev} | awk -F "/" '{print substr($NF,length($NF),1)}'`"
command="`printf "%d" "'${harddisk_id}"` - `printf "%d" "'a"`"
;;
--
2.19.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化