feat: App support for Intel homebrew builds (#594)

This commit is contained in:
Nanami Nakano authored and GitHub committed 2026-04-26 21:04:20 +08:00
1 parent 4f477901d9
commit dad4f13f64
3 files changed
+29 -10

No files matched your search

+17 -5
View File
@@ -4,17 +4,29 @@ pub const GP_SERVICE_LOCK_FILE: &str = "/var/run/gpservice.lock";
pub const GP_CALLBACK_PORT_FILENAME: &str = "gpcallback.port"; pub const GP_CALLBACK_PORT_FILENAME: &str = "gpcallback.port";
// Release binaries - macOS (Apple Silicon Homebrew) // Release binaries - macOS (Apple Silicon Homebrew)
#[cfg(all(not(debug_assertions), target_os = "macos"))] #[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
pub const GP_CLIENT_BINARY: &str = "/opt/homebrew/bin/gpclient"; pub const GP_CLIENT_BINARY: &str = "/opt/homebrew/bin/gpclient";
#[cfg(all(not(debug_assertions), target_os = "macos"))] #[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
pub const GP_SERVICE_BINARY: &str = "/opt/homebrew/bin/gpservice"; pub const GP_SERVICE_BINARY: &str = "/opt/homebrew/bin/gpservice";
#[cfg(all(not(debug_assertions), target_os = "macos"))] #[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
pub const GP_GUI_BINARY: &str = "/opt/homebrew/bin/gpgui"; pub const GP_GUI_BINARY: &str = "/opt/homebrew/bin/gpgui";
#[cfg(all(not(debug_assertions), target_os = "macos"))] #[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
pub const GP_GUI_HELPER_BINARY: &str = "/opt/homebrew/bin/gpgui-helper"; pub const GP_GUI_HELPER_BINARY: &str = "/opt/homebrew/bin/gpgui-helper";
#[cfg(all(not(debug_assertions), target_os = "macos"))] #[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "aarch64"))]
pub const GP_AUTH_BINARY: &str = "/opt/homebrew/bin/gpauth"; pub const GP_AUTH_BINARY: &str = "/opt/homebrew/bin/gpauth";
// Release binaries - macOS (Intel Homebrew)
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "x86_64"))]
pub const GP_CLIENT_BINARY: &str = "/usr/local/bin/gpclient";
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "x86_64"))]
pub const GP_SERVICE_BINARY: &str = "/usr/local/bin/gpservice";
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "x86_64"))]
pub const GP_GUI_BINARY: &str = "/usr/local/bin/gpgui";
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "x86_64"))]
pub const GP_GUI_HELPER_BINARY: &str = "/usr/local/bin/gpgui-helper";
#[cfg(all(not(debug_assertions), target_os = "macos", target_arch = "x86_64"))]
pub const GP_AUTH_BINARY: &str = "/usr/local/bin/gpauth";
// Release binaries - Linux // Release binaries - Linux
#[cfg(all(not(debug_assertions), not(target_os = "macos")))] #[cfg(all(not(debug_assertions), not(target_os = "macos")))]
pub const GP_CLIENT_BINARY: &str = "/usr/bin/gpclient"; pub const GP_CLIENT_BINARY: &str = "/usr/bin/gpclient";
+6 -2
View File
@@ -10,8 +10,10 @@ const VPNC_SCRIPT_LOCATIONS: &[&str] = &[
"/etc/vpnc/vpnc-script", "/etc/vpnc/vpnc-script",
"/etc/openconnect/vpnc-script", "/etc/openconnect/vpnc-script",
"/usr/libexec/vpnc-scripts/vpnc-script", "/usr/libexec/vpnc-scripts/vpnc-script",
#[cfg(target_os = "macos")] #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
"/opt/homebrew/etc/vpnc/vpnc-script", "/opt/homebrew/etc/vpnc/vpnc-script",
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
"/usr/local/etc/vpnc/vpnc-script",
]; ];
const CSD_WRAPPER_LOCATIONS: &[&str] = &[ const CSD_WRAPPER_LOCATIONS: &[&str] = &[
@@ -22,8 +24,10 @@ const CSD_WRAPPER_LOCATIONS: &[&str] = &[
"/usr/lib/aarch64-linux-gnu/openconnect/hipreport.sh", "/usr/lib/aarch64-linux-gnu/openconnect/hipreport.sh",
"/usr/lib/openconnect/hipreport.sh", "/usr/lib/openconnect/hipreport.sh",
"/usr/libexec/openconnect/hipreport.sh", "/usr/libexec/openconnect/hipreport.sh",
#[cfg(target_os = "macos")] #[cfg(all(target_os = "macos", target_arch = "aarch64"))]
"/opt/homebrew/opt/openconnect/libexec/openconnect/hipreport.sh", "/opt/homebrew/opt/openconnect/libexec/openconnect/hipreport.sh",
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
"/usr/local/opt/openconnect/libexec/openconnect/hipreport.sh",
]; ];
fn find_executable(locations: &[&'static str]) -> Option<&'static str> { fn find_executable(locations: &[&'static str]) -> Option<&'static str> {
@@ -4,13 +4,16 @@
LOGFILE="/tmp/gpclient-hipreport.log" LOGFILE="/tmp/gpclient-hipreport.log"
LINUX_GPCLIENT_BIN="/usr/bin/gpclient" LINUX_GPCLIENT_BIN="/usr/bin/gpclient"
HOMEBREW_GPCLIENT_BIN="/opt/homebrew/bin/gpclient" ARM64_HOMEBREW_GPCLIENT_BIN="/opt/homebrew/bin/gpclient"
X86_64_HOMEBREW_GPCLIENT_BIN="/usr/local/bin/gpclient"
GPCLIENT_BIN="" GPCLIENT_BIN=""
if [ -x "$LINUX_GPCLIENT_BIN" ]; then if [ -x "$LINUX_GPCLIENT_BIN" ]; then
GPCLIENT_BIN="$LINUX_GPCLIENT_BIN" GPCLIENT_BIN="$LINUX_GPCLIENT_BIN"
elif [ -x "$HOMEBREW_GPCLIENT_BIN" ]; then elif [ -x "$ARM64_HOMEBREW_GPCLIENT_BIN" ]; then
GPCLIENT_BIN="$HOMEBREW_GPCLIENT_BIN" GPCLIENT_BIN="$ARM64_HOMEBREW_GPCLIENT_BIN"
elif [ -x "$X86_64_HOMEBREW_GPCLIENT_BIN" ]; then
GPCLIENT_BIN="$X86_64_HOMEBREW_GPCLIENT_BIN"
else else
echo "Error: gpclient binary not found." > "$LOGFILE" echo "Error: gpclient binary not found." > "$LOGFILE"
exit 1 exit 1