Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for xz archive? #143

Open
hey2022 opened this issue Dec 11, 2024 · 0 comments
Open

Support for xz archive? #143

hey2022 opened this issue Dec 11, 2024 · 0 comments

Comments

@hey2022
Copy link

hey2022 commented Dec 11, 2024

Sorry if I somehow missed this in the docs, but does self_update support xz compression for formats such as .tar.xz
I'm having trouble running the updated binary from a .tar.xz archive, but I'm not sure if this is the reason causing the problem.

Here is my update code that I took from the README

// Cargo.toml
self_update = {version = "0.41.0", features = ["archive-tar", "archive-zip", "compression-flate2", "compression-zip-deflate"]}
fn update() -> Result<(), Box<dyn (::std::error::Error)>> {
    let status = self_update::backends::github::Update::configure()
        .repo_owner("hey2022")
        .repo_name("tls-xb")
        .bin_name("tls-xb")
        .show_download_progress(true)
        .current_version(cargo_crate_version!())
        .build()?
        .update()?;
    println!("Update status: `{}`!", status.version());
    Ok(())
}

The output:

Checking target-arch... x86_64-unknown-linux-gnu
Checking current version... v0.3.5
Checking latest released version... v0.3.6
New release found! v0.3.5 --> v0.3.6
New release is compatible

tls-xb release status:
  * Current exe: "/home/yiheng/.cargo/bin/tls-xb"
  * New exe release: "tls-xb-x86_64-unknown-linux-gnu.tar.xz"
  * New exe download url: "https://api.github.com/repos/hey2022/tls-xb/releases/assets/212553928"

The new release will be downloaded/extracted and the existing binary will be replaced.
Do you want to continue? [Y/n]
Downloading...
[00:00:00] [========================================] 2.65 MiB/2.65 MiB (0s) Done                                                            Extracting archive... Done
Replacing binary file... Done
Update status: `0.3.6`!

Trying to run the program again results in:

exec: Failed to execute process: '/home/yiheng/.cargo/bin/tls-xb' the file could not be run by the operating system.

The output of tar -tf /home/yiheng/.cargo/bin/tls-xb shows that /home/yiheng/.cargo/bin/tls-xb is still a tar archive

tar -tf ~/.cargo/bin/tls-xb
tls-xb-x86_64-unknown-linux-gnu/
tls-xb-x86_64-unknown-linux-gnu/README.md
tls-xb-x86_64-unknown-linux-gnu/tls-xb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant