diff --git a/crates/common/src/constants.rs b/crates/common/src/constants.rs index 99d4177..ac0169f 100644 --- a/crates/common/src/constants.rs +++ b/crates/common/src/constants.rs @@ -4,17 +4,29 @@ pub const GP_SERVICE_LOCK_FILE: &str = "/var/run/gpservice.lock"; pub const GP_CALLBACK_PORT_FILENAME: &str = "gpcallback.port"; // 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"; -#[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"; -#[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"; -#[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"; -#[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"; +// 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 #[cfg(all(not(debug_assertions), not(target_os = "macos")))] pub const GP_CLIENT_BINARY: &str = "/usr/bin/gpclient"; diff --git a/crates/openconnect/src/vpn_utils.rs b/crates/openconnect/src/vpn_utils.rs index 0e8f270..29d719b 100644 --- a/crates/openconnect/src/vpn_utils.rs +++ b/crates/openconnect/src/vpn_utils.rs @@ -10,8 +10,10 @@ const VPNC_SCRIPT_LOCATIONS: &[&str] = &[ "/etc/vpnc/vpnc-script", "/etc/openconnect/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", + #[cfg(all(target_os = "macos", target_arch = "x86_64"))] + "/usr/local/etc/vpnc/vpnc-script", ]; const CSD_WRAPPER_LOCATIONS: &[&str] = &[ @@ -22,8 +24,10 @@ const CSD_WRAPPER_LOCATIONS: &[&str] = &[ "/usr/lib/aarch64-linux-gnu/openconnect/hipreport.sh", "/usr/lib/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", + #[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> { diff --git a/packaging/files/usr/libexec/gpclient/hipreport.sh b/packaging/files/usr/libexec/gpclient/hipreport.sh index 9512488..36191ca 100755 --- a/packaging/files/usr/libexec/gpclient/hipreport.sh +++ b/packaging/files/usr/libexec/gpclient/hipreport.sh @@ -4,13 +4,16 @@ LOGFILE="/tmp/gpclient-hipreport.log" 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="" if [ -x "$LINUX_GPCLIENT_BIN" ]; then GPCLIENT_BIN="$LINUX_GPCLIENT_BIN" -elif [ -x "$HOMEBREW_GPCLIENT_BIN" ]; then - GPCLIENT_BIN="$HOMEBREW_GPCLIENT_BIN" +elif [ -x "$ARM64_HOMEBREW_GPCLIENT_BIN" ]; then + GPCLIENT_BIN="$ARM64_HOMEBREW_GPCLIENT_BIN" +elif [ -x "$X86_64_HOMEBREW_GPCLIENT_BIN" ]; then + GPCLIENT_BIN="$X86_64_HOMEBREW_GPCLIENT_BIN" else echo "Error: gpclient binary not found." > "$LOGFILE" exit 1