From 4cc9d1d5661c24cf6ea585c2c89a2305ec2c39b4 Mon Sep 17 00:00:00 2001 From: mgb01105731 Date: Fri, 10 Jun 2022 14:12:32 +0800 Subject: [PATCH] Add --tool_version to check the viersion of tool --- README.md | 3 +++ centos2anolis.py | 10 ++++++++-- centos2anolis.spec | 7 +++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 748187f..32e909b 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,9 @@ gpgcheck=0 enabled=1 ``` +* `--tool_version` 查看脚本版本 + + 该选项会返回当前脚本`centos2anolis.py`的版本号。 ## 问题反馈 diff --git a/centos2anolis.py b/centos2anolis.py index 9e7c1dd..ef09943 100644 --- a/centos2anolis.py +++ b/centos2anolis.py @@ -84,6 +84,8 @@ jsoncount=0 # The total number of functions to be executed in ccontinue. jsonsum=28 custom_json_file1="" +# centos2anolis version +centos2anolis_version = "0.2" def get_current_version(continue_after_sync = False): global centosversion @@ -877,10 +879,13 @@ def check_local_repo(localrepo): log_it(logging.ERROR, "Please write the file of the anolis repository: /etc/yum.repos.d/switch-to-anolis.repo") sys.exit(1) -def main(verify_all_rpms=False, accelerate=False, version=False, continue_after_sync=False, custom_log_dir = False, custom_json_file=False, local_repo=False): +def main(verify_all_rpms=False, accelerate=False, version=False, continue_after_sync=False, custom_log_dir = False, custom_json_file=False, local_repo=False, tool_version=False): global jd global jsoncount global custom_json_file1 + if tool_version: + print(centos2anolis_version) + sys.exit(1) set_log_info(custom_log_dir) set_json_info(custom_json_file) custom_json_file1=custom_json_file @@ -942,7 +947,8 @@ if __name__ == "__main__": parser.add_argument('--log_dir', help='Set Custom log directory') parser.add_argument('--progress_file', help='Set Custom json file') parser.add_argument('-l', action='store_true', help='Select the local repo file') + parser.add_argument('--tool_version', action='store_true', help='Check the version of centos2anolis.py') args = parser.parse_args() - sys.exit(main(args.V, args.s, args.v, args.c, args.log_dir, args.progress_file, args.l)) + sys.exit(main(args.V, args.s, args.v, args.c, args.log_dir, args.progress_file, args.l, args.tool_version)) diff --git a/centos2anolis.spec b/centos2anolis.spec index 02a37fa..90c0196 100644 --- a/centos2anolis.spec +++ b/centos2anolis.spec @@ -1,7 +1,7 @@ -%define anolis_release 6 +%define anolis_release 1 Name: centos2anolis -Version: 0.1 +Version: 0.2 Release: %{anolis_release} Summary: Transfer CentOS to Anolis. @@ -39,6 +39,9 @@ install -m 755 %{SOURCE0} %{buildroot}/%{_sbindir} %changelog +* Fri Jun 10 2022 mgb0110571 - 0.2-1 +- Add --tool_version to check the version of tool + * Thu May 26 2022 XueZhixin - 0.1-6 - Add offline migration -- Gitee