feat: build and publish Windows NSH packages with verified updates

This commit is contained in:
Kevin Yue committed 2026-11-18 13:55:52 +08:00
1 parent 754b220a9d
commit b4c1dc1647
105 files changed
+6606 -798

No files matched your search

+10 -5
View File
@@ -5,11 +5,16 @@ fn main() {
let workspace_dir = Path::new(manifest_dir).ancestors().nth(2).unwrap();
let gpgui_dir = workspace_dir.parent().unwrap().join("gpgui");
let gp_service_binary = workspace_dir.join("target/debug/gpservice");
let gp_client_binary = workspace_dir.join("target/debug/gpclient");
let gp_auth_binary = workspace_dir.join("target/debug/gpauth");
let gp_gui_helper_binary = workspace_dir.join("target/debug/gpgui-helper");
let gp_gui_binary = gpgui_dir.join("target/debug/gpgui");
let suffix = if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
".exe"
} else {
""
};
let gp_service_binary = workspace_dir.join(format!("target/debug/gpservice{suffix}"));
let gp_client_binary = workspace_dir.join(format!("target/debug/gpclient{suffix}"));
let gp_auth_binary = workspace_dir.join(format!("target/debug/gpauth{suffix}"));
let gp_gui_helper_binary = workspace_dir.join(format!("target/debug/gpgui-helper{suffix}"));
let gp_gui_binary = gpgui_dir.join(format!("target/debug/gpgui{suffix}"));
println!("cargo:rustc-env=GP_SERVICE_BINARY={}", gp_service_binary.display());
println!("cargo:rustc-env=GP_CLIENT_BINARY={}", gp_client_binary.display());
+1 -1
View File
@@ -89,7 +89,7 @@ fn sibling_binary(binary_name: &str) -> Option<PathBuf> {
fn sibling_binary_for_executable(executable: &Path, binary_name: &str) -> Option<PathBuf> {
let executable = executable.canonicalize().ok()?;
let bin_dir = executable.parent()?;
let binary = bin_dir.join(binary_name);
let binary = bin_dir.join(format!("{binary_name}{}", std::env::consts::EXE_SUFFIX));
if is_file(&binary) {
return Some(binary);
}
-1
View File
@@ -2,7 +2,6 @@ pub const GP_USER_AGENT: &str = "PAN GlobalProtect";
pub const GP_CLIENT_VERSION_LINUX: &str = "6.3.3-619";
pub const GP_CLIENT_VERSION_WINDOWS: &str = "6.3.3-650";
pub const GP_CLIENT_VERSION_MACOS: &str = "6.3.3-915";
pub const GP_SERVICE_LOCK_FILE: &str = "/var/run/gpservice.lock";
#[cfg(target_os = "linux")]
pub const GP_VPNC_SCRIPT_INSTALLER_BINARY: &str = "/usr/libexec/gpclient/gp-vpnc-script-installer";
#[cfg(target_os = "linux")]
+1
View File
@@ -1,2 +1,3 @@
pub mod binary_paths;
pub mod constants;
pub mod paths;
+32
View File
@@ -0,0 +1,32 @@
//! Machine-wide service state shared by the daemon and desktop clients.
use std::path::PathBuf;
pub fn service_lock_file() -> PathBuf {
#[cfg(unix)]
{
PathBuf::from("/var/run/gpservice.lock")
}
#[cfg(windows)]
{
std::env::var_os("ProgramData")
.map(PathBuf::from)
.unwrap_or_else(|| PathBuf::from(r"C:\ProgramData"))
.join("GP Connect")
.join("gpservice.lock")
}
}
#[cfg(windows)]
pub const SERVICE_PIPE: &str = r"\\.\pipe\GPConnect.Service";
#[cfg(windows)]
pub const SERVICE_NAME: &str = "GPConnect";
/// Installer-owned SYSTEM/Administrators-only state, including temporary keys.
#[cfg(windows)]
pub fn service_private_dir() -> PathBuf {
service_lock_file()
.parent()
.expect("service state directory")
.join("Private")
}