120 lines
3.5 KiB
Diff
120 lines
3.5 KiB
Diff
From 8dbd8088e6895367eb09f3a01389a6ebe3ce9feb Mon Sep 17 00:00:00 2001
|
|
From: FanSheng Meng <mengfansheng@uniontech.com>
|
|
Date: Mon, 16 Oct 2023 14:07:46 +0800
|
|
Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BB=A3=E7=A0=81=E6=A0=BC?=
|
|
=?UTF-8?q?=E5=BC=8F?=
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
---
|
|
.../centos7/openeuler/centos72openeuler.py | 6 ++----
|
|
views/migration.py | 11 +++++++----
|
|
2 files changed, 9 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py b/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
|
index 05a444c..7ccdb44 100644
|
|
--- a/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
|
+++ b/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
|
@@ -28,7 +28,6 @@ def run_subprocess(cmd):
|
|
print(output) # Print the output to console
|
|
return output, process.returncode
|
|
except subprocess.CalledProcessError as e:
|
|
- #print(f"Command '{e.cmd}' failed with return code {e.returncode}.")
|
|
print(e.stderr) # Print the error output to console
|
|
return e.stderr, e.returncode
|
|
|
|
@@ -87,6 +86,7 @@ def add_boot_option():
|
|
except Exception as e:
|
|
print(e)
|
|
|
|
+
|
|
def swap_release(release):
|
|
tmp_dir = '/var/tmp'
|
|
rpme_release = 'rpm -qf /etc/os-release | xargs -i rpm -e --nodeps {}'
|
|
@@ -163,6 +163,7 @@ def system_sync():
|
|
return False
|
|
return True
|
|
|
|
+
|
|
def main():
|
|
if not check_pkg("yum-utils"):
|
|
print("please install yum-utils")
|
|
@@ -187,7 +188,6 @@ def main():
|
|
with open(repofile, 'w') as f:
|
|
f.write(openeuler_repo)
|
|
|
|
-
|
|
openEuler_release = 'openEuler-release'
|
|
if not check_pkg(openEuler_release):
|
|
print("swaping release")
|
|
@@ -240,7 +240,6 @@ def main():
|
|
print("Removing confilct package yum...")
|
|
system_sync()
|
|
|
|
-
|
|
# boot cui
|
|
print("set boot target to cui")
|
|
cmd = 'systemctl set-default multi-user.target'
|
|
@@ -263,6 +262,5 @@ def main():
|
|
os.system("reboot")
|
|
|
|
|
|
-
|
|
if __name__ == '__main__':
|
|
main()
|
|
diff --git a/views/migration.py b/views/migration.py
|
|
index 1312d33..477627b 100644
|
|
--- a/views/migration.py
|
|
+++ b/views/migration.py
|
|
@@ -1,12 +1,11 @@
|
|
# SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
|
# SPDX-License-Identifier: MulanPubL-2.0-or-later
|
|
-
|
|
-from flask import *
|
|
import os
|
|
-
|
|
+from flask import *
|
|
from client_requests import *
|
|
from func.utils import *
|
|
|
|
+
|
|
def check_services(data, url):
|
|
info = post_client_data(data, url)
|
|
if info is None or info.status_code != 200:
|
|
@@ -27,26 +26,30 @@ def check_os(data):
|
|
if services:
|
|
return services
|
|
|
|
+
|
|
def check_storage(data):
|
|
services = check_services(data, '/check_storage')
|
|
if services:
|
|
return services
|
|
|
|
+
|
|
def close_tool(data):
|
|
os.system('kill -9 `ps -ef | grep "start_webview.py" | grep -v grep | awk \'{print $2}\'`')
|
|
data = {"ip": "0.0.0.0"}
|
|
data_json = json.dumps(data)
|
|
return data_json
|
|
|
|
+
|
|
def check_user(data):
|
|
services = check_services(data, '/check_user')
|
|
if services:
|
|
json_data = json.loads(data)
|
|
- with open('/usr/lib/migration-tools-server/.passwd.txt','w',encoding='utf-8') as f:
|
|
+ with open('/usr/lib/migration-tools-server/.passwd.txt', 'w', encoding='utf-8') as f:
|
|
text = json_data['passwd']
|
|
f.write(text)
|
|
return services
|
|
|
|
+
|
|
def check_repo(data):
|
|
services = check_services(data, '/check_repo')
|
|
if services:
|
|
--
|
|
2.20.1
|
|
|