Gate wpa_suplicant in installer and workflow to avoid building binary every push

This commit is contained in:
Ember
2026-02-25 23:18:18 -08:00
parent 8e09ca42aa
commit 61b09be7d5
5 changed files with 73 additions and 30 deletions
+3
View File
@@ -3,6 +3,9 @@ name = "installer"
version = "0.10.1"
edition = "2024"
[features]
wifi-client = []
[lib]
name = "installer"
crate-type = ["rlib"]
+6 -3
View File
@@ -18,9 +18,12 @@ fn main() {
set_binary_var(&include_dir, "FILE_ROOTSHELL", "rootshell");
set_binary_var(&include_dir, "FILE_RAYHUNTER_DAEMON", "rayhunter-daemon");
let wpa_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../tools/build-wpa-supplicant/out");
set_binary_var(&wpa_dir, "FILE_WPA_SUPPLICANT", "wpa_supplicant");
set_binary_var(&wpa_dir, "FILE_WPA_CLI", "wpa_cli");
if std::env::var("CARGO_FEATURE_WIFI_CLIENT").is_ok() {
let wpa_dir =
Path::new(env!("CARGO_MANIFEST_DIR")).join("../tools/build-wpa-supplicant/out");
set_binary_var(&wpa_dir, "FILE_WPA_SUPPLICANT", "wpa_supplicant");
set_binary_var(&wpa_dir, "FILE_WPA_CLI", "wpa_cli");
}
}
fn set_binary_var(include_dir: &Path, var: &str, file: &str) {
+17 -15
View File
@@ -156,9 +156,6 @@ async fn setup_rayhunter(
) -> Result<ADBUSBDevice> {
let rayhunter_daemon_bin = include_bytes!(env!("FILE_RAYHUNTER_DAEMON"));
let wpa_supplicant_bin = include_bytes!(env!("FILE_WPA_SUPPLICANT"));
let wpa_cli_bin = include_bytes!(env!("FILE_WPA_CLI"));
adb_at_syscmd(
&mut adb_device,
"mkdir -p /data/rayhunter/scripts /data/rayhunter/bin",
@@ -170,18 +167,23 @@ async fn setup_rayhunter(
rayhunter_daemon_bin,
)
.await?;
install_file(
&mut adb_device,
"/data/rayhunter/bin/wpa_supplicant",
wpa_supplicant_bin,
)
.await?;
install_file(&mut adb_device, "/data/rayhunter/bin/wpa_cli", wpa_cli_bin).await?;
adb_at_syscmd(
&mut adb_device,
"chmod +x /data/rayhunter/bin/wpa_supplicant /data/rayhunter/bin/wpa_cli",
)
.await?;
#[cfg(feature = "wifi-client")]
{
let wpa_supplicant_bin = include_bytes!(env!("FILE_WPA_SUPPLICANT"));
let wpa_cli_bin = include_bytes!(env!("FILE_WPA_CLI"));
install_file(
&mut adb_device,
"/data/rayhunter/bin/wpa_supplicant",
wpa_supplicant_bin,
)
.await?;
install_file(&mut adb_device, "/data/rayhunter/bin/wpa_cli", wpa_cli_bin).await?;
adb_at_syscmd(
&mut adb_device,
"chmod +x /data/rayhunter/bin/wpa_supplicant /data/rayhunter/bin/wpa_cli",
)
.await?;
}
{
let mut conn = AdbConnection {
+22 -11
View File
@@ -233,8 +233,6 @@ async fn setup_rayhunter(
) -> Result<()> {
let addr = SocketAddr::from_str(&format!("{admin_ip}:{TELNET_PORT}"))?;
let rayhunter_daemon_bin = include_bytes!(env!("FILE_RAYHUNTER_DAEMON"));
let wpa_supplicant_bin = include_bytes!(env!("FILE_WPA_SUPPLICANT"));
let wpa_cli_bin = include_bytes!(env!("FILE_WPA_CLI"));
// Remount filesystem as read-write to allow modifications
// This is really only necessary for the Moxee Hotspot
@@ -267,14 +265,19 @@ async fn setup_rayhunter(
false,
)
.await?;
telnet_send_file(
addr,
"/data/rayhunter/bin/wpa_supplicant",
wpa_supplicant_bin,
false,
)
.await?;
telnet_send_file(addr, "/data/rayhunter/bin/wpa_cli", wpa_cli_bin, false).await?;
#[cfg(feature = "wifi-client")]
{
let wpa_supplicant_bin = include_bytes!(env!("FILE_WPA_SUPPLICANT"));
let wpa_cli_bin = include_bytes!(env!("FILE_WPA_CLI"));
telnet_send_file(
addr,
"/data/rayhunter/bin/wpa_supplicant",
wpa_supplicant_bin,
false,
)
.await?;
telnet_send_file(addr, "/data/rayhunter/bin/wpa_cli", wpa_cli_bin, false).await?;
}
let wifi_enabled = wifi_ssid.is_some() && wifi_password.is_some();
install_config(&mut conn, "orbic", reset_config, wifi_enabled).await?;
@@ -305,7 +308,15 @@ async fn setup_rayhunter(
telnet_send_command(
addr,
"chmod +x /data/rayhunter/rayhunter-daemon /data/rayhunter/bin/wpa_supplicant /data/rayhunter/bin/wpa_cli",
"chmod +x /data/rayhunter/rayhunter-daemon",
"exit code 0",
false,
)
.await?;
#[cfg(feature = "wifi-client")]
telnet_send_command(
addr,
"chmod +x /data/rayhunter/bin/wpa_supplicant /data/rayhunter/bin/wpa_cli",
"exit code 0",
false,
)