diff --git a/external/opennow/CHANGES.md b/external/opennow/CHANGES.md index 4f135bcf78..eb52214010 100644 --- a/external/opennow/CHANGES.md +++ b/external/opennow/CHANGES.md @@ -1,3 +1,9 @@ # DroidDeck changes to the vendored OpenNOW code -None yet (pristine import of a49b124c). +Upstream: OpenCloudGaming/OpenNOW a49b124c. Each change keeps upstream behaviour on +Windows, macOS and Linux. + +- `opennow-core/src/update_apply/{process,security,mod,managed,recovery}.rs`: the + Linux-only process, ACL and boot-id helpers also cover Android (`target_os = + "android"`), so the core compiles for aarch64-linux-android. DroidDeck never runs + the self-updater. diff --git a/external/opennow/native/opennow-core/src/update_apply/managed.rs b/external/opennow/native/opennow-core/src/update_apply/managed.rs index de327457ad..aa1c23fec4 100644 --- a/external/opennow/native/opennow-core/src/update_apply/managed.rs +++ b/external/opennow/native/opennow-core/src/update_apply/managed.rs @@ -39,7 +39,7 @@ pub(super) fn verify_identity( Ok(()) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn output(command: &mut Command) -> Result { let result = super::command_output(command, Duration::from_secs(120))?; if !result.status.success() { @@ -53,7 +53,7 @@ fn output(command: &mut Command) -> Result { .map_err(|error| error.to_string()) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn deb_identity(package: &Path, target: &Path, version: &str) -> Result { if !Path::new("/usr/bin/pkexec").is_file() { return Err( @@ -110,7 +110,7 @@ fn deb_identity(package: &Path, target: &Path, version: &str) -> Result Result { let name = target.file_name().ok_or("Application has no file name")?; let mut pattern = std::ffi::OsString::from("*"); @@ -122,7 +122,7 @@ fn deb_file_owners(target: &Path) -> Result { ) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn deb_owns_file(files: &str, target: &Path) -> bool { let Ok(target) = super::canonical_file(target) else { return false; @@ -135,7 +135,7 @@ fn deb_owns_file(files: &str, target: &Path) -> bool { }) } -#[cfg(not(target_os = "linux"))] +#[cfg(not(any(target_os = "linux", target_os = "android")))] fn deb_identity(_: &Path, _: &Path, _: &str) -> Result { Err("DEB updates require Linux".to_owned()) } @@ -608,7 +608,7 @@ pub(super) fn verify_installed( .to_owned(), ); } - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "android"))] { let files = deb_file_owners(target)?; if !deb_owns_file(&files, target) { @@ -721,7 +721,7 @@ mod tests { assert!(msi_install_root_argument(Path::new("C:\\evil\"quote")).is_err()); } - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "android"))] #[test] fn deb_ownership_matches_canonical_directories_but_rejects_file_symlinks() { let directory = tempfile::tempdir().unwrap(); diff --git a/external/opennow/native/opennow-core/src/update_apply/mod.rs b/external/opennow/native/opennow-core/src/update_apply/mod.rs index 0cc7af8377..36bdafd84f 100644 --- a/external/opennow/native/opennow-core/src/update_apply/mod.rs +++ b/external/opennow/native/opennow-core/src/update_apply/mod.rs @@ -158,7 +158,7 @@ pub(super) fn windows_update_package_extension( } pub fn external_update_message() -> Option<&'static str> { - if cfg!(target_os = "linux") + if cfg!(any(target_os = "linux", target_os = "android")) && is_flatpak_installation( std::env::var_os("FLATPAK_ID").as_deref(), Path::new("/.flatpak-info"), @@ -191,8 +191,8 @@ pub fn detect_install_kind(application: &Path, package: &Path) -> Result Ok(InstallKind::AppImage), - "deb" if cfg!(target_os = "linux") => Ok(InstallKind::DebianPackage), + "appimage" if cfg!(any(target_os = "linux", target_os = "android")) => Ok(InstallKind::AppImage), + "deb" if cfg!(any(target_os = "linux", target_os = "android")) => Ok(InstallKind::DebianPackage), "msi" if cfg!(windows) => Ok(InstallKind::WindowsMsi), "zip" if cfg!(windows) => Ok(InstallKind::WindowsPortable), "zip" | "dmg" @@ -211,7 +211,7 @@ pub fn detect_install_kind(application: &Path, package: &Path) -> Result Result<&'static str, String> { require_native_updates()?; - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "android"))] { Ok( if std::env::var_os("APPIMAGE").is_some_and(|path| !path.is_empty()) { @@ -240,7 +240,7 @@ pub fn prepare_update(request: PrepareRequest) -> Result if request.kind == InstallKind::WindowsMsi { return Err(WINDOWS_INSTALLER_REPLACEMENT_MESSAGE.to_owned()); } - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "linux", target_os = "android"))] validate_linux_install_kind(request.kind, std::env::var_os("APPIMAGE").as_deref())?; let package = canonical_file(&request.package)?; let manifest = read_manifest(&package)?; @@ -353,7 +353,7 @@ pub fn prepare_update(request: PrepareRequest) -> Result result } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn validate_linux_install_kind( kind: InstallKind, appimage: Option<&std::ffi::OsStr>, diff --git a/external/opennow/native/opennow-core/src/update_apply/process.rs b/external/opennow/native/opennow-core/src/update_apply/process.rs index 76fb00a5a3..f9f8ad6362 100644 --- a/external/opennow/native/opennow-core/src/update_apply/process.rs +++ b/external/opennow/native/opennow-core/src/update_apply/process.rs @@ -166,7 +166,7 @@ pub(super) fn failed_start( } } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn group_is_running(group: u32) -> Result { for entry in std::fs::read_dir("/proc").map_err(|error| error.to_string())? { let entry = entry.map_err(|error| error.to_string())?; @@ -356,7 +356,7 @@ pub(super) fn owned_tree_is_running(identity: &ProcessIdentity) -> Result Result, String> { let path = PathBuf::from(format!("/proc/{pid}")); let stat = match std::fs::read_to_string(path.join("stat")) { diff --git a/external/opennow/native/opennow-core/src/update_apply/recovery.rs b/external/opennow/native/opennow-core/src/update_apply/recovery.rs index 57559d02e7..02101e7cab 100644 --- a/external/opennow/native/opennow-core/src/update_apply/recovery.rs +++ b/external/opennow/native/opennow-core/src/update_apply/recovery.rs @@ -212,7 +212,7 @@ fn current_boot_id() -> Result { Ok(format!("windows-boot-sequence:{boot_id}")) } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn current_boot_id() -> Result { let value = std::fs::read_to_string("/proc/sys/kernel/random/boot_id") .map_err(|error| error.to_string())?; @@ -227,7 +227,7 @@ fn current_boot_id() -> Result { Ok(value.to_owned()) } -#[cfg(not(any(windows, target_os = "linux")))] +#[cfg(not(any(windows, target_os = "linux", target_os = "android")))] fn current_boot_id() -> Result { Err("Managed reboot recovery is not supported on this platform.".to_owned()) } diff --git a/external/opennow/native/opennow-core/src/update_apply/security.rs b/external/opennow/native/opennow-core/src/update_apply/security.rs index ef974d0e95..3fd91afe4d 100644 --- a/external/opennow/native/opennow-core/src/update_apply/security.rs +++ b/external/opennow/native/opennow-core/src/update_apply/security.rs @@ -34,7 +34,7 @@ pub(super) fn preserve_permissions(source: &Path, destination: &Path) -> Result< } } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] fn preserve_unix_acl(source: &Path, destination: &Path) -> Result<(), String> { use std::os::unix::ffi::OsStrExt; let source =