test vcpkg new in android

This commit is contained in:
rustdesk 2024-05-01 12:58:27 +08:00
parent b1722a085e
commit 08b7e036b4
3 changed files with 50 additions and 38 deletions

View File

@ -10,26 +10,24 @@ env:
RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503 RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503
CARGO_NDK_VERSION: "3.1.2" CARGO_NDK_VERSION: "3.1.2"
LLVM_VERSION: "15.0.6" LLVM_VERSION: "15.0.6"
FLUTTER_VERSION: "3.16.9" FLUTTER_VERSION: "3.19.6"
FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1"
# for arm64 linux because official Dart SDK does not work # for arm64 linux because official Dart SDK does not work
FLUTTER_ELINUX_VERSION: "3.16.9" FLUTTER_ELINUX_VERSION: "3.16.9"
FLUTTER_ELINUX_COMMIT_ID: "c02bd16e1630f5bd690b85c5c2456ac1920e25af" TAG_NAME: "${{ inputs.upload-tag }}"
TAG_NAME: "nightly"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
# vcpkg version: 2023.10.19 # vcpkg version: 2024.03.25
# for multiarch gcc compatibility VCPKG_COMMIT_ID: "a34c873a9717a888f58dc05268dea15592c2f0ff"
VCPKG_COMMIT_ID: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50"
VERSION: "1.2.4" VERSION: "1.2.4"
NDK_VERSION: "r26b" NDK_VERSION: "r26b"
#signing keys env variable checks #signing keys env variable checks
ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}' ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}"
MACOS_P12_BASE64: '${{ secrets.MACOS_P12_BASE64 }}' MACOS_P12_BASE64: "${{ secrets.MACOS_P12_BASE64 }}"
# To make a custom build with your own servers set the below secret values # To make a custom build with your own servers set the below secret values
RS_PUB_KEY: '${{ secrets.RS_PUB_KEY }}' RS_PUB_KEY: "${{ secrets.RS_PUB_KEY }}"
RENDEZVOUS_SERVER: '${{ secrets.RENDEZVOUS_SERVER }}' RENDEZVOUS_SERVER: "${{ secrets.RENDEZVOUS_SERVER }}"
API_SERVER: '${{ secrets.API_SERVER }}' API_SERVER: "${{ secrets.API_SERVER }}"
UPLOAD_ARTIFACT: true UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}" SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}"
jobs: jobs:

View File

@ -778,9 +778,10 @@ pub fn get_capturables() -> Result<Vec<PipeWireCapturable>, Box<dyn Error>> {
} }
fn is_server_running() -> bool { fn is_server_running() -> bool {
let app_name = config::APP_NAME.read().unwrap().clone().to_lowercase();
let output = match Command::new("sh") let output = match Command::new("sh")
.arg("-c") .arg("-c")
.arg("ps aux | grep rustdesk") .arg(&format!("ps aux | grep {}", app_name))
.output() .output()
{ {
Ok(output) => output, Ok(output) => output,
@ -790,6 +791,6 @@ fn is_server_running() -> bool {
}; };
let output_str = String::from_utf8_lossy(&output.stdout); let output_str = String::from_utf8_lossy(&output.stdout);
let is_running = output_str.contains("rustdesk --server"); let is_running = output_str.contains(&format!("{} --server", app_name));
is_running is_running
} }

View File

@ -326,17 +326,20 @@ fn set_x11_env(desktop: &Desktop) {
#[inline] #[inline]
fn stop_rustdesk_servers() { fn stop_rustdesk_servers() {
let _ = run_cmds(&format!( let _ = run_cmds(&format!(
r##"ps -ef | grep -E 'rustdesk +--server' | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##, r##"ps -ef | grep -E '{} +--server' | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
crate::get_app_name().to_lowercase(),
)); ));
} }
#[inline] #[inline]
fn stop_subprocess() { fn stop_subprocess() {
let _ = run_cmds(&format!( let _ = run_cmds(&format!(
r##"ps -ef | grep '/etc/rustdesk/xorg.conf' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##, r##"ps -ef | grep '/etc/{}/xorg.conf' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
crate::get_app_name().to_lowercase(),
)); ));
let _ = run_cmds(&format!( let _ = run_cmds(&format!(
r##"ps -ef | grep -E 'rustdesk +--cm-no-ui' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##, r##"ps -ef | grep -E '{} +--cm-no-ui' | grep -v grep | awk '{{printf("kill -9 %d\n", $2)}}' | bash"##,
crate::get_app_name().to_lowercase(),
)); ));
} }
@ -771,10 +774,13 @@ pub fn exec_privileged(args: &[&str]) -> ResultType<Child> {
} }
pub fn check_super_user_permission() -> ResultType<bool> { pub fn check_super_user_permission() -> ResultType<bool> {
let file = "/usr/share/rustdesk/files/polkit"; let file = format!(
"/usr/share/{}/files/polkit",
crate::get_app_name().to_lowercase()
);
let arg; let arg;
if Path::new(file).is_file() { if Path::new(&file).is_file() {
arg = file; arg = &file;
} else { } else {
arg = "echo"; arg = "echo";
} }
@ -988,7 +994,6 @@ mod desktop {
const IBUS_DAEMON: &str = "ibus-daemon"; const IBUS_DAEMON: &str = "ibus-daemon";
const PLASMA_KDED: &str = "kded[0-9]+"; const PLASMA_KDED: &str = "kded[0-9]+";
const GNOME_GOA_DAEMON: &str = "goa-daemon"; const GNOME_GOA_DAEMON: &str = "goa-daemon";
const RUSTDESK_TRAY: &str = "rustdesk +--tray";
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
pub struct Desktop { pub struct Desktop {
@ -1020,14 +1025,10 @@ mod desktop {
} }
fn get_display_xauth_xwayland(&mut self) { fn get_display_xauth_xwayland(&mut self) {
let tray = format!("{} +--tray", crate::get_app_name().to_lowercase());
for _ in 0..5 { for _ in 0..5 {
let display_proc = vec![ let display_proc =
XWAYLAND, vec![XWAYLAND, IBUS_DAEMON, GNOME_GOA_DAEMON, PLASMA_KDED, &tray];
IBUS_DAEMON,
GNOME_GOA_DAEMON,
PLASMA_KDED,
RUSTDESK_TRAY,
];
for proc in display_proc { for proc in display_proc {
self.display = get_env("DISPLAY", &self.uid, proc); self.display = get_env("DISPLAY", &self.uid, proc);
self.xauth = get_env("XAUTHORITY", &self.uid, proc); self.xauth = get_env("XAUTHORITY", &self.uid, proc);
@ -1124,6 +1125,7 @@ mod desktop {
fn get_xauth_x11(&mut self) { fn get_xauth_x11(&mut self) {
// try by direct access to window manager process by name // try by direct access to window manager process by name
let tray = format!("{} +--tray", crate::get_app_name().to_lowercase());
for _ in 0..10 { for _ in 0..10 {
let display_proc = vec![ let display_proc = vec![
XWAYLAND, XWAYLAND,
@ -1132,7 +1134,7 @@ mod desktop {
PLASMA_KDED, PLASMA_KDED,
XFCE4_PANEL, XFCE4_PANEL,
SDDM_GREETER, SDDM_GREETER,
RUSTDESK_TRAY, &tray,
]; ];
for proc in display_proc { for proc in display_proc {
self.xauth = get_env("XAUTHORITY", &self.uid, proc); self.xauth = get_env("XAUTHORITY", &self.uid, proc);
@ -1217,8 +1219,11 @@ mod desktop {
fn set_is_subprocess(&mut self) { fn set_is_subprocess(&mut self) {
self.is_rustdesk_subprocess = false; self.is_rustdesk_subprocess = false;
let cmd = "ps -ef | grep 'rustdesk/xorg.conf' | grep -v grep | wc -l"; let cmd = format!(
if let Ok(res) = run_cmds(cmd) { "ps -ef | grep '{}/xorg.conf' | grep -v grep | wc -l",
crate::get_app_name().to_lowercase()
);
if let Ok(res) = run_cmds(&cmd) {
if res.trim() != "0" { if res.trim() != "0" {
self.is_rustdesk_subprocess = true; self.is_rustdesk_subprocess = true;
} }
@ -1350,7 +1355,9 @@ fn switch_service(stop: bool) -> String {
let home = std::env::var("HOME").unwrap_or_default(); let home = std::env::var("HOME").unwrap_or_default();
Config::set_option("stop-service".into(), if stop { "Y" } else { "" }.into()); Config::set_option("stop-service".into(), if stop { "Y" } else { "" }.into());
if home != "/root" && !Config::get().is_empty() { if home != "/root" && !Config::get().is_empty() {
format!("cp -f {home}/.config/rustdesk/RustDesk.toml /root/.config/rustdesk/; cp -f {home}/.config/rustdesk/RustDesk2.toml /root/.config/rustdesk/;") let app_name0 = crate::get_app_name().to_lowercase();
let app_name = crate::get_app_name();
format!("cp -f {home}/.config/{app_name}/{app_name0}.toml /root/.config/{app_name}/; cp -f {home}/.config/{app_name}/{app_name0}2.toml /root/.config/{app_name}/;")
} else { } else {
"".to_owned() "".to_owned()
} }
@ -1362,8 +1369,9 @@ pub fn uninstall_service(show_new_window: bool, _: bool) -> bool {
} }
log::info!("Uninstalling service..."); log::info!("Uninstalling service...");
let cp = switch_service(true); let cp = switch_service(true);
let app_name = crate::get_app_name().to_lowercase();
if !run_cmds_pkexec(&format!( if !run_cmds_pkexec(&format!(
"systemctl disable rustdesk; systemctl stop rustdesk; {cp}" "systemctl disable {app_name}; systemctl stop {app_name}; {cp}"
)) { )) {
Config::set_option("stop-service".into(), "".into()); Config::set_option("stop-service".into(), "".into());
return true; return true;
@ -1381,8 +1389,9 @@ pub fn install_service() -> bool {
} }
log::info!("Installing service..."); log::info!("Installing service...");
let cp = switch_service(false); let cp = switch_service(false);
let app_name = crate::get_app_name().to_lowercase();
if !run_cmds_pkexec(&format!( if !run_cmds_pkexec(&format!(
"{cp} systemctl enable rustdesk; systemctl start rustdesk;" "{cp} systemctl enable {app_name}; systemctl start {app_name};"
)) { )) {
Config::set_option("stop-service".into(), "Y".into()); Config::set_option("stop-service".into(), "Y".into());
return true; return true;
@ -1393,27 +1402,31 @@ pub fn install_service() -> bool {
fn check_if_stop_service() { fn check_if_stop_service() {
if Config::get_option("stop-service".into()) == "Y" { if Config::get_option("stop-service".into()) == "Y" {
let app_name = crate::get_app_name().to_lowercase();
allow_err!(run_cmds( allow_err!(run_cmds(
"systemctl disable rustdesk; systemctl stop rustdesk" "systemctl disable {app_name}; systemctl stop {app_name}"
)); ));
} }
} }
pub fn check_autostart_config() -> ResultType<()> { pub fn check_autostart_config() -> ResultType<()> {
let home = std::env::var("HOME").unwrap_or_default(); let home = std::env::var("HOME").unwrap_or_default();
let app_name = crate::get_app_name().to_lowercase();
let path = format!("{home}/.config/autostart"); let path = format!("{home}/.config/autostart");
let file = format!("{path}/rustdesk.desktop"); let file = format!("{path}/{app_name}.desktop");
std::fs::create_dir_all(&path).ok(); std::fs::create_dir_all(&path).ok();
if !Path::new(&file).exists() { if !Path::new(&file).exists() {
// write text to the desktop file // write text to the desktop file
let mut file = std::fs::File::create(&file)?; let mut file = std::fs::File::create(&file)?;
file.write_all( file.write_all(
format!(
" "
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Exec=rustdesk --tray Exec={app_name} --tray
NoDisplay=false NoDisplay=false
" "
)
.as_bytes(), .as_bytes(),
)?; )?;
} }