initial logfile and tmpfile

This commit is contained in:
xuezhixin 2024-11-06 09:24:17 +08:00
parent 124d12b9de
commit 244eb3df08
2 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,54 @@
From ec2e4820e87b355faf0c3a92dc0b22ddb326b7b6 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 14:17:57 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E5=92=8C=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E5=88=9B=E5=BB=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/migration.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py
index 00b3c89..ef78ed8 100644
--- a/sysmig_agent/migration.py
+++ b/sysmig_agent/migration.py
@@ -171,3 +171,33 @@ def mig_kernel(kernel_version):
# loggen.debug('Can not download kernel .')
#log.err
return 1
+
+
+def init_log_dir():
+ if not os.path.isdir(PRE_MIG_DIR):
+ os.makedirs(PRE_MIG_DIR)
+ if not os.path.isdir(MIGRATION_KERNEL):
+ os.makedirs(MIGRATION_KERNEL)
+ if not os.path.isdir(MIGRATION_DIR):
+ os.makedirs(MIGRATION_DIR)
+ if not os.path.isdir(MIGRATION_DATA_RPMS_DIR):
+ os.makedirs(MIGRATION_DATA_RPMS_DIR)
+ if not os.path.exists(PROGRESS):
+ with open(PROGRESS,'w+') as fp:
+ fp.write(' ')
+ fp.close()
+ if not os.path.exists(MIGRATION_DATA_RPMS_3_INFO):
+ with open(MIGRATION_DATA_RPMS_3_INFO,'w+') as fp:
+ fp.write(' ')
+ fp.close()
+ if not os.path.exists(MIGRATION_LOG):
+ with open(MIGRATION_LOG,'w+') as fp:
+ fp.write(' ')
+ fp.close()
+ if not os.path.exists(PRE_MIG):
+ with open(PRE_MIG,'w+') as fp:
+ fp.write(' ')
+ fp.close()
+ migInit_porgress()
+
+
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 39
Release: 40
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
@ -46,7 +46,7 @@ Patch36: 0036-add-an-interface-to-obtain-kernel-information.patch
Patch37: 0037-add-subprocess-function-and-loggin.patch
Patch38: 0038-obtain-kernel-data.patch
Patch39: 0039-repository-file-choose-kernel-version-to-migration.patch
Patch40: 0040-intial-logfile-and-tmpfile.patch
BuildArch: noarch
BuildRequires: systemd
@ -145,6 +145,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-40
- 0040-intial-logfile-and-tmpfile.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-39
- 0039-repository-file-choose-kernel-version-to-migration.patch