feat(os): add AOSC OS support (#1424)
This commit is contained in:
@@ -23,6 +23,7 @@ static OS_RELEASE_PATH: &str = "/etc/os-release";
|
|||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum Distribution {
|
pub enum Distribution {
|
||||||
Alpine,
|
Alpine,
|
||||||
|
AOSC,
|
||||||
Wolfi,
|
Wolfi,
|
||||||
Arch,
|
Arch,
|
||||||
Bedrock,
|
Bedrock,
|
||||||
@@ -58,6 +59,7 @@ impl Distribution {
|
|||||||
|
|
||||||
Ok(match id {
|
Ok(match id {
|
||||||
Some("alpine") => Distribution::Alpine,
|
Some("alpine") => Distribution::Alpine,
|
||||||
|
Some("aosc") => Distribution::AOSC,
|
||||||
Some("chimera") => Distribution::Chimera,
|
Some("chimera") => Distribution::Chimera,
|
||||||
Some("wolfi") => Distribution::Wolfi,
|
Some("wolfi") => Distribution::Wolfi,
|
||||||
Some("centos") | Some("rhel") | Some("ol") => Distribution::CentOS,
|
Some("centos") | Some("rhel") | Some("ol") => Distribution::CentOS,
|
||||||
@@ -161,6 +163,7 @@ impl Distribution {
|
|||||||
Distribution::PCLinuxOS => upgrade_pclinuxos(ctx),
|
Distribution::PCLinuxOS => upgrade_pclinuxos(ctx),
|
||||||
Distribution::Nobara => upgrade_nobara(ctx),
|
Distribution::Nobara => upgrade_nobara(ctx),
|
||||||
Distribution::NILRT => upgrade_nilrt(ctx),
|
Distribution::NILRT => upgrade_nilrt(ctx),
|
||||||
|
Distribution::AOSC => upgrade_aosc(ctx),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,6 +200,20 @@ fn update_bedrock(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn upgrade_aosc(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
let oma = require("oma")?;
|
||||||
|
let sudo = ctx.require_sudo()?;
|
||||||
|
|
||||||
|
let mut cmd = sudo.execute(ctx, &oma)?;
|
||||||
|
cmd.arg("upgrade");
|
||||||
|
|
||||||
|
if ctx.config().yes(Step::System) {
|
||||||
|
cmd.arg("-y");
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.status_checked()
|
||||||
|
}
|
||||||
|
|
||||||
fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> {
|
fn upgrade_alpine_linux(ctx: &ExecutionContext) -> Result<()> {
|
||||||
let apk = require("apk")?;
|
let apk = require("apk")?;
|
||||||
let sudo = ctx.require_sudo()?;
|
let sudo = ctx.require_sudo()?;
|
||||||
@@ -1137,6 +1154,11 @@ mod tests {
|
|||||||
test_template(include_str!("os_release/arch32"), Distribution::Arch);
|
test_template(include_str!("os_release/arch32"), Distribution::Arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_aosc() {
|
||||||
|
test_template(include_str!("os_release/aosc"), Distribution::AOSC);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_centos() {
|
fn test_centos() {
|
||||||
test_template(include_str!("os_release/centos"), Distribution::CentOS);
|
test_template(include_str!("os_release/centos"), Distribution::CentOS);
|
||||||
|
|||||||
10
src/steps/os/os_release/aosc
Normal file
10
src/steps/os/os_release/aosc
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
PRETTY_NAME="AOSC OS (12.2.2)"
|
||||||
|
NAME="AOSC OS"
|
||||||
|
VERSION_ID="12.2.2"
|
||||||
|
VERSION="12.2.2 (localhost)"
|
||||||
|
BUILD_ID="20250916"
|
||||||
|
ID=aosc
|
||||||
|
ANSI_COLOR="1;36"
|
||||||
|
HOME_URL="https://aosc.io/"
|
||||||
|
SUPPORT_URL="https://github.com/AOSC-Dev/aosc-os-abbs"
|
||||||
|
BUG_REPORT_URL="https://github.com/AOSC-Dev/aosc-os-abbs/issues"
|
||||||
Reference in New Issue
Block a user