update to version 1.2-1

This commit is contained in:
zhangqiumiao 2022-04-08 17:46:54 +08:00 committed by Qiumiao Zhang
parent e22a3fca64
commit c7ccc82b47
4 changed files with 9 additions and 111 deletions

View File

@ -1,106 +0,0 @@
From 3c30d35cf23b7c7fd15877d832b4052aa632409b Mon Sep 17 00:00:00 2001
From: Qiumiao Zhang <zhangqiumiao1@huawei.com>
Date: Sat, 19 Mar 2022 04:16:51 -0400
Subject: [PATCH] get SI_GRUB2_PATH by ID in /etc/os-release
---
usr/Euler/project/install/setupOS.sh | 33 +++++++++++++++++++---------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/usr/Euler/project/install/setupOS.sh b/usr/Euler/project/install/setupOS.sh
index 66b263d..fdbf17c 100644
--- a/usr/Euler/project/install/setupOS.sh
+++ b/usr/Euler/project/install/setupOS.sh
@@ -46,6 +46,11 @@ export SI_SYSTEMMAP
MENU_VERSION=
export MENU_VERSION
+#/etc/os-release in OS
+SI_OS_RELEASE=/etc/os-release
+OS_NAME=
+VENDOR=
+
#OS.tar.gz包解压次数
SI_UNCOMPRESS_TIME=1
@@ -60,11 +65,7 @@ SI_GRUB_PATH=/boot/grub
GRUB_DIR=/usr/lib/grub
GRUB2_DIR=/usr/lib/grub2
-if [ ${EFI_FLAG} -eq 1 ]; then
- SI_GRUB2_PATH=/boot/efi/EFI/openEuler
-else
- SI_GRUB2_PATH=/boot/grub2
-fi
+SI_GRUB2_PATH=
GRUB2_EFI=EFI/grub2
GRUB2_CMD="`which grub2-install`"
@@ -113,6 +114,11 @@ function SetupOS_ParserSdf()
return 1
fi
+ if [ ! -f "${SI_OS_RELEASE}" ]; then
+ g_LOG_Error "the ${SI_OS_RELEASE} is not exist."
+ return 1
+ fi
+
SI_OSTARNAME="`INIT_Get_CmdLineParamValue 'name' ${SI_OS_PACKAGE_SDF}`"
SI_VERSION="`INIT_Get_CmdLineParamValue 'kernelversion' ${SI_OS_PACKAGE_SDF}`"
LOCAL_SI_VERSION="`INIT_Get_CmdLineParamValue 'localversion' ${SI_OS_PACKAGE_SDF}`"
@@ -120,12 +126,13 @@ function SetupOS_ParserSdf()
euler_version="`INIT_Get_CmdLineParamValue 'eulerversion' ${SI_OS_PACKAGE_SDF}`"
os_version="`INIT_Get_CmdLineParamValue 'os_version' ${SI_OS_PACKAGE_SDF}`"
+ OS_NAME="`INIT_Get_CmdLineParamValue 'NAME' ${SI_OS_RELEASE} | sed 's/\"//g'`"
if [ ! -z "${euler_version}" ]; then
MENU_VERSION=${euler_version}
elif [ ! -z "${os_version}" ]; then
MENU_VERSION=${os_version}
else
- MENU_VERSION="openEuler"
+ MENU_VERSION=${OS_NAME}
fi
if [ -z "$LOCAL_SI_VERSION" ]; then
@@ -596,7 +603,7 @@ function SetupOS_Grub2Install()
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
fi
- slot_id=`efibootmgr | grep -w "openEuler Linux" | awk -F "*" '{print $1}' | awk -F "Boot" '{print $2}'`
+ slot_id=`efibootmgr | grep -w "${OS_NAME}" | awk -F "*" '{print $1}' | awk -F "Boot" '{print $2}'`
if [ ! -z "${slot_id}" ]; then
efibootmgr -b ${slot_id} -B
fi
@@ -607,12 +614,12 @@ function SetupOS_Grub2Install()
g_LOG_Debug "boot partition name is "${boot_devname}", boot partition id is "${boot_partition_id}""
if [ "${arch}" = "aarch64" ]; then
- efibootmgr -q -c -d ${SI_DISK} -p ${boot_partition_id} -w -L 'openEuler Linux' -l '\EFI\openEuler\grubaa64.efi'
+ efibootmgr -q -c -d ${SI_DISK} -p ${boot_partition_id} -w -L "${OS_NAME}" -l "\EFI\\${VENDOR}\grubaa64.efi"
else
if [ "x${BOOT_ESP}" = "xtrue" ]; then
- efibootmgr -q -c -d ${SI_DISK} -p ${boot_partition_id} -w -L 'openEuler Linux' -l '\efi\EFI\openEuler\grubx64.efi'
+ efibootmgr -q -c -d ${SI_DISK} -p ${boot_partition_id} -w -L "${OS_NAME}" -l "\efi\EFI\\${VENDOR}\grubx64.efi"
else
- efibootmgr -q -c -d ${SI_DISK} -p ${boot_partition_id} -w -L 'openEuler Linux' -l '\EFI\openEuler\grubx64.efi'
+ efibootmgr -q -c -d ${SI_DISK} -p ${boot_partition_id} -w -L "${OS_NAME}" -l "\EFI\\${VENDOR}\grubx64.efi"
fi
fi
if [ $? -ne 0 ]; then
@@ -1010,6 +1017,12 @@ function SetupOS_Install()
if [ -f "${GRUB2_CMD}" ]; then
#安装grub2#
g_LOG_Info "${GRUB2_CMD} exist,install grub2 start."
+ VENDOR="`INIT_Get_CmdLineParamValue 'ID' ${SI_OS_RELEASE} | sed 's/\"//g'`"
+ if [ ${EFI_FLAG} -eq 1 ]; then
+ SI_GRUB2_PATH=/boot/efi/EFI/${VENDOR}
+ else
+ SI_GRUB2_PATH=/boot/grub2
+ fi
SetupOS_Grub2Install
if [ $? -ne 0 ]; then
g_LOG_Error "Install grub2 failed."
--
2.19.1

Binary file not shown.

BIN
install-scripts-1.2.tar.gz Normal file

Binary file not shown.

View File

@ -2,11 +2,9 @@ Name: install-scripts
Summary: scripts for system installation
Group: Applications/System
License: Mulan PSL v2
Version: 1.1
Release: 2
SOURCE0: %{name}-%{version}.tar.bz2
Patch0001: 0001-get-SI_GRUB2_PATH-by-ID-in-etc-os-release.patch
Version: 1.2
Release: 1
SOURCE0: %{name}-%{version}.tar.gz
Requires: kernel
BuildRequires: dos2unix coreutils findutils
@ -102,6 +100,12 @@ rm -rf %{_tmppath}/%{name}-%{version}
rm -rf $RPM_BUILD_DIR/%{name}-%{version}
%changelog
* Fri Apr 8 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 1.2-1
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:update to version 1.2-1
* Fri Mar 18 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 1.1-2
- Type:bugfix
- CVE:NA