mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-20 06:56:17 -05:00
Make BUILD_GUI=0 avoid using GUI libraries & better errors when spawn fails (#592)
Co-authored-by: Mark Sheppard <[email protected]> Co-authored-by: Kevin Yue <[email protected]>
This commit is contained in:
commit
635fd9f8bf
6 files changed
+36
-17
No files matched your search
@@ -111,7 +111,7 @@ build-rs:
|
|||||||
if [ $(BUILD_GUI) -eq 1 ]; then \
|
if [ $(BUILD_GUI) -eq 1 ]; then \
|
||||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth -p gpgui-helper; \
|
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth -p gpgui-helper; \
|
||||||
else \
|
else \
|
||||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth; \
|
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth --no-default-features; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -288,13 +288,16 @@ This project includes a DevContainer configuration that provides a consistent, r
|
|||||||
```
|
```
|
||||||
|
|
||||||
3. **Build the project:**
|
3. **Build the project:**
|
||||||
|
|
||||||
|
To build everything including the GUI helper run this command:
|
||||||
```bash
|
```bash
|
||||||
docker run --privileged --cap-add=NET_ADMIN --device=/dev/net/tun \
|
docker run --privileged --cap-add=NET_ADMIN --device=/dev/net/tun \
|
||||||
-v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \
|
--tty -v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \
|
||||||
bash -c "export PATH=/usr/local/cargo/bin:\$PATH && make build"
|
bash -c "export PATH=/usr/local/cargo/bin:\$PATH && make build"
|
||||||
```
|
```
|
||||||
|
To build without the GUI helper run the same command as above, but with `BUILD_GUI=0` passed as an argument to `make`.
|
||||||
|
|
||||||
4. **Locate build artifacts:**
|
5. **Locate build artifacts:**
|
||||||
|
|
||||||
The compiled binaries will be available in `target/release/`:
|
The compiled binaries will be available in `target/release/`:
|
||||||
- `gpclient` – CLI client
|
- `gpclient` – CLI client
|
||||||
|
|||||||
@@ -177,12 +177,16 @@ impl<'a> SamlAuthLauncher<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut non_root_cmd = auth_cmd.into_non_root()?;
|
let mut non_root_cmd = auth_cmd.into_non_root()?;
|
||||||
let output = non_root_cmd
|
let child = non_root_cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn();
|
||||||
.kill_on_drop(true)
|
|
||||||
.stdout(Stdio::piped())
|
let child = match child {
|
||||||
.spawn()?
|
Ok(child) => child,
|
||||||
.wait_with_output()
|
Err(err) => {
|
||||||
.await?;
|
bail!("Failed to spawn {}: {}", program, err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let output = child.wait_with_output().await?;
|
||||||
|
|
||||||
let Ok(auth_result) = serde_json::from_slice::<SamlAuthResult>(&output.stdout) else {
|
let Ok(auth_result) = serde_json::from_slice::<SamlAuthResult>(&output.stdout) else {
|
||||||
bail!("Failed to parse auth data")
|
bail!("Failed to parse auth data")
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ impl<'a> GuiHelperLauncher<'a> {
|
|||||||
|
|
||||||
info!("Launching gpgui-helper");
|
info!("Launching gpgui-helper");
|
||||||
let mut non_root_cmd = cmd.into_non_root()?;
|
let mut non_root_cmd = cmd.into_non_root()?;
|
||||||
let mut child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn()?;
|
let child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn();
|
||||||
|
let mut child = match child {
|
||||||
|
Ok(child) => child,
|
||||||
|
Err(err) => bail!("Failed to spawn {}: {}", self.program.display(), err),
|
||||||
|
};
|
||||||
|
|
||||||
let Some(mut stdin) = child.stdin.take() else {
|
let Some(mut stdin) = child.stdin.take() else {
|
||||||
bail!("Failed to open stdin");
|
bail!("Failed to open stdin");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -69,7 +69,12 @@ impl<'a> GuiLauncher<'a> {
|
|||||||
|
|
||||||
info!("Launching gpgui");
|
info!("Launching gpgui");
|
||||||
let mut non_root_cmd = cmd.into_non_root()?;
|
let mut non_root_cmd = cmd.into_non_root()?;
|
||||||
let mut child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn()?;
|
let child = non_root_cmd.kill_on_drop(true).stdin(Stdio::piped()).spawn();
|
||||||
|
let mut child = match child {
|
||||||
|
Ok(child) => child,
|
||||||
|
Err(err) => bail!("Failed to spawn {}: {}", self.program.display(), err),
|
||||||
|
};
|
||||||
|
|
||||||
let Some(mut stdin) = child.stdin.take() else {
|
let Some(mut stdin) = child.stdin.take() else {
|
||||||
bail!("Failed to open stdin");
|
bail!("Failed to open stdin");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -72,12 +72,14 @@ impl<'a> HipLauncher<'a> {
|
|||||||
cmd.env("APP_VERSION", client_version);
|
cmd.env("APP_VERSION", client_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = cmd
|
let child = cmd.kill_on_drop(true).stdout(Stdio::piped()).spawn();
|
||||||
.kill_on_drop(true)
|
|
||||||
.stdout(Stdio::piped())
|
let child = match child {
|
||||||
.spawn()?
|
Ok(child) => child,
|
||||||
.wait_with_output()
|
Err(err) => bail!("Failed to spawn {}: {}", self.program, err),
|
||||||
.await?;
|
};
|
||||||
|
|
||||||
|
let output = child.wait_with_output().await?;
|
||||||
|
|
||||||
if let Some(exit_status) = output.status.code() {
|
if let Some(exit_status) = output.status.code() {
|
||||||
if exit_status != 0 {
|
if exit_status != 0 {
|
||||||
|
|||||||
Reference in new issue
Block a user