Skip to content

Support for xz archive? #143

@hey2022

Description

@hey2022

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions