diff --git a/centos2anolis.py b/centos2anolis.py index 50587c23c0232aafe7f9a87bda51c19b14ead63d..8e4d98011134122de8a3706ffa8b8c8925bc1e1d 100644 --- a/centos2anolis.py +++ b/centos2anolis.py @@ -402,6 +402,12 @@ def main(reinstall_all_rpms=False, verify_all_rpms=False, accelerate=False, vers if opt != 'Yes': sys.exit(1) + print("========= Looking for yumdownloader ==========") + if not check_pkg('yumdownloader'): + subprocess.run("yum -y install yum-utils", shell=True) + if not check_pkg('yumdownloader'): + clean_and_exit() + print("========= Finding your repository directory =========") dir = '/etc/yum.repos.d/' if os.path.isdir(dir): @@ -424,12 +430,6 @@ def main(reinstall_all_rpms=False, verify_all_rpms=False, accelerate=False, vers if accelerate: change_repo_mirror(reposdir, 'switch-to-anolis.repo') - print("========= Looking for yumdownloader ==========") - if not check_pkg('yumdownloader'): - subprocess.run("yum -y install yum-utils --disablerepo an* || true", shell=True) - if not check_pkg('yumdownloader'): - clean_and_exit() - print("========= Start converting =========") print("Backing up and removing old repository files...") diff --git a/centos2anolis.spec b/centos2anolis.spec new file mode 100644 index 0000000000000000000000000000000000000000..8529d62b9b7c6dfeec0e8d5c1364d431d91fca42 --- /dev/null +++ b/centos2anolis.spec @@ -0,0 +1,41 @@ +Name: centos2anolis +Version: 0.1 +Release: 1%{?dist} +Summary: Transfer CentOS to Anolis. + +License: MIT +URL: www.openanolis.cn +Source0: %{name}.py +Source1: README.md +Source2: LICENSE.txt + +BuildRequires: python3 +Requires: python3 +Requires: bash + +BuildArch: noarch + +%description +This script is designed to automatically convert a CentOS instance to +Anolis OS in-place. Currently it supports transferring from CentOS 7 +to Anolis OS 7 and from CentOS 8 to Anolis OS 8. + +%prep +cp %{SOURCE1} . +cp %{SOURCE2} . + + +%install +mkdir -p %{buildroot}/%{_sbindir} +install -m 755 %{SOURCE0} %{buildroot}/%{_sbindir} + + +%files +%{_sbindir}/%{name}.py +%doc README.md +%license LICENSE.txt + + +%changelog +* Wed Dec 22 2021 mgb0110571 - 0.1-1 +- First CentOS2Anolis Package