{"id":13579205,"url":"https://github.com/jaemk/self_update","last_synced_at":"2025-05-14T15:07:41.147Z","repository":{"id":41858789,"uuid":"98250136","full_name":"jaemk/self_update","owner":"jaemk","description":"Self updates for rust executables","archived":false,"fork":false,"pushed_at":"2024-12-31T17:56:21.000Z","size":336,"stargazers_count":861,"open_issues_count":48,"forks_count":80,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-12T01:19:58.094Z","etag":null,"topics":["rust","rust-executables","update","upgrade"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaemk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-25T01:26:48.000Z","updated_at":"2025-05-12T00:56:54.000Z","dependencies_parsed_at":"2024-01-14T10:59:34.565Z","dependency_job_id":"8d853771-d923-466b-a7e3-374519d86a31","html_url":"https://github.com/jaemk/self_update","commit_stats":{"total_commits":234,"total_committers":27,"mean_commits":8.666666666666666,"dds":0.6965811965811965,"last_synced_commit":"1a507bb4cd687d14e044dce8b7b2d66846ea581c"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fself_update","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fself_update/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fself_update/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaemk%2Fself_update/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaemk","download_url":"https://codeload.github.com/jaemk/self_update/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254169735,"owners_count":22026214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","rust-executables","update","upgrade"],"created_at":"2024-08-01T15:01:37.382Z","updated_at":"2025-05-14T15:07:41.124Z","avatar_url":"https://github.com/jaemk.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# self_update\n\n\n[![Build status](https://ci.appveyor.com/api/projects/status/xlkq8rd73cla4ixw/branch/master?svg=true)](https://ci.appveyor.com/project/jaemk/self-update/branch/master)\n[![Build Status](https://travis-ci.org/jaemk/self_update.svg?branch=master)](https://travis-ci.org/jaemk/self_update)\n[![crates.io:clin](https://img.shields.io/crates/v/self_update.svg?label=self_update)](https://crates.io/crates/self_update)\n[![docs](https://docs.rs/self_update/badge.svg)](https://docs.rs/self_update)\n\n\n`self_update` provides updaters for updating rust executables in-place from various release\ndistribution backends.\n\n## Usage\n\nUpdate (replace) the current executable with the latest release downloaded\nfrom `https://api.github.com/repos/jaemk/self_update/releases/latest`.\nNote, the [`trust`](https://github.com/japaric/trust) project provides a nice setup for\nproducing release-builds via CI (travis/appveyor).\n\n### Features\n\nThe following [cargo features](https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section) are\navailable (but _disabled_ by default):\n\n* `archive-tar`: Support for _tar_ archive format;\n* `archive-zip`: Support for _zip_ archive format;\n* `compression-flate2`: Support for _gzip_ compression;\n* `compression-zip-deflate`: Support for _zip_'s _deflate_ compression format;\n* `compression-zip-bzip2`: Support for _zip_'s _bzip2_ compression format;\n* `rustls`: Use [pure rust TLS implementation](https://github.com/ctz/rustls) for network requests. This feature does _not_ support 32bit macOS;\n* `signatures`: Use [zipsign](https://github.com/Kijewski/zipsign) to verify `.zip` and `.tar.gz` artifacts. Artifacts are assumed to have been signed using zipsign.\n\nPlease activate the feature(s) needed by your release files.\n\n### Example\n\nRun the following example to see `self_update` in action:\n\n`cargo run --example github --features \"archive-tar archive-zip compression-flate2 compression-zip-deflate\"`.\n\nThere's also an equivalent example for gitlab:\n\n`cargo run --example gitlab --features \"archive-tar archive-zip compression-flate2 compression-zip-deflate\"`.\n\nwhich runs something roughly equivalent to:\n\n```rust\nuse self_update::cargo_crate_version;\n\nfn update() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let status = self_update::backends::github::Update::configure()\n        .repo_owner(\"jaemk\")\n        .repo_name(\"self_update\")\n        .bin_name(\"github\")\n        .show_download_progress(true)\n        .current_version(cargo_crate_version!())\n        .build()?\n        .update()?;\n    println!(\"Update status: `{}`!\", status.version());\n    Ok(())\n}\n```\n\nAmazon S3, Google GCS, and DigitalOcean Spaces are also supported through the `S3` backend to check for new releases. Provided a `bucket_name`\nand `asset_prefix` string, `self_update` will look up all matching files using the following format\nas a convention for the filenames: `[directory/]\u003casset name\u003e-\u003csemver\u003e-\u003cplatform/target\u003e.\u003cextension\u003e`.\nLeading directories will be stripped from the file name allowing the use of subdirectories in the S3 bucket,\nand any file not matching the format, or not matching the provided prefix string, will be ignored.\n\n```rust\nuse self_update::cargo_crate_version;\n\nfn update() -\u003e Result\u003c(), Box\u003c::std::error::Error\u003e\u003e {\n    let status = self_update::backends::s3::Update::configure()\n        .bucket_name(\"self_update_releases\")\n        .asset_prefix(\"something/self_update\")\n        .region(\"eu-west-2\")\n        .bin_name(\"self_update_example\")\n        .show_download_progress(true)\n        .current_version(cargo_crate_version!())\n        .build()?\n        .update()?;\n    println!(\"S3 Update status: `{}`!\", status.version());\n    Ok(())\n}\n```\n\nSeparate utilities are also exposed (**NOTE**: the following example _requires_ the `archive-tar` feature,\nsee the [features](#features) section above). The `self_replace` crate is re-exported for convenience:\n\n```rust\nfn update() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let releases = self_update::backends::github::ReleaseList::configure()\n        .repo_owner(\"jaemk\")\n        .repo_name(\"self_update\")\n        .build()?\n        .fetch()?;\n    println!(\"found releases:\");\n    println!(\"{:#?}\\n\", releases);\n\n    // get the first available release\n    let asset = releases[0]\n        .asset_for(\u0026self_update::get_target(), None)\n        .unwrap();\n\n    let tmp_dir = tempfile::Builder::new()\n            .prefix(\"self_update\")\n            .tempdir_in(::std::env::current_dir()?)?;\n    let tmp_tarball_path = tmp_dir.path().join(\u0026asset.name);\n    let tmp_tarball = ::std::fs::File::open(\u0026tmp_tarball_path)?;\n\n    self_update::Download::from_url(\u0026asset.download_url)\n        .set_header(reqwest::header::ACCEPT, \"application/octet-stream\".parse()?)\n        .download_to(\u0026tmp_tarball)?;\n\n    let bin_name = std::path::PathBuf::from(\"self_update_bin\");\n    self_update::Extract::from_source(\u0026tmp_tarball_path)\n        .archive(self_update::ArchiveKind::Tar(Some(self_update::Compression::Gz)))\n        .extract_file(\u0026tmp_dir.path(), \u0026bin_name)?;\n\n    let new_exe = tmp_dir.path().join(bin_name);\n    self_replace::self_replace(new_exe)?;\n\n    Ok(())\n}\n```\n\n### Troubleshooting\n\nWhen using cross compilation tools such as cross if you want to use rustls and not openssl\n\n```toml\nself_update = { version = \"0.27.0\", features = [\"rustls\"], default-features = false }\n```\n\n\nLicense: MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaemk%2Fself_update","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaemk%2Fself_update","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaemk%2Fself_update/lists"}