From 078b04f4d74d498b8ae16d9429ceedc765ca06a1 Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Thu, 7 Nov 2024 16:53:54 +0800 Subject: [PATCH] get os version and os id --- 0073-get-os-version-and-os-id.patch | 42 +++++++++++++++++++++++++++++ migration-tools.spec | 7 +++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 0073-get-os-version-and-os-id.patch diff --git a/0073-get-os-version-and-os-id.patch b/0073-get-os-version-and-os-id.patch new file mode 100644 index 0000000..73de032 --- /dev/null +++ b/0073-get-os-version-and-os-id.patch @@ -0,0 +1,42 @@ +From e5178a05c2a6a2032e1db5a5d2329b8b63862dcc Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Mon, 13 Nov 2023 13:57:59 +0800 +Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=B3=BB=E7=BB=9F=E7=89=88?= + =?UTF-8?q?=E6=9C=AC=E5=92=8C=E7=B3=BB=E7=BB=9FID?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/Abisystmcompchk.py | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py +index f402a74..913fef1 100644 +--- a/sysmig_agent/Abisystmcompchk.py ++++ b/sysmig_agent/Abisystmcompchk.py +@@ -528,3 +528,21 @@ def incomp_pkg_num(): + tmp = line.split(',')[0] + return num + ++ ++def system_version_id(): ++ fp = open('/etc/os-release', 'r') ++ for line in fp: ++ if 'VERSION_ID' in line: ++ break ++ fp.close() ++ return line.split('=', 1)[1].replace('"', '').replace('\n', '') ++ ++ ++def get_cur_sys_version(): ++ fp = open('/etc/os-release', 'r') ++ for line in fp: ++ if 'PRETTY_NAME' in line: ++ break ++ fp.close() ++ return line.split('=', 1)[1].replace('"', '').replace('\n', '') ++ +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index 9bb53c3..f927754 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 72 +Release: 73 License: MulanPSL-2.0 Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system Source0: %{name}-%{version}.tar.gz @@ -79,7 +79,7 @@ Patch69: 0069-get-package-list-downloaded-locally-from-the-software-repositor Patch70: 0070-interface-for-obtaining-repo-interface.patch Patch71: 0071-get-package-list-from-repository.patch Patch72: 0072-count-the-total-number-of-abi-compatible-lists.patch - +Patch73: 0073-get-os-version-and-os-id.patch BuildArch: noarch @@ -179,6 +179,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Tue Nov 5 2024 xuezhixin - 1.0.2-73 +- 0073-get-os-version-and-os-id.patch + * Tue Nov 5 2024 xuezhixin - 1.0.2-72 - 0072-count-the-total-number-of-abi-compatible-lists.patch -- Gitee