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
+25 -1
View File
@@ -11,6 +11,8 @@ env:
CARGO_TERM_COLOR: always
FILE_ROOTSHELL: ../../rootshell/rootshell
FILE_RAYHUNTER_DAEMON: ../../rayhunter-daemon/rayhunter-daemon
FILE_WPA_SUPPLICANT: ../../wpa-supplicant/wpa_supplicant
FILE_WPA_CLI: ../../wpa-supplicant/wpa_cli
RUSTFLAGS: "-Dwarnings"
jobs:
@@ -301,6 +303,27 @@ jobs:
path: target/armv7-unknown-linux-musleabihf/firmware/rootshell
if-no-files-found: error
build_wpa_supplicant:
if: needs.files_changed.outputs.installer_changed == 'true'
needs:
- files_changed
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Build wpa_supplicant (armv7)
run: docker build --target export --output tools/build-wpa-supplicant/out tools/build-wpa-supplicant
- uses: actions/upload-artifact@v4
with:
name: wpa-supplicant
path: |
tools/build-wpa-supplicant/out/wpa_supplicant
tools/build-wpa-supplicant/out/wpa_cli
if-no-files-found: error
build_rayhunter:
if: needs.files_changed.outputs.daemon_needed == 'true'
needs:
@@ -349,6 +372,7 @@ jobs:
needs:
- build_rayhunter
- build_rootshell
- build_wpa_supplicant
- files_changed
- windows_installer_check_and_test
strategy:
@@ -382,7 +406,7 @@ jobs:
with:
targets: ${{ matrix.platform.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --package installer --bin installer --release --target ${{ matrix.platform.target }}
- run: cargo build --package installer --bin installer --release --features wifi-client --target ${{ matrix.platform.target }}
- uses: actions/upload-artifact@v4
with:
name: installer-${{ matrix.platform.name }}
+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,
)