Support Void (fix #95)
This commit is contained in:
@@ -36,6 +36,7 @@ Just run `topgrade`. It will run the following steps:
|
|||||||
* *Debian/Ubuntu*: Run `apt update && apt dist-upgrade`
|
* *Debian/Ubuntu*: Run `apt update && apt dist-upgrade`
|
||||||
* *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`
|
||||||
* *Linux*: Run [etc-update](https://dev.gentoo.org/~zmedico/portage/doc/man/etc-update.1.html):
|
* *Linux*: Run [etc-update](https://dev.gentoo.org/~zmedico/portage/doc/man/etc-update.1.html):
|
||||||
* *FreeBSD*: Upgrade and audit packages
|
* *FreeBSD*: Upgrade and audit packages
|
||||||
* *Unix*: Run `brew update && brew upgrade`. This should handle both Homebrew and Linuxbrew
|
* *Unix*: Run `brew update && brew upgrade`. This should handle both Homebrew and Linuxbrew
|
||||||
|
|||||||
20
src/linux.rs
20
src/linux.rs
@@ -16,6 +16,7 @@ pub enum Distribution {
|
|||||||
Ubuntu,
|
Ubuntu,
|
||||||
Gentoo,
|
Gentoo,
|
||||||
OpenSuse,
|
OpenSuse,
|
||||||
|
Void,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Fail)]
|
#[derive(Debug, Fail)]
|
||||||
@@ -54,6 +55,10 @@ impl Distribution {
|
|||||||
return Ok(Distribution::OpenSuse);
|
return Ok(Distribution::OpenSuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if content.contains("void") {
|
||||||
|
return Ok(Distribution::Void);
|
||||||
|
}
|
||||||
|
|
||||||
if PathBuf::from("/etc/gentoo-release").exists() {
|
if PathBuf::from("/etc/gentoo-release").exists() {
|
||||||
return Ok(Distribution::Gentoo);
|
return Ok(Distribution::Gentoo);
|
||||||
}
|
}
|
||||||
@@ -77,6 +82,7 @@ impl Distribution {
|
|||||||
Distribution::Ubuntu | Distribution::Debian => upgrade_debian(&sudo, terminal, dry_run),
|
Distribution::Ubuntu | Distribution::Debian => upgrade_debian(&sudo, terminal, dry_run),
|
||||||
Distribution::Gentoo => upgrade_gentoo(&sudo, terminal, dry_run),
|
Distribution::Gentoo => upgrade_gentoo(&sudo, terminal, dry_run),
|
||||||
Distribution::OpenSuse => upgrade_opensuse(&sudo, terminal, dry_run),
|
Distribution::OpenSuse => upgrade_opensuse(&sudo, terminal, dry_run),
|
||||||
|
Distribution::Void => upgrade_void(&sudo, terminal, dry_run),
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(("System update", success.is_ok()))
|
Some(("System update", success.is_ok()))
|
||||||
@@ -170,6 +176,20 @@ fn upgrade_opensuse(sudo: &Option<PathBuf>, terminal: &mut Terminal, dry_run: bo
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn upgrade_void(sudo: &Option<PathBuf>, terminal: &mut Terminal, dry_run: bool) -> Result<(), failure::Error> {
|
||||||
|
if let Some(sudo) = &sudo {
|
||||||
|
Executor::new(&sudo, dry_run)
|
||||||
|
.args(&["/usr/bin/xbps-install", "-Su"])
|
||||||
|
.spawn()?
|
||||||
|
.wait()?
|
||||||
|
.check()?;
|
||||||
|
} else {
|
||||||
|
terminal.print_warning("No sudo detected. Skipping system upgrade");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn upgrade_fedora(sudo: &Option<PathBuf>, terminal: &mut Terminal, dry_run: bool) -> Result<(), failure::Error> {
|
fn upgrade_fedora(sudo: &Option<PathBuf>, terminal: &mut Terminal, dry_run: bool) -> Result<(), failure::Error> {
|
||||||
if let Some(sudo) = &sudo {
|
if let Some(sudo) = &sudo {
|
||||||
Executor::new(&sudo, dry_run)
|
Executor::new(&sudo, dry_run)
|
||||||
|
|||||||
Reference in New Issue
Block a user