Teach solana-install about release channels (#5372)

$ solana-install init edge  # <-- setup an install using the edge channel
$ solana-install update     # <-- update to the latest edge channel release
This commit is contained in:
Michael Vines
2019-07-31 17:30:17 -07:00
committed by GitHub
parent c2fc0f2418
commit 937f9ad049
3 changed files with 98 additions and 35 deletions

View File

@@ -5,13 +5,19 @@ use std::fs::{create_dir_all, File};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub enum ExplicitRelease {
Semver(String),
Channel(String),
}
#[derive(Serialize, Deserialize, Default, Debug, PartialEq)]
pub struct Config {
pub json_rpc_url: String,
pub update_manifest_pubkey: Pubkey,
pub current_update_manifest: Option<UpdateManifest>,
pub update_poll_secs: u64,
pub release_semver: Option<String>,
pub explicit_release: Option<ExplicitRelease>,
releases_dir: PathBuf,
active_release_dir: PathBuf,
}
@@ -21,14 +27,14 @@ impl Config {
data_dir: &str,
json_rpc_url: &str,
update_manifest_pubkey: &Pubkey,
release_semver: Option<&str>,
explicit_release: Option<ExplicitRelease>,
) -> Self {
Self {
json_rpc_url: json_rpc_url.to_string(),
update_manifest_pubkey: *update_manifest_pubkey,
current_update_manifest: None,
update_poll_secs: 60, // check for updates once a minute
release_semver: release_semver.map(|s| s.to_string()),
explicit_release,
releases_dir: PathBuf::from(data_dir).join("releases"),
active_release_dir: PathBuf::from(data_dir).join("active_release"),
}