All Projects → jaemk → Self_update

jaemk / Self_update

Licence: mit
Self updates for rust executables

Programming Languages

rust
11053 projects

Labels

Projects that are alternatives of or similar to Self update

BM
The Utility to Install Songs, Install Mods, Install/Update BMBF, Install HitSounds, download automatically made Playlists, get better support, switch between the modded and unmodded Version of Beat Saber, do full Backups and way more
Stars: ✭ 33 (-91.62%)
Mutual labels:  update
Cordova Plugin App Update
App updater for Cordova/PhoneGap
Stars: ✭ 290 (-26.4%)
Mutual labels:  update
Westore
更好的小程序项目架构
Stars: ✭ 3,897 (+889.09%)
Mutual labels:  update
amazon-workmail-lambda-templates
Serverless applications for Amazon WorkMail.
Stars: ✭ 17 (-95.69%)
Mutual labels:  update
Onova
Unopinionated auto-update framework for desktop applications
Stars: ✭ 280 (-28.93%)
Mutual labels:  update
Pyupdater
Pyinstaller auto-update library
Stars: ✭ 300 (-23.86%)
Mutual labels:  update
no-ip
Noip.com Dynamic DNS update client built in Node.js
Stars: ✭ 33 (-91.62%)
Mutual labels:  update
Siren
Siren checks a user's currently installed version of your iOS app against the version that is currently available in the App Store.
Stars: ✭ 3,892 (+887.82%)
Mutual labels:  update
Gandalf
Easily notify a user with a simple alert, inform them of an optional update, and in dire situations block the user from accessing older versions of the application completely.
Stars: ✭ 286 (-27.41%)
Mutual labels:  update
Go Github Selfupdate
Binary self-update mechanism for Go commands using GitHub
Stars: ✭ 370 (-6.09%)
Mutual labels:  update
Graphql To Mongodb
Allows for generic run-time generation of filter types for existing graphql types and parsing client requests to mongodb find queries
Stars: ✭ 261 (-33.76%)
Mutual labels:  update
Routeros Scripts
a collection of scripts for Mikrotik RouterOS
Stars: ✭ 270 (-31.47%)
Mutual labels:  update
Appupdate
🚀 Android 版本更新 🚀 a library for android version update 🚀
Stars: ✭ 3,375 (+756.6%)
Mutual labels:  update
Xam.Plugin.AutoUpdate
Xamarin Forms plugin that auto updates your Android or UWP sideloaded application.
Stars: ✭ 22 (-94.42%)
Mutual labels:  update
React Query
⚛️ Hooks for fetching, caching and updating asynchronous data in React
Stars: ✭ 24,427 (+6099.75%)
Mutual labels:  update
gitea-auto-update
A script which can update gitea via crontab automatically to a new version.
Stars: ✭ 25 (-93.65%)
Mutual labels:  update
Electron Simple Updater
Simple way to enable update for the electron application
Stars: ✭ 292 (-25.89%)
Mutual labels:  update
Githubupdates
Cocoa framework to install application updates from GitHub releases.
Stars: ✭ 393 (-0.25%)
Mutual labels:  update
Pipupgrade
🗽 Like yarn outdated/upgrade, but for pip. Upgrade all your pip packages and automate your Python Dependency Management.
Stars: ✭ 391 (-0.76%)
Mutual labels:  update
Rauc
Safe and secure software updates for embedded Linux
Stars: ✭ 360 (-8.63%)
Mutual labels:  update

self_update

Build status Build Status crates.io:clin docs

self_update provides updaters for updating rust executables in-place from various release distribution backends.

Usage

Update (replace) the current executable with the latest release downloaded from https://api.github.com/repos/jaemk/self_update/releases/latest. Note, the trust project provides a nice setup for producing release-builds via CI (travis/appveyor).

Features

The following cargo features are available (but disabled by default):

  • archive-tar: Support for tar archive format;
  • archive-zip: Support for zip archive format;
  • compression-flate2: Support for gzip compression;
  • compression-zip-deflate: Support for zip's deflate compression format;
  • compression-zip-bzip2: Support for zip's bzip2 compression format;
  • rustls: Use pure rust TLS implementation for network requests. This feature does not support 32bit macOS;

Please activate the feature(s) needed by your release files.

Example

Run the following example to see self_update in action:

cargo run --example github --features "archive-tar archive-zip compression-flate2 compression-zip-deflate".

There's also an equivalent example for gitlab:

cargo run --example gitlab --features "archive-tar archive-zip compression-flate2 compression-zip-deflate".

which runs something roughly equivalent to:

use self_update::cargo_crate_version;

fn update() -> Result<(), Box<::std::error::Error>> {
    let status = self_update::backends::github::Update::configure()
        .repo_owner("jaemk")
        .repo_name("self_update")
        .bin_name("github")
        .show_download_progress(true)
        .current_version(cargo_crate_version!())
        .build()?
        .update()?;
    println!("Update status: `{}`!", status.version());
    Ok(())
}

Amazon S3, Google GCS, and DigitalOcean Spaces are also supported through the S3 backend to check for new releases. Provided a bucket_name and asset_prefix string, self_update will look up all matching files using the following format as a convention for the filenames: [directory/]<asset name>-<semver>-<platform/target>.<extension>. Leading directories will be stripped from the file name allowing the use of subdirectories in the S3 bucket, and any file not matching the format, or not matching the provided prefix string, will be ignored.

use self_update::cargo_crate_version;

fn update() -> Result<(), Box<::std::error::Error>> {
    let status = self_update::backends::s3::Update::configure()
        .bucket_name("self_update_releases")
        .asset_prefix("something/self_update")
        .region("eu-west-2")
        .bin_name("self_update_example")
        .show_download_progress(true)
        .current_version(cargo_crate_version!())
        .build()?
        .update()?;
    println!("S3 Update status: `{}`!", status.version());
    Ok(())
}

Separate utilities are also exposed (NOTE: the following example requires the archive-tar feature, see the features section above):

fn update() -> Result<(), Box<::std::error::Error>> {
    let releases = self_update::backends::github::ReleaseList::configure()
        .repo_owner("jaemk")
        .repo_name("self_update")
        .build()?
        .fetch()?;
    println!("found releases:");
    println!("{:#?}\n", releases);

    // get the first available release
    let asset = releases[0]
        .asset_for(&self_update::get_target()).unwrap();

    let tmp_dir = tempfile::Builder::new()
            .prefix("self_update")
            .tempdir_in(::std::env::current_dir()?)?;
    let tmp_tarball_path = tmp_dir.path().join(&asset.name);
    let tmp_tarball = ::std::fs::File::open(&tmp_tarball_path)?;

    self_update::Download::from_url(&asset.download_url)
        .set_header(reqwest::header::ACCEPT, "application/octet-stream".parse()?)
        .download_to(&tmp_tarball)?;

    let bin_name = std::path::PathBuf::from("self_update_bin");
    self_update::Extract::from_source(&tmp_tarball_path)
        .archive(self_update::ArchiveKind::Tar(Some(self_update::Compression::Gz)))
        .extract_file(&tmp_dir.path(), &bin_name)?;

    let tmp_file = tmp_dir.path().join("replacement_tmp");
    let bin_path = tmp_dir.path().join(bin_name);
    self_update::Move::from_source(&bin_path)
        .replace_using_temp(&tmp_file)
        .to_dest(&::std::env::current_exe()?)?;

    Ok(())
}

License: MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].