diff --git a/README.md b/README.md index 748187f43df9ff10f941e807b48970b00d1f4121..32e909b1b963242351bc0c5df55784510b93af87 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 9e7c1dd866d1f9384e2418eced33a54f26cd0be8..ef09943cc8ea0b3777eb566afebdce28777948ea 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 02a37faafb8bf57a27808d051ae5a6c1756a8f07..90c0196e240b5bd92f64b1f2d650b288a46729f0 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