Skip to content
Snippets Groups Projects
Commit a262db6f authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Merge branch 'get-target-from-env' into 'master'

Get TARGET from the environment

See merge request !11
parents 03fc74e2 78e9f779
No related branches found
No related tags found
1 merge request!11Get TARGET from the environment
...@@ -31,7 +31,6 @@ use std::str::FromStr; ...@@ -31,7 +31,6 @@ use std::str::FromStr;
pub(crate) type Result<T> = std::result::Result<T, Error>; pub(crate) type Result<T> = std::result::Result<T, Error>;
const REMOTE: &'static str = "https://static.redox-os.org/pkg"; const REMOTE: &'static str = "https://static.redox-os.org/pkg";
const TARGET: &'static str = "x86_64-unknown-redox";
/// Converts a password to a serialized argon2rs hash, understandable /// Converts a password to a serialized argon2rs hash, understandable
/// by redox_users. If the password is blank, the hash is blank. /// by redox_users. If the password is blank, the hash is blank.
...@@ -87,7 +86,9 @@ fn prompt_password(prompt: &str, confirm_prompt: &str) -> Result<String> { ...@@ -87,7 +86,9 @@ fn prompt_password(prompt: &str, confirm_prompt: &str) -> Result<String> {
} }
fn install_packages<S: AsRef<str>>(config: &Config, dest: &str, cookbook: Option<S>) { fn install_packages<S: AsRef<str>>(config: &Config, dest: &str, cookbook: Option<S>) {
let mut repo = Repo::new(TARGET); let target = &env::var("TARGET").unwrap_or(env!("TARGET").to_string());
let mut repo = Repo::new(target);
repo.add_remote(REMOTE); repo.add_remote(REMOTE);
if let Some(cookbook) = cookbook { if let Some(cookbook) = cookbook {
...@@ -108,7 +109,7 @@ fn install_packages<S: AsRef<str>>(config: &Config, dest: &str, cookbook: Option ...@@ -108,7 +109,7 @@ fn install_packages<S: AsRef<str>>(config: &Config, dest: &str, cookbook: Option
println!("Installing package {}", packagename); println!("Installing package {}", packagename);
let path = format!("{}/{}/repo/{}/{}.tar.gz", let path = format!("{}/{}/repo/{}/{}.tar.gz",
env::current_dir().unwrap().to_string_lossy(), env::current_dir().unwrap().to_string_lossy(),
cookbook.as_ref(), TARGET, packagename); cookbook.as_ref(), target, packagename);
Package::from_path(&path).unwrap().install(dest).unwrap(); Package::from_path(&path).unwrap().install(dest).unwrap();
} }
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment