···99#![cfg_attr(debug_assertions, allow(dead_code))]
10101111use anyhow::{Context, Result};
1212-use flate2::read::GzDecoder;
1312use std::{
1413 io,
1514 os::unix::fs::PermissionsExt,
1615 path::{Path, PathBuf},
1716};
1717+use xz2::read::XzDecoder;
1818use tar::Archive;
1919use tokio::{fs, process::Command, task};
2020···4949 let ver = version.trim_start_matches('v');
5050 let tag = format!("v{ver}");
5151 let triple = target_triple();
5252- // cargo-dist names archives as "{package}-{triple}.tar.gz" (no version in filename).
5353- let archive_name = format!("ein-server-{triple}.tar.gz");
5252+ // cargo-dist names archives as "{package}-{triple}.tar.xz" (no version in filename).
5353+ let archive_name = format!("ein-server-{triple}.tar.xz");
5454 let url = format!("https://github.com/{GITHUB_REPO}/releases/download/{tag}/{archive_name}");
55555656 let dest = server_bin_path();
···8787 Ok(())
8888}
89899090-/// Extracts the `ein-server` binary from a tar.gz archive into `dest`.
9090+/// Extracts the `ein-server` binary from a tar.xz archive into `dest`.
9191fn extract_server(bytes: &[u8], dest: &Path) -> Result<()> {
9292- let gz = GzDecoder::new(io::Cursor::new(bytes));
9393- let mut archive = Archive::new(gz);
9292+ let xz = XzDecoder::new(io::Cursor::new(bytes));
9393+ let mut archive = Archive::new(xz);
94949595 for entry in archive
9696 .entries()
···199199 fs::remove_file(&unit)
200200 .await
201201 .with_context(|| format!("failed to remove {}", unit.display()))?;
202202- steps.push(format!("Removed systemd user service ({})", SYSTEMD_SERVICE_NAME));
202202+ steps.push(format!(
203203+ "Removed systemd user service ({})",
204204+ SYSTEMD_SERVICE_NAME
205205+ ));
203206 }
204207 let _ = Command::new("systemctl")
205208 .args(["--user", "daemon-reload"])