better env detection
This commit is contained in:
parent
798a1ed46c
commit
8bf38b170d
3 changed files with 21 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
**/*.rs.bk
|
||||
/REPO_TESTS
|
||||
i
|
||||
etag
|
||||
|
|
13
scripts/void.sh
Executable file
13
scripts/void.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
PREFIX="/imperfect/repo"
|
||||
|
||||
if [ ! -d "$PREFIX/void" ]; then
|
||||
printf "Creating $PREFIX/arch\n"
|
||||
sudo mkdir "$PREFIX/arch"
|
||||
fi
|
||||
|
||||
if [ ! -d "$PREFIX/void/tarballs" ]; then
|
||||
printf "Creating $PREFIX/arch/tarballs\n"
|
||||
sudo mkdir "$PREFIX/arch/tarballs"
|
||||
fi
|
10
src/main.rs
10
src/main.rs
|
@ -1,7 +1,5 @@
|
|||
extern crate flate2;
|
||||
extern crate tar;
|
||||
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
|
||||
use reqwest::Client;
|
||||
use reqwest::header::ETAG;
|
||||
|
@ -16,6 +14,12 @@ fn main() -> Result<(), std::io::Error> {
|
|||
|
||||
let split = args[1].as_str().split("::");
|
||||
let vec: Vec<&str> = split.collect();
|
||||
|
||||
if !Path::new(format!("/imperfect/repo/{}", vec[1]).as_str()).exists() {
|
||||
println!("Path /imperfect/repo/{} does not exist. Please setup your environment.", vec[1]);
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
let mut resp = client.get(vec[0])
|
||||
.send().expect("Failed to make request");
|
||||
|
||||
|
|
Loading…
Reference in a new issue