mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-18 22:16:18 -05:00
fix: separate packaged and runtime GUI binaries
This commit is contained in:
15 files changed
+251
-59
No files matched your search
Generated
+1
@@ -1966,6 +1966,7 @@ dependencies = [
|
||||
"openconnect",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha256",
|
||||
"tar",
|
||||
"tempfile",
|
||||
"thiserror 2.0.18",
|
||||
|
||||
@@ -252,8 +252,10 @@ package-openbsd: clean-bsd-package
|
||||
cp packaging/bsd/openbsd/COMMENT .build/openbsd/+COMMENT
|
||||
cp packaging/bsd/openbsd/DESC .build/openbsd/+DESC
|
||||
{ \
|
||||
echo '@unexec-delete /bin/rm -f /var/db/gpclient/scripts/vpnc-script /var/db/gpclient/scripts/vpnc-script.metadata || echo "Warning: failed to remove the installed VPN script" >&2'; \
|
||||
echo '@unexec-delete /bin/rm -f /usr/local/libexec/gpclient/gpgui /var/db/gpclient/scripts/vpnc-script /var/db/gpclient/scripts/vpnc-script.metadata || echo "Warning: failed to remove gpclient runtime files" >&2'; \
|
||||
echo '@unexec-delete /bin/rmdir /usr/local/libexec/gpclient 2>/dev/null || true'; \
|
||||
echo '@unexec-delete /bin/rmdir /var/db/gpclient/scripts 2>/dev/null || true'; \
|
||||
echo '@unexec-delete /bin/rmdir /var/db/gpclient 2>/dev/null || true'; \
|
||||
find .build/openbsd/pkgroot$(PREFIX) -type f -print | sed 's|^.build/openbsd/pkgroot$(PREFIX)/||' | sort; \
|
||||
} > .build/openbsd/PLIST
|
||||
comment=$$(cat .build/openbsd/+COMMENT); \
|
||||
@@ -300,10 +302,12 @@ uninstall:
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
|
||||
rm -f $(DESTDIR)/var/lib/gpclient/gpgui \
|
||||
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
|
||||
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true
|
||||
rmdir $(DESTDIR)/var/lib/gpclient 2>/dev/null || true
|
||||
|
||||
clean-debian:
|
||||
rm -rf .build/deb
|
||||
|
||||
@@ -41,6 +41,22 @@ const GUI_LIBC_SUFFIX: &str = "-musl";
|
||||
#[cfg(not(target_env = "musl"))]
|
||||
const GUI_LIBC_SUFFIX: &str = "";
|
||||
|
||||
fn gui_asset_name() -> Option<String> {
|
||||
gui_asset_name_for(std::env::consts::OS, std::env::consts::ARCH, GUI_LIBC_SUFFIX)
|
||||
}
|
||||
|
||||
fn gui_asset_name_for(os: &str, arch: &str, libc_suffix: &str) -> Option<String> {
|
||||
let name = match (os, arch) {
|
||||
("linux", "x86_64" | "aarch64") => format!("gpgui_{arch}{libc_suffix}.bin.tar.xz"),
|
||||
("freebsd", "x86_64") => "gpgui_freebsd_amd64.bin.tar.xz".to_owned(),
|
||||
("freebsd", "aarch64") => "gpgui_freebsd_arm64.bin.tar.xz".to_owned(),
|
||||
("openbsd", "x86_64") => "gpgui_openbsd_amd64.bin.tar.xz".to_owned(),
|
||||
("openbsd", "aarch64") => "gpgui_openbsd_arm64.bin.tar.xz".to_owned(),
|
||||
_ => return None,
|
||||
};
|
||||
Some(name)
|
||||
}
|
||||
|
||||
pub struct ProgressNotifier {
|
||||
win: WebviewWindow,
|
||||
}
|
||||
@@ -366,10 +382,10 @@ impl GuiUpdater {
|
||||
}
|
||||
|
||||
pub async fn update(&self) {
|
||||
if !cfg!(any(target_arch = "x86_64", target_arch = "aarch64")) {
|
||||
info!("GUI version is not supported on this architecture.");
|
||||
let Some(asset_name) = gui_asset_name() else {
|
||||
info!("GUI updates are not supported on this platform.");
|
||||
return;
|
||||
}
|
||||
};
|
||||
info!("Update GUI, version: {}", self.version);
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
@@ -381,16 +397,8 @@ impl GuiUpdater {
|
||||
format!("v{}", self.version)
|
||||
};
|
||||
|
||||
let arch = if cfg!(target_arch = "x86_64") {
|
||||
"x86_64"
|
||||
} else {
|
||||
"aarch64"
|
||||
};
|
||||
|
||||
let file_url = format!(
|
||||
"https://github.com/yuezk/GlobalProtect-openconnect/releases/download/{}/gpgui_{}{}.bin.tar.xz",
|
||||
release_tag, arch, GUI_LIBC_SUFFIX
|
||||
);
|
||||
let file_url =
|
||||
format!("https://github.com/yuezk/GlobalProtect-openconnect/releases/download/{release_tag}/{asset_name}");
|
||||
let checksum_url = format!("{}.sha256", file_url);
|
||||
|
||||
info!("Downloading file: {}", file_url);
|
||||
@@ -494,6 +502,27 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn selects_platform_specific_gui_assets() {
|
||||
assert_eq!(
|
||||
gui_asset_name_for("linux", "x86_64", ""),
|
||||
Some("gpgui_x86_64.bin.tar.xz".to_owned())
|
||||
);
|
||||
assert_eq!(
|
||||
gui_asset_name_for("linux", "aarch64", "-musl"),
|
||||
Some("gpgui_aarch64-musl.bin.tar.xz".to_owned())
|
||||
);
|
||||
assert_eq!(
|
||||
gui_asset_name_for("freebsd", "x86_64", ""),
|
||||
Some("gpgui_freebsd_amd64.bin.tar.xz".to_owned())
|
||||
);
|
||||
assert_eq!(
|
||||
gui_asset_name_for("openbsd", "aarch64", ""),
|
||||
Some("gpgui_openbsd_arm64.bin.tar.xz".to_owned())
|
||||
);
|
||||
assert_eq!(gui_asset_name_for("macos", "aarch64", ""), None);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn pending_install_reconnects_with_a_fresh_handshake() {
|
||||
let credential = Arc::new(SessionCredential::generate(Uuid::new_v4(), env!("CARGO_PKG_VERSION")).unwrap());
|
||||
|
||||
@@ -31,3 +31,4 @@ nix = { version = "0.31", features = ["fs", "socket", "user"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-tungstenite = "0.29"
|
||||
sha256.workspace = true
|
||||
@@ -160,7 +160,10 @@ enum GuiInstallError {
|
||||
}
|
||||
|
||||
fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
|
||||
let target = binary_paths::gpgui();
|
||||
install_gui_at(Path::new(src), checksum, &binary_paths::gpgui_update_target())
|
||||
}
|
||||
|
||||
fn install_gui_at(src: &Path, checksum: &str, target: &Path) -> Result<(), GuiInstallError> {
|
||||
let Some(dir) = target.parent() else {
|
||||
return Err(GuiInstallError::Install(anyhow::anyhow!(
|
||||
"Failed to get parent directory of GUI binary"
|
||||
@@ -168,7 +171,7 @@ fn install_gui(src: &str, checksum: &str) -> Result<(), GuiInstallError> {
|
||||
};
|
||||
fs::create_dir_all(dir).map_err(|err| GuiInstallError::Install(err.into()))?;
|
||||
|
||||
let staged_archive = stage_gui_archive(Path::new(src), dir)?;
|
||||
let staged_archive = stage_gui_archive(src, dir)?;
|
||||
let archive_path = staged_archive.path().to_string_lossy();
|
||||
verify_checksum(&archive_path, checksum).map_err(GuiInstallError::Checksum)?;
|
||||
|
||||
@@ -260,7 +263,7 @@ fn extract_gui_binary<R: Read>(archive: &mut Archive<R>, dir: &Path) -> Result<N
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::io::Cursor;
|
||||
use std::{io::Cursor, os::unix::fs::PermissionsExt};
|
||||
|
||||
use gpapi::{
|
||||
gateway::Gateway,
|
||||
@@ -270,6 +273,7 @@ mod tests {
|
||||
},
|
||||
};
|
||||
use tar::{Builder, EntryType, Header};
|
||||
use xz2::write::XzEncoder;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -288,6 +292,17 @@ mod tests {
|
||||
data
|
||||
}
|
||||
|
||||
fn compressed_gui_archive(contents: &[u8]) -> NamedTempFile {
|
||||
let tar = archive_with_entry(EntryType::Regular, contents);
|
||||
let mut encoder = XzEncoder::new(Vec::new(), 6);
|
||||
encoder.write_all(&tar).unwrap();
|
||||
let compressed = encoder.finish().unwrap();
|
||||
let mut archive = NamedTempFile::new().unwrap();
|
||||
archive.write_all(&compressed).unwrap();
|
||||
archive.flush().unwrap();
|
||||
archive
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_non_file_and_empty_gui_entries() {
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
@@ -337,6 +352,31 @@ mod tests {
|
||||
assert!(extract_gui_binary(&mut archive, output.path()).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installs_gui_at_the_supplied_target() {
|
||||
let archive = compressed_gui_archive(b"gui binary");
|
||||
let checksum = sha256::try_digest(archive.path()).unwrap();
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpclient/gpgui");
|
||||
|
||||
install_gui_at(archive.path(), &checksum, &target).unwrap();
|
||||
|
||||
assert_eq!(std::fs::read(&target).unwrap(), b"gui binary");
|
||||
assert_eq!(std::fs::metadata(&target).unwrap().permissions().mode() & 0o777, 0o755);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn checksum_failure_preserves_the_existing_gui() {
|
||||
let archive = compressed_gui_archive(b"replacement");
|
||||
let output = tempfile::tempdir().unwrap();
|
||||
let target = output.path().join("gpclient/gpgui");
|
||||
std::fs::create_dir_all(target.parent().unwrap()).unwrap();
|
||||
std::fs::write(&target, b"existing").unwrap();
|
||||
|
||||
assert!(install_gui_at(archive.path(), "invalid", &target).is_err());
|
||||
assert_eq!(std::fs::read(target).unwrap(), b"existing");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn brokered_mode_rejects_gui_management_and_root_readable_identity_paths() {
|
||||
let (request_tx, _request_rx) = mpsc::channel(1);
|
||||
|
||||
@@ -3,6 +3,11 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
#[cfg(all(
|
||||
not(debug_assertions),
|
||||
any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")
|
||||
))]
|
||||
use crate::constants::GP_DOWNLOADED_GUI_BINARY;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
use crate::constants::GP_VPNC_SCRIPT_INSTALLER_BINARY;
|
||||
use crate::constants::{GP_AUTH_BINARY, GP_CLIENT_BINARY, GP_GUI_BINARY, GP_GUI_HELPER_BINARY, GP_SERVICE_BINARY};
|
||||
@@ -32,6 +37,24 @@ pub fn gpgui() -> PathBuf {
|
||||
resolve("GP_GUI_BINARY", "gpgui", GP_GUI_BINARY)
|
||||
}
|
||||
|
||||
pub fn gpgui_update_target() -> PathBuf {
|
||||
#[cfg(all(
|
||||
not(debug_assertions),
|
||||
any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")
|
||||
))]
|
||||
{
|
||||
PathBuf::from(GP_DOWNLOADED_GUI_BINARY)
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
debug_assertions,
|
||||
not(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))
|
||||
))]
|
||||
{
|
||||
gpgui()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gpgui_helper() -> PathBuf {
|
||||
resolve("GP_GUI_HELPER_BINARY", "gpgui-helper", GP_GUI_HELPER_BINARY)
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ pub const GP_CLIENT_BINARY: &str = "/usr/local/bin/gpclient";
|
||||
pub const GP_SERVICE_BINARY: &str = "/usr/local/bin/gpservice";
|
||||
#[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))]
|
||||
pub const GP_GUI_BINARY: &str = "/usr/local/bin/gpgui";
|
||||
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
|
||||
pub const GP_DOWNLOADED_GUI_BINARY: &str = "/usr/local/libexec/gpclient/gpgui";
|
||||
#[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))]
|
||||
pub const GP_GUI_HELPER_BINARY: &str = "/usr/local/bin/gpgui-helper";
|
||||
#[cfg(all(not(debug_assertions), any(target_os = "freebsd", target_os = "openbsd")))]
|
||||
@@ -69,6 +71,8 @@ pub const GP_SERVICE_BINARY: &str = "/usr/bin/gpservice";
|
||||
not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))
|
||||
))]
|
||||
pub const GP_GUI_BINARY: &str = "/usr/bin/gpgui";
|
||||
#[cfg(target_os = "linux")]
|
||||
pub const GP_DOWNLOADED_GUI_BINARY: &str = "/var/lib/gpclient/gpgui";
|
||||
#[cfg(all(
|
||||
not(debug_assertions),
|
||||
not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
path::PathBuf,
|
||||
path::{Path, PathBuf},
|
||||
process::{ExitStatus, Stdio},
|
||||
sync::Arc,
|
||||
};
|
||||
@@ -16,7 +16,7 @@ use super::command_traits::CommandExt;
|
||||
|
||||
pub struct GuiLauncher<'a> {
|
||||
version: &'a str,
|
||||
program: PathBuf,
|
||||
programs: Vec<PathBuf>,
|
||||
credential: Arc<SessionCredential>,
|
||||
minimized: bool,
|
||||
envs: Option<HashMap<String, String>>,
|
||||
@@ -24,9 +24,17 @@ pub struct GuiLauncher<'a> {
|
||||
|
||||
impl<'a> GuiLauncher<'a> {
|
||||
pub fn new(version: &'a str, credential: Arc<SessionCredential>) -> Self {
|
||||
let primary = binary_paths::gpgui();
|
||||
let update_target = binary_paths::gpgui_update_target();
|
||||
let programs = if primary == update_target {
|
||||
vec![primary]
|
||||
} else {
|
||||
vec![primary, update_target]
|
||||
};
|
||||
|
||||
Self {
|
||||
version,
|
||||
program: binary_paths::gpgui(),
|
||||
programs,
|
||||
credential,
|
||||
minimized: false,
|
||||
envs: None,
|
||||
@@ -44,18 +52,33 @@ impl<'a> GuiLauncher<'a> {
|
||||
}
|
||||
|
||||
pub async fn launch(&self) -> anyhow::Result<ExitStatus> {
|
||||
// Check if the program's version
|
||||
if let Err(err) = self.check_version().await {
|
||||
info!("Check version failed: {}", err);
|
||||
// Download the program and replace the current one
|
||||
self.download_program().await?;
|
||||
if let Some(program) = self.find_compatible_program().await {
|
||||
return self.launch_program(&program).await;
|
||||
}
|
||||
|
||||
self.launch_program().await
|
||||
self.download_program().await?;
|
||||
|
||||
let program = binary_paths::gpgui_update_target();
|
||||
self.check_version(&program).await?;
|
||||
self.launch_program(&program).await
|
||||
}
|
||||
|
||||
async fn launch_program(&self) -> anyhow::Result<ExitStatus> {
|
||||
let mut cmd = Command::new(&self.program);
|
||||
async fn find_compatible_program(&self) -> Option<PathBuf> {
|
||||
for program in &self.programs {
|
||||
match self.check_version(program).await {
|
||||
Ok(()) => return Some(program.clone()),
|
||||
Err(err) => info!(
|
||||
"GUI candidate {} is unavailable or incompatible: {err}",
|
||||
program.display()
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
async fn launch_program(&self, program: &Path) -> anyhow::Result<ExitStatus> {
|
||||
let mut cmd = Command::new(program);
|
||||
|
||||
if let Some(envs) = &self.envs {
|
||||
cmd.env_clear();
|
||||
@@ -73,7 +96,7 @@ impl<'a> GuiLauncher<'a> {
|
||||
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),
|
||||
Err(err) => bail!("Failed to spawn {}: {}", program.display(), err),
|
||||
};
|
||||
|
||||
let Some(mut stdin) = child.stdin.take() else {
|
||||
@@ -89,9 +112,18 @@ impl<'a> GuiLauncher<'a> {
|
||||
Ok(exit_status)
|
||||
}
|
||||
|
||||
async fn check_version(&self) -> anyhow::Result<()> {
|
||||
let cmd = Command::new(&self.program).arg("--version").output().await?;
|
||||
let output = String::from_utf8_lossy(&cmd.stdout);
|
||||
async fn check_version(&self, program: &Path) -> anyhow::Result<()> {
|
||||
let mut cmd = Command::new(program);
|
||||
if let Some(envs) = &self.envs {
|
||||
cmd.env_clear();
|
||||
cmd.envs(envs);
|
||||
}
|
||||
cmd.arg("--version");
|
||||
let output = cmd.into_non_root()?.output().await?;
|
||||
if !output.status.success() {
|
||||
bail!("Version command exited with {}", output.status);
|
||||
}
|
||||
let output = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
// Version string: "gpgui 2.0.0 (2024-02-05)"
|
||||
let Some(version) = output.split_whitespace().nth(1) else {
|
||||
@@ -114,11 +146,68 @@ impl<'a> GuiLauncher<'a> {
|
||||
.envs(self.envs.as_ref())
|
||||
.gui_version(Some(self.version))
|
||||
.launch()
|
||||
.await?;
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
// Check the version again
|
||||
self.check_version().await?;
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{fs, os::unix::fs::PermissionsExt};
|
||||
|
||||
Ok(())
|
||||
use tempfile::TempDir;
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::*;
|
||||
|
||||
const VERSION: &str = "test-version";
|
||||
|
||||
fn executable(dir: &TempDir, name: &str, output: &str, exit_code: i32) -> PathBuf {
|
||||
let path = dir.path().join(name);
|
||||
fs::write(
|
||||
&path,
|
||||
format!("#!/bin/sh\nprintf '%s\\n' '{output}'\nexit {exit_code}\n"),
|
||||
)
|
||||
.unwrap();
|
||||
fs::set_permissions(&path, fs::Permissions::from_mode(0o755)).unwrap();
|
||||
path
|
||||
}
|
||||
|
||||
fn launcher(version: &'static str, programs: Vec<PathBuf>) -> GuiLauncher<'static> {
|
||||
GuiLauncher {
|
||||
version,
|
||||
programs,
|
||||
credential: Arc::new(SessionCredential::generate(Uuid::new_v4(), version).unwrap()),
|
||||
minimized: false,
|
||||
envs: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn prefers_the_first_compatible_program() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let packaged = executable(&dir, "packaged", "gpgui test-version", 0);
|
||||
let downloaded = executable(&dir, "downloaded", "gpgui test-version", 0);
|
||||
let launcher = launcher(VERSION, vec![packaged.clone(), downloaded]);
|
||||
|
||||
assert_eq!(launcher.find_compatible_program().await, Some(packaged));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn falls_back_when_the_first_program_is_incompatible() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let packaged = executable(&dir, "packaged", "gpgui other-version", 0);
|
||||
let downloaded = executable(&dir, "downloaded", "gpgui test-version", 0);
|
||||
let launcher = launcher(VERSION, vec![packaged, downloaded.clone()]);
|
||||
|
||||
assert_eq!(launcher.find_compatible_program().await, Some(downloaded));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn rejects_an_unsuccessful_version_command() {
|
||||
let dir = TempDir::new().unwrap();
|
||||
let program = executable(&dir, "broken", "gpgui test-version", 1);
|
||||
let launcher = launcher(VERSION, vec![program]);
|
||||
|
||||
assert_eq!(launcher.find_compatible_program().await, None);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
rm -f \
|
||||
/var/lib/gpclient/gpgui \
|
||||
/var/lib/gpclient/scripts/vpnc-script \
|
||||
/var/lib/gpclient/scripts/vpnc-script.metadata ||
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
|
||||
rmdir /var/lib/gpclient 2>/dev/null || true
|
||||
@@ -3,22 +3,19 @@ post_install() {
|
||||
update-desktop-database -q
|
||||
}
|
||||
|
||||
pre_upgrade() {
|
||||
rm -f /usr/bin/gpgui
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
update-mime-database /usr/share/mime
|
||||
update-desktop-database -q
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
rm -f /usr/bin/gpgui
|
||||
rm -f \
|
||||
/var/lib/gpclient/gpgui \
|
||||
/var/lib/gpclient/scripts/vpnc-script \
|
||||
/var/lib/gpclient/scripts/vpnc-script.metadata ||
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
|
||||
rmdir /var/lib/gpclient 2>/dev/null || true
|
||||
update-mime-database /usr/share/mime
|
||||
update-desktop-database -q
|
||||
}
|
||||
@@ -53,6 +53,8 @@ uninstall:
|
||||
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
rm -f $(DESTDIR)/var/lib/gpclient/scripts/vpnc-script \
|
||||
$(DESTDIR)/var/lib/gpclient/gpgui \
|
||||
$(DESTDIR)/var/lib/gpclient/scripts/vpnc-script.metadata || \
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir $(DESTDIR)/var/lib/gpclient/scripts 2>/dev/null || true
|
||||
rmdir $(DESTDIR)/var/lib/gpclient 2>/dev/null || true
|
||||
@@ -3,7 +3,10 @@
|
||||
root=${PKG_ROOTDIR:-}
|
||||
|
||||
rm -f \
|
||||
"$root/usr/local/libexec/gpclient/gpgui" \
|
||||
"$root/var/db/gpclient/scripts/vpnc-script" \
|
||||
"$root/var/db/gpclient/scripts/vpnc-script.metadata" ||
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir "$root/usr/local/libexec/gpclient" 2>/dev/null || true
|
||||
rmdir "$root/var/db/gpclient/scripts" 2>/dev/null || true
|
||||
rmdir "$root/var/db/gpclient" 2>/dev/null || true
|
||||
@@ -4,18 +4,12 @@ set -e
|
||||
case "$1" in
|
||||
purge|remove)
|
||||
rm -f \
|
||||
/var/lib/gpclient/gpgui \
|
||||
/var/lib/gpclient/scripts/vpnc-script \
|
||||
/var/lib/gpclient/scripts/vpnc-script.metadata ||
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
|
||||
|
||||
# Remove the gpgui binary downloaded at runtime
|
||||
rm -f /usr/bin/gpgui
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
# Remove the gpgui binary downloaded at runtime
|
||||
rm -f /usr/bin/gpgui
|
||||
rmdir /var/lib/gpclient 2>/dev/null || true
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
post_remove() {
|
||||
rm -f \
|
||||
/var/lib/gpclient/gpgui \
|
||||
/var/lib/gpclient/scripts/vpnc-script \
|
||||
/var/lib/gpclient/scripts/vpnc-script.metadata ||
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir /var/lib/gpclient/scripts 2>/dev/null || true
|
||||
rmdir /var/lib/gpclient 2>/dev/null || true
|
||||
}
|
||||
@@ -51,12 +51,13 @@ A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authenticati
|
||||
|
||||
%postun
|
||||
if [ "$1" -eq 0 ]; then
|
||||
rm -f %{_bindir}/gpgui
|
||||
rm -f \
|
||||
/var/lib/gpclient/gpgui \
|
||||
/var/lib/gpclient/scripts/vpnc-script \
|
||||
/var/lib/gpclient/scripts/vpnc-script.metadata ||
|
||||
echo "Warning: failed to remove the installed VPN script" >&2
|
||||
echo "Warning: failed to remove gpclient runtime files" >&2
|
||||
rmdir /var/lib/gpclient/scripts 2>/dev/null || :
|
||||
rmdir /var/lib/gpclient 2>/dev/null || :
|
||||
fi
|
||||
|
||||
%build
|
||||
|
||||
Reference in new issue
Block a user