Adding Clear Linux update support (#256)
This commit is contained in:
committed by
Roey Darwish Dror
parent
ed5b7a2c66
commit
3c0f8a1ab0
@@ -21,6 +21,7 @@ package manager. Topgrade is tested on and knows the following platforms:
|
|||||||
* Arch based
|
* Arch based
|
||||||
* Red Hat based
|
* Red Hat based
|
||||||
* Debian based
|
* Debian based
|
||||||
|
* Clear Linux
|
||||||
* Gentoo
|
* Gentoo
|
||||||
* NixOS
|
* NixOS
|
||||||
* openSUSE
|
* openSUSE
|
||||||
@@ -67,6 +68,7 @@ Just run `topgrade`. It will run the following steps:
|
|||||||
* **Arch based**: Run [yay](https://github.com/Jguer/yay) or fall back to pacman
|
* **Arch based**: Run [yay](https://github.com/Jguer/yay) or fall back to pacman
|
||||||
* **Redhat based**: Run `yum upgrade` (or `dnf` if present)
|
* **Redhat based**: Run `yum upgrade` (or `dnf` if present)
|
||||||
* **Debian based**: Run `apt update && apt dist-upgrade`
|
* **Debian based**: Run `apt update && apt dist-upgrade`
|
||||||
|
* **Clear Linux**: Run `swupd update`
|
||||||
* **Gentoo**: Run `layman -s ALL && emerge --sync -q && eix-update && emerge -uDNa world`
|
* **Gentoo**: Run `layman -s ALL && emerge --sync -q && eix-update && emerge -uDNa world`
|
||||||
* **openSUSE**: Run `zypper refresh && zypper dist-upgrade`
|
* **openSUSE**: Run `zypper refresh && zypper dist-upgrade`
|
||||||
* **Void**: Run `xbps-install -Su`
|
* **Void**: Run `xbps-install -Su`
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct OsRelease {
|
|||||||
pub enum Distribution {
|
pub enum Distribution {
|
||||||
Arch,
|
Arch,
|
||||||
CentOS,
|
CentOS,
|
||||||
|
ClearLinux,
|
||||||
Fedora,
|
Fedora,
|
||||||
Debian,
|
Debian,
|
||||||
Gentoo,
|
Gentoo,
|
||||||
@@ -55,6 +56,7 @@ impl Distribution {
|
|||||||
|
|
||||||
Ok(match id {
|
Ok(match id {
|
||||||
Some("centos") | Some("ol") => Distribution::CentOS,
|
Some("centos") | Some("ol") => Distribution::CentOS,
|
||||||
|
Some("clear-linux-os") => Distribution::ClearLinux,
|
||||||
Some("fedora") => Distribution::Fedora,
|
Some("fedora") => Distribution::Fedora,
|
||||||
Some("void") => Distribution::Void,
|
Some("void") => Distribution::Void,
|
||||||
Some("debian") => Distribution::Debian,
|
Some("debian") => Distribution::Debian,
|
||||||
@@ -87,6 +89,7 @@ impl Distribution {
|
|||||||
match self {
|
match self {
|
||||||
Distribution::Arch => upgrade_arch_linux(&sudo, cleanup, run_type, yes, &config.yay_arguments()),
|
Distribution::Arch => upgrade_arch_linux(&sudo, cleanup, run_type, yes, &config.yay_arguments()),
|
||||||
Distribution::CentOS | Distribution::Fedora => upgrade_redhat(&sudo, run_type, yes),
|
Distribution::CentOS | Distribution::Fedora => upgrade_redhat(&sudo, run_type, yes),
|
||||||
|
Distribution::ClearLinux => upgrade_clearlinux(&sudo, run_type),
|
||||||
Distribution::Debian => upgrade_debian(&sudo, cleanup, run_type, yes),
|
Distribution::Debian => upgrade_debian(&sudo, cleanup, run_type, yes),
|
||||||
Distribution::Gentoo => upgrade_gentoo(&sudo, run_type),
|
Distribution::Gentoo => upgrade_gentoo(&sudo, run_type),
|
||||||
Distribution::Suse => upgrade_suse(&sudo, run_type),
|
Distribution::Suse => upgrade_suse(&sudo, run_type),
|
||||||
@@ -302,6 +305,19 @@ fn upgrade_solus(sudo: &Option<PathBuf>, run_type: RunType) -> Result<(), Error>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn upgrade_clearlinux(sudo: &Option<PathBuf>, run_type: RunType) -> Result<(), Error> {
|
||||||
|
if let Some(sudo) = &sudo {
|
||||||
|
run_type
|
||||||
|
.execute(&sudo)
|
||||||
|
.args(&["/usr/bin/swupd", "update"])
|
||||||
|
.check_run()?;
|
||||||
|
} else {
|
||||||
|
print_warning("No sudo detected. Skipping system upgrade");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn upgrade_exherbo(sudo: &Option<PathBuf>, cleanup: bool, run_type: RunType) -> Result<(), Error> {
|
fn upgrade_exherbo(sudo: &Option<PathBuf>, cleanup: bool, run_type: RunType) -> Result<(), Error> {
|
||||||
if let Some(sudo) = &sudo {
|
if let Some(sudo) = &sudo {
|
||||||
run_type.execute(&sudo).args(&["/usr/bin/cave", "sync"]).check_run()?;
|
run_type.execute(&sudo).args(&["/usr/bin/cave", "sync"]).check_run()?;
|
||||||
@@ -462,6 +478,11 @@ mod tests {
|
|||||||
test_template(&include_str!("os_release/centos"), Distribution::CentOS);
|
test_template(&include_str!("os_release/centos"), Distribution::CentOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_clearlinux() {
|
||||||
|
test_template(&include_str!("os_release/clearlinux"), Distribution::ClearLinux);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_debian() {
|
fn test_debian() {
|
||||||
test_template(&include_str!("os_release/debian"), Distribution::Debian);
|
test_template(&include_str!("os_release/debian"), Distribution::Debian);
|
||||||
|
|||||||
11
src/steps/os/os_release/clearlinux
Normal file
11
src/steps/os/os_release/clearlinux
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
NAME="Clear Linux OS"
|
||||||
|
VERSION=1
|
||||||
|
ID=clear-linux-os
|
||||||
|
ID_LIKE=clear-linux-os
|
||||||
|
VERSION_ID=31620
|
||||||
|
PRETTY_NAME="Clear Linux OS"
|
||||||
|
ANSI_COLOR="1;35"
|
||||||
|
HOME_URL="https://clearlinux.org"
|
||||||
|
SUPPORT_URL="https://clearlinux.org"
|
||||||
|
BUG_REPORT_URL="mailto:dev@lists.clearlinux.org"
|
||||||
|
PRIVACY_POLICY_URL="http://www.intel.com/privacy"
|
||||||
Reference in New Issue
Block a user