diff --git a/README.md b/README.md index a8c0e6b9dcecfb8ec65b0b8e2a205b88ad60fe8b..af471e7d82b589598bfb04fa94cb7bd8a6746b99 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Switch from CentOS to Anolis +# Switch from CentOS to Anolis OS -This script is designed to automatically convert a CentOS instance to Anolis in-place. +This script is designed to automatically convert a CentOS instance to Anolis OS in-place. ## Supported versions @@ -22,36 +22,36 @@ Please ensure you have a **complete backup** of the system before you execute th 1. Make sure you can run this script as root. 1. Make sure you have python3. 1. Either clone this repository or download [`centos2anolis.py`][2]. -1. Run `python3 centos2anolis.py -v * ` to start converting.`(* is the version of the anolis which you want)` +1. Run `python3 centos2anolis.py -v * ` to start converting.`(* is the version of the Anolis OS which you want)` ## Usage options -* `-r` Reinstalls all CentOS RPMs with Anolis RPMs +* `-r` Reinstalls all CentOS RPMs with Anolis OS RPMs - If a system is swiched to Anolis and there is no newer Anolis version + If a system is swiched to Anolis OS and there is no newer Anolis OS version of a package already installed then the CentOS version remains. - This option intends to reinstall any CentOS RPM with an identical version from Anolis. + This option intends to reinstall any CentOS RPM with an identical version from Anolis OS. This is not necessary for support and has no impact to a systems functionality. - A list of all non-Anolis RPMs will be displayed after the reinstall process. + A list of all non-Anolis OS RPMs will be displayed after the reinstall process. * `-V` Verify RPM information before and after the switch This option creates four output files in `/var/tmp/`: * `${hostname}-rpms-list-[before|after].log`: a sorted list of installed - packages `before` and `after` the switch to Anolis. + packages `before` and `after` the switch to Anolis OS. * `${hostname}-rpms-verified-[before|after].log`: the RPM verification results - for all installed packages `before` and `after` the switch to Anolis. + for all installed packages `before` and `after` the switch to Anolis OS. * `-s` Accelerate the downloading process The tool downloads packages from mirrors.openanolis.org by default, which could take a long time. This option intends to use mirrors.aliyun.com to speed up the process. -* `-v` The version of Anolis +* `-v` The version of Anolis OS - The version of anolis , like `7.7` or `8.2` or `8.4`.If you do not specify this parameter, the system prompts you to select. + The version of Anolis OS, like `7.7` or `7.9` or `8.2` or `8.4`.If you do not specify this parameter, the system prompts you to select. - * `Note that centos7.x only supports migration to anolis7.7`. - * `Note that centos8.0-8.2 supports migration to anolis8.2 or anolis8.4`. - * `Note that centos8.3/8.4 only supports migration to anolis8.4`. + * `Note that CentOS 7.x only supports migration to Anolis OS 7.7 or Anolis OS 7.9`. + * `Note that CentOS 8.0-8.2 supports migration to Anolis OS 8.2 or Anolis OS 8.4`. + * `Note that CentOS 8.3/8.4 only supports migration to Anolis OS 8.4`. ## Support Open an issue on [bugs.openanolis.cn][1] for any bugs, questions and requirements. diff --git a/centos2anolis.py b/centos2anolis.py index 8e4d98011134122de8a3706ffa8b8c8925bc1e1d..ab7a66692742d4ed5ece68787167e26c028754d8 100644 --- a/centos2anolis.py +++ b/centos2anolis.py @@ -62,7 +62,7 @@ libreport-centos libreport-plugin-mantisbt libreport-plugin-rhtsupport python3-s python-oauth sl-logos yum-rhn-plugin centos-indexhtml' reposdir ='' -anolislist7 = ['7.7'] +anolislist7 = ['7.7','7.9'] anolislist8 = ['8.2','8.4'] try: centosv = str(subprocess.check_output("cat /etc/centos-release | awk '{print $4}'", shell=True), 'utf-8')[:3] @@ -224,6 +224,9 @@ def check_version(version): if centosversion < 8 and version == "7.7": print("You selected anolis7.7") repostr_an7 = re.sub(r"/(7)/", "/7.7/", repostr_an7) + elif centosversion < 8 and version == "7.9": + print("You selected anolis7.9") + repostr_an7 = re.sub(r"/(7)/", "/7.9/", repostr_an7) elif 8 <= float(centosv) <= 8.2 and version == "8.2": print("You selected anolis8.2") repostr_an8 = re.sub(r"/(8)/", "/8.2/", repostr_an8) @@ -236,6 +239,9 @@ def check_version(version): elif centosversion < 8 and version == "7.7": print("You selected anolis7.7") repostr_an7 = re.sub(r"/(7)/", "/7.7/", repostr_an7) + elif centosversion < 8 and version == "7.9": + print("You selected anolis7.9") + repostr_an7 = re.sub(r"/(7)/", "/7.9/", repostr_an7) elif 8 <= float(centosv) <= 8.2 and version == "8.2": print("You selected anolis8.2") repostr_an8 = re.sub(r"/(8)/", "/8.2/", repostr_an8) @@ -281,19 +287,24 @@ def process_special_pkgs(): def yum_remove_pkg(): # 7.0-7.1 - subprocess.run('rpm -q gnome-documents && yum -y remove gnome-documents', shell=True) + subprocess.run("rpm -q gnome-documents && yum -y remove gnome-documents", shell=True) # 7.0-7.3 # downgrade mythes-en & hyphen-en subprocess.run("rpm -q mythes-en hyphen-en && yum -y downgrade mythes-en hyphen-en", shell=True) subprocess.run("rpm -q cdparanoia-libs && yum -y downgrade cdparanoia-libs", shell=True) subprocess.run("rpm -q libvirt-client && yum -y upgrade libvirt-client", shell=True) - subprocess.run("rpm -q gnome-packagekit* && yum -y upgrade gnome-packagekit*", shell=True) + subprocess.run("rpm -q gnome-packagekit && yum -y upgrade gnome-packagekit*", shell=True) subprocess.run("rpm -q libreoffice-langpack-en && yum -y upgrade libreoffice-langpack-en", shell=True) subprocess.run("rpm -q unoconv && yum -y update unoconv", shell=True) #7.0-7.1 remove centos-bookmarks subprocess.run("rpm -q centos-bookmarks && yum -y remove centos-bookmarks", shell=True) # remove kmod-kvdo - subprocess.run('rpm -q kmod-kvdo && yum -y remove kmod-kvdo', shell=True) + subprocess.run("rpm -q kmod-kvdo && yum -y remove kmod-kvdo", shell=True) + # 7.9 remove libreport plugin + subprocess.run("rpm -q libreport-plugin-rhtsupport && yum -y remove libreport-plugin-rhtsupport", shell=True) + subprocess.run("rpm -q libreport-centos && yum -y remove libreport-centos", shell=True) + subprocess.run("rpm -q libreport-plugin-mantisbt && yum -y remove libreport-plugin-mantisbt", shell=True) + subprocess.run("rpm -q libreport-rhel-anaconda-bugzilla && yum -y remove libreport-rhel-anaconda-bugzilla", shell=True) def main(reinstall_all_rpms=False, verify_all_rpms=False, accelerate=False, version=False): global reposdir