mirror of
https://github.com/ivabus/binhost
synced 2025-06-08 08:10:33 +03:00
Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
33a0228c9c | |||
d501843f06 | |||
652196c247 | |||
debff608d2 | |||
b082b645f0 | |||
beb4b46caf | |||
c31f86b104 |
5 changed files with 168 additions and 148 deletions
26
Cargo.toml
26
Cargo.toml
|
@ -1,28 +1,20 @@
|
||||||
workspace = { members = [ "runner" ] }
|
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "binhost"
|
name = "binhost"
|
||||||
version = "0.3.1"
|
version = "0.3.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/ivabus/binhost"
|
repository = "https://github.com/ivabus/binhost"
|
||||||
description = "HTTP server to easily serve files"
|
description = "HTTP server to easily serve files"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.4.18", features = ["derive"] }
|
clap = { version = "4.5.3", features = ["derive"] }
|
||||||
rocket = "0.5.0"
|
rocket = "0.5.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
sha2 = { version = "0.10"}
|
sha2 = { version = "0.10" }
|
||||||
ed25519-compact = { version = "2.0.6", default-features = false, features = [ "random", "self-verify", "std"] }
|
ed25519-compact = { version = "2.1.1", default-features = false, features = [
|
||||||
|
"random",
|
||||||
# Reducing size as much as possible
|
"self-verify",
|
||||||
[profile.release]
|
"std",
|
||||||
strip = true
|
] }
|
||||||
opt-level = "s"
|
once_cell = "1.19"
|
||||||
lto = true
|
|
||||||
panic = "abort"
|
|
||||||
codegen-units = 1
|
|
||||||
|
|
||||||
[profile.dev]
|
|
||||||
# Doesn't build on my machine without
|
|
||||||
opt-level = 1
|
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
[package]
|
[package]
|
||||||
name = "runner"
|
name = "runner"
|
||||||
version = "0.1.0"
|
version = "0.3.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = { version = "0.2.152", default-features = false }
|
libc = { version = "0.2.152", default-features = false }
|
||||||
ed25519-compact = { version = "2.0.6", default-features = false }
|
ed25519-compact = { version = "2.0.6", default-features = false }
|
||||||
numtoa = "0.2.4"
|
numtoa = "0.2.4"
|
||||||
|
|
||||||
|
# Reducing size as much as possible
|
||||||
|
[profile.release]
|
||||||
|
strip = true
|
||||||
|
opt-level = "s"
|
||||||
|
lto = "fat"
|
||||||
|
panic = "abort"
|
||||||
|
codegen-units = 1
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
# Doesn't build on my machine without
|
||||||
|
opt-level = 1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
// "Runner" is written in no_std Rust for the smaller executable size: ~49KiB (Darwin arm64) vs ~300KiB
|
// "Runner" is written in no_std Rust for the smaller executable size: ~49KiB (Darwin arm64)
|
||||||
|
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
204
src/main.rs
204
src/main.rs
|
@ -1,5 +1,7 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rocket;
|
extern crate rocket;
|
||||||
|
|
||||||
|
@ -8,10 +10,12 @@ use std::time::Instant;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use ed25519_compact::{KeyPair, Noise};
|
use ed25519_compact::{KeyPair, Noise};
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
use rocket::figment::Figment;
|
use rocket::figment::Figment;
|
||||||
use rocket::fs::{FileServer, NamedFile};
|
use rocket::fs::{FileServer, NamedFile};
|
||||||
use rocket::http::Status;
|
use rocket::http::Status;
|
||||||
use rocket::response::content::RawText;
|
use rocket::response::content::RawText;
|
||||||
|
use rocket::tokio::sync::RwLock;
|
||||||
use sha2::digest::FixedOutput;
|
use sha2::digest::FixedOutput;
|
||||||
use sha2::Digest;
|
use sha2::Digest;
|
||||||
|
|
||||||
|
@ -19,17 +23,60 @@ use structs::*;
|
||||||
|
|
||||||
mod structs;
|
mod structs;
|
||||||
|
|
||||||
static mut BINS: Option<(HashMap<String, Bin>, Instant)> = None;
|
static BINS: Lazy<RwLock<(HashMap<String, Bin>, Instant)>> =
|
||||||
static mut MANIFEST: Option<Vec<u8>> = None;
|
Lazy::new(|| RwLock::new((get_bins(&Args::parse()), Instant::now())));
|
||||||
static mut KEYPAIR: Option<ed25519_compact::KeyPair> = None;
|
static KEYPAIR: Lazy<KeyPair> = Lazy::new(|| {
|
||||||
|
println!("Generating keypair");
|
||||||
|
let kp = KeyPair::generate();
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"Keypair generated. Public key: {}",
|
||||||
|
kp.pk.iter().map(|x| format!("{:x}", x)).collect::<Vec<String>>().join("")
|
||||||
|
);
|
||||||
|
kp
|
||||||
|
});
|
||||||
|
static MANIFEST: Lazy<Vec<u8>> = Lazy::new(|| {
|
||||||
|
let args = Args::parse();
|
||||||
|
|
||||||
|
println!("Generating manifest");
|
||||||
|
let mut manifest: Vec<u8> = Vec::new();
|
||||||
|
let mut bin_pub_key: Vec<u8> = KEYPAIR.pk.to_vec();
|
||||||
|
manifest.append(&mut bin_pub_key);
|
||||||
|
let mut runners = 0;
|
||||||
|
|
||||||
|
for element in std::fs::read_dir(args.runners_dir).unwrap() {
|
||||||
|
let en = element.unwrap();
|
||||||
|
if en.path().is_file() {
|
||||||
|
let mut hasher = sha2::Sha256::new();
|
||||||
|
hasher.update(std::fs::read(en.path()).unwrap().as_slice());
|
||||||
|
let mut contents = Vec::from(
|
||||||
|
format!(
|
||||||
|
"{:x} {}\n",
|
||||||
|
hasher.finalize_fixed(),
|
||||||
|
en.path().file_name().unwrap().to_str().unwrap()
|
||||||
|
)
|
||||||
|
.as_bytes(),
|
||||||
|
);
|
||||||
|
runners += 1;
|
||||||
|
manifest.append(&mut contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut hasher = sha2::Sha256::new();
|
||||||
|
hasher.update(&manifest);
|
||||||
|
println!(
|
||||||
|
"Manifest generated with {} runners and SHA256: {:x}",
|
||||||
|
runners,
|
||||||
|
hasher.finalize_fixed()
|
||||||
|
);
|
||||||
|
manifest
|
||||||
|
});
|
||||||
static WEB_SH: &str = include_str!("../web.sh");
|
static WEB_SH: &str = include_str!("../web.sh");
|
||||||
|
|
||||||
static HASH_CALCULATION_SH: &str = "";
|
async fn reload_bins(args: &Args) {
|
||||||
|
let (bins, time) = &mut *BINS.write().await;
|
||||||
fn reload_bins(bins: (&mut HashMap<String, Bin>, &mut Instant), args: &Args) {
|
if (Instant::now() - *time).as_secs() > args.refresh {
|
||||||
if (Instant::now() - *bins.1).as_secs() > args.refresh {
|
*bins = get_bins(args);
|
||||||
*bins.0 = get_bins(args);
|
*time = Instant::now();
|
||||||
*bins.1 = Instant::now();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,72 +118,63 @@ fn format_platform_list(bin: &Bin) -> String {
|
||||||
async fn index() -> RawText<String> {
|
async fn index() -> RawText<String> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
unsafe {
|
|
||||||
if let Some((bins, time)) = &mut BINS {
|
let mut hasher = sha2::Sha256::new();
|
||||||
reload_bins((bins, time), &args);
|
hasher.update(&*MANIFEST);
|
||||||
if bins.is_empty() {
|
ret.push_str(&format!("Manifest hashsum: {:x}\n", hasher.finalize_fixed()));
|
||||||
return RawText(String::from("No binaries found"));
|
|
||||||
}
|
reload_bins(&args).await;
|
||||||
for (name, bin) in bins {
|
let (bins, _) = &*BINS.read().await;
|
||||||
ret.push_str(&format!(
|
|
||||||
"- {} (platforms: {:?})\n",
|
if bins.is_empty() {
|
||||||
name,
|
return RawText(String::from("No binaries found"));
|
||||||
bin.platforms
|
|
||||||
.iter()
|
|
||||||
.map(|plat| format!("{}-{}", plat.system, plat.arch))
|
|
||||||
.collect::<Vec<String>>()
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
for (name, bin) in bins {
|
||||||
|
ret.push_str(&format!(
|
||||||
|
"- {} (platforms: {:?})\n",
|
||||||
|
name,
|
||||||
|
bin.platforms
|
||||||
|
.iter()
|
||||||
|
.map(|plat| format!("{}-{}", plat.system, plat.arch))
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
RawText(ret)
|
RawText(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/runner/manifest")]
|
#[get("/runner/manifest")]
|
||||||
async fn get_manifest() -> Vec<u8> {
|
async fn get_manifest<'a>() -> Vec<u8> {
|
||||||
unsafe {
|
let manifest = &*MANIFEST;
|
||||||
match &MANIFEST {
|
manifest.clone()
|
||||||
Some(man) => man.clone(),
|
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#[get("/<bin>")]
|
#[get("/<bin>")]
|
||||||
async fn get_script(bin: &str) -> ScriptResponse {
|
async fn get_script(bin: &str) -> ScriptResponse {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
unsafe {
|
reload_bins(&args).await;
|
||||||
if let Some((bins, time)) = &mut BINS {
|
let (bins, _) = &*BINS.read().await;
|
||||||
reload_bins((bins, time), &args);
|
match bins.get(bin) {
|
||||||
return match bins.get(bin) {
|
None => ScriptResponse::Status(Status::NotFound),
|
||||||
None => ScriptResponse::Status(Status::NotFound),
|
Some(bin) => {
|
||||||
Some(bin) => {
|
let mut script = String::from(WEB_SH);
|
||||||
let mut script = String::from(WEB_SH);
|
script = script
|
||||||
script = script
|
.replace("{{NAME}}", &bin.name)
|
||||||
.replace("{{HASH_CALCULATION}}", HASH_CALCULATION_SH)
|
.replace("{{PLATFORM_LIST}}", &format_platform_list(bin))
|
||||||
.replace("{{NAME}}", &bin.name)
|
.replace("{{EXTERNAL_ADDRESS}}", &args.url);
|
||||||
.replace("{{PLATFORM_LIST}}", &format_platform_list(bin))
|
ScriptResponse::Text(RawText(script))
|
||||||
.replace("{{EXTERNAL_ADDRESS}}", &args.url);
|
|
||||||
ScriptResponse::Text(RawText(script))
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScriptResponse::Status(Status::NotFound)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/<bin>/platforms")]
|
#[get("/<bin>/platforms")]
|
||||||
async fn get_platforms(bin: &str) -> ScriptResponse {
|
async fn get_platforms(bin: &str) -> ScriptResponse {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
unsafe {
|
reload_bins(&args).await;
|
||||||
if let Some((bins, time)) = &mut BINS {
|
let (bins, _) = &*BINS.read().await;
|
||||||
reload_bins((bins, time), &args);
|
match bins.get(bin) {
|
||||||
return match bins.get(bin) {
|
None => ScriptResponse::Status(Status::NotFound),
|
||||||
None => ScriptResponse::Status(Status::NotFound),
|
Some(bin) => ScriptResponse::Text(RawText(format_platform_list(bin))),
|
||||||
Some(bin) => ScriptResponse::Text(RawText(format_platform_list(bin))),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ScriptResponse::Status(Status::NotFound)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/bin/<bin>/<platform>/<arch>")]
|
#[get("/bin/<bin>/<platform>/<arch>")]
|
||||||
|
@ -171,12 +209,7 @@ async fn get_binary_sign(bin: &str, platform: &str, arch: &str) -> SignResponse
|
||||||
Ok(f) => f,
|
Ok(f) => f,
|
||||||
Err(_) => return SignResponse::Status(Status::BadRequest),
|
Err(_) => return SignResponse::Status(Status::BadRequest),
|
||||||
};
|
};
|
||||||
let keypair = unsafe {
|
let keypair = &*KEYPAIR;
|
||||||
match &KEYPAIR {
|
|
||||||
Some(pair) => pair,
|
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
SignResponse::Bin(keypair.sk.sign(file.as_slice(), Some(Noise::generate())).as_slice().to_vec())
|
SignResponse::Bin(keypair.sk.sign(file.as_slice(), Some(Noise::generate())).as_slice().to_vec())
|
||||||
}
|
}
|
||||||
#[launch]
|
#[launch]
|
||||||
|
@ -187,47 +220,8 @@ async fn rocket() -> _ {
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
let _ = &*BINS.read().await;
|
||||||
BINS = Some((get_bins(&args), Instant::now()));
|
let _ = &*MANIFEST;
|
||||||
println!("Generating keypair");
|
|
||||||
let kp = KeyPair::generate();
|
|
||||||
KEYPAIR = Some(kp.clone());
|
|
||||||
println!(
|
|
||||||
"Keypair generated. Public key: {}",
|
|
||||||
&kp.pk.iter().map(|x| format!("{:x}", x)).collect::<Vec<String>>().join("")
|
|
||||||
);
|
|
||||||
println!("Generating manifest");
|
|
||||||
let mut manifest: Vec<u8> = Vec::new();
|
|
||||||
let mut bin_pub_key: Vec<u8> = kp.pk.to_vec();
|
|
||||||
manifest.append(&mut bin_pub_key);
|
|
||||||
let mut runners = 0;
|
|
||||||
|
|
||||||
for element in std::fs::read_dir(args.runners_dir).unwrap() {
|
|
||||||
let en = element.unwrap();
|
|
||||||
if en.path().is_file() {
|
|
||||||
let mut hasher = sha2::Sha256::new();
|
|
||||||
hasher.update(std::fs::read(en.path()).unwrap().as_slice());
|
|
||||||
let mut contents = Vec::from(
|
|
||||||
format!(
|
|
||||||
"{:x} {}\n",
|
|
||||||
hasher.finalize_fixed(),
|
|
||||||
en.path().file_name().unwrap().to_str().unwrap()
|
|
||||||
)
|
|
||||||
.as_bytes(),
|
|
||||||
);
|
|
||||||
runners += 1;
|
|
||||||
manifest.append(&mut contents);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut hasher = sha2::Sha256::new();
|
|
||||||
hasher.update(&manifest);
|
|
||||||
println!(
|
|
||||||
"Manifest generated with {} runners and SHA256: {:x}",
|
|
||||||
runners,
|
|
||||||
hasher.finalize_fixed()
|
|
||||||
);
|
|
||||||
MANIFEST = Some(manifest)
|
|
||||||
};
|
|
||||||
|
|
||||||
let figment = Figment::from(rocket::Config::default())
|
let figment = Figment::from(rocket::Config::default())
|
||||||
.merge(("ident", "Binhost"))
|
.merge(("ident", "Binhost"))
|
||||||
|
|
66
web.sh
Normal file → Executable file
66
web.sh
Normal file → Executable file
|
@ -12,16 +12,42 @@ fail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
requireCommands() {
|
requireCommands() {
|
||||||
for cmd in $*; do
|
for cmd in "$@"; do
|
||||||
if ! command -v $cmd &> /dev/null; then
|
if ! command -v "$cmd" > /dev/null 2>&1; then
|
||||||
fail "Cannot find required command: $cmd"
|
fail "Cannot find required command: $cmd"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
requireCommands uname sha256sum cut dd chmod rm realpath expr
|
requireCommands uname cut dd chmod rm realpath expr
|
||||||
|
|
||||||
if [ "$(realpath $(command -v sha256sum))" = "/bin/busybox" ]; then
|
# Finding alternative, but supported sha256sums
|
||||||
|
SHA256SUM=""
|
||||||
|
SHASUMFLAGS=""
|
||||||
|
PLATFORM="$(uname)"
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
if command -v sha256sum > /dev/null 2>&1; then
|
||||||
|
SHA256SUM="sha256sum"
|
||||||
|
SHASUMFLAGS="-c hashes --ignore-missing"
|
||||||
|
else
|
||||||
|
if command -v sha256 > /dev/null 2>&1; then
|
||||||
|
SHA256SUM="sha256"
|
||||||
|
SHASUMFLAGS="-C hashes runner-$PLATFORM-$ARCH"
|
||||||
|
fi
|
||||||
|
if command -v shasum > /dev/null 2>&1; then
|
||||||
|
SHASUMVER=$(shasum -v | cut -c 1)
|
||||||
|
if [ "$SHASUMVER" -ge 6 ]; then
|
||||||
|
SHA256SUM="shasum -a 256"
|
||||||
|
SHASUMFLAGS="-c hashes --ignore-missing"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ SHA256SUM = "" ]; then
|
||||||
|
fail "Could not find suitable sha256sum executable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(realpath "$SHA256SUM" 2> /dev/null)" = "/bin/busybox" ]; then
|
||||||
fail "Busybox sha256sum detected, will not work. Refusing to continue"
|
fail "Busybox sha256sum detected, will not work. Refusing to continue"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -32,38 +58,36 @@ DOWNLOAD_COMMAND="curl"
|
||||||
OUTPUT_ARG="-o"
|
OUTPUT_ARG="-o"
|
||||||
DIR="/tmp/binhost-$NAME-$(date +%s)"
|
DIR="/tmp/binhost-$NAME-$(date +%s)"
|
||||||
FILE="$DIR/$NAME"
|
FILE="$DIR/$NAME"
|
||||||
PLATFORM="$(uname)"
|
|
||||||
ARCH="$(uname -m)"
|
|
||||||
|
|
||||||
if ! command -v curl &> /dev/null; then
|
if ! command -v curl > /dev/null 2>&1; then
|
||||||
if ! command -v wget &> /dev/null; then
|
if ! command -v wget > /dev/null 2>&1; then
|
||||||
fail "No curl or wget found, install one and rerun the script"
|
fail "No curl or wget found, install one and rerun the script"
|
||||||
fi
|
fi
|
||||||
export DOWNLOAD_COMMAND="wget"
|
DOWNLOAD_COMMAND="wget"
|
||||||
export OUTPUT_ARG="-O"
|
OUTPUT_ARG="-O"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PLATFORM_LIST="{{PLATFORM_LIST}}"
|
PLATFORM_LIST="{{PLATFORM_LIST}}"
|
||||||
# Making script truly portable
|
# Making script truly portable
|
||||||
if [ ! "{{NAME}}" = $NAME ]; then
|
if [ ! "{{NAME}}" = $NAME ]; then
|
||||||
print ":: Fetching platforms"
|
print ":: Fetching platforms"
|
||||||
export PLATFORM_LIST=$($DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/$NAME/platforms $OUTPUT_ARG /dev/stdout)
|
PLATFORM_LIST=$($DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/$NAME/platforms $OUTPUT_ARG /dev/stdout)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! expr "$PLATFORM_LIST" : "\(.*$(uname)-$(uname -m).*\)" > /dev/null; then
|
if ! expr "$PLATFORM_LIST" : "\(.*$(uname)-$(uname -m).*\)" > /dev/null; then
|
||||||
fail "Platform \"$(uname)-$(uname -m)\" is not supported"
|
fail "Platform \"$(uname)-$(uname -m)\" is not supported"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir $DIR
|
mkdir "$DIR"
|
||||||
cd $DIR
|
cd "$DIR"
|
||||||
|
|
||||||
print ":: Downloading manifest"
|
print ":: Downloading manifest"
|
||||||
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/manifest $OUTPUT_ARG manifest
|
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/manifest $OUTPUT_ARG manifest
|
||||||
|
|
||||||
MANIFEST_HASHSUM=$(sha256sum manifest)
|
MANIFEST_HASHSUM=$(cat manifest | $SHA256SUM)
|
||||||
|
|
||||||
if [ ! -z $KEY ]; then
|
if [ -n "$KEY" ]; then
|
||||||
if [ ! $KEY = "$(echo $MANIFEST_HASHSUM | cut -c 1-${#KEY})" ]; then
|
if [ ! "$KEY" = "$(echo "$MANIFEST_HASHSUM" | cut -c 1-${#KEY})" ]; then
|
||||||
fail "Invalid manifest hashsum"
|
fail "Invalid manifest hashsum"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -71,16 +95,16 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print ":: Downloading signature"
|
print ":: Downloading signature"
|
||||||
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/bin/$NAME/$PLATFORM/$ARCH/sign $OUTPUT_ARG signature
|
$DOWNLOAD_COMMAND "$EXTERNAL_ADDRESS/bin/$NAME/$PLATFORM/$ARCH/sign" $OUTPUT_ARG signature
|
||||||
|
|
||||||
dd if=manifest of=public_key count=32 bs=1 2> /dev/null
|
dd if=manifest of=public_key count=32 bs=1 2> /dev/null
|
||||||
dd if=manifest of=hashes skip=32 bs=1 2> /dev/null
|
dd if=manifest of=hashes skip=32 bs=1 2> /dev/null
|
||||||
|
|
||||||
print ":: Downloading runner"
|
print ":: Downloading runner"
|
||||||
|
|
||||||
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/runner/runner-$PLATFORM-$ARCH $OUTPUT_ARG "runner-$PLATFORM-$ARCH"
|
$DOWNLOAD_COMMAND "$EXTERNAL_ADDRESS/runner/runner-$PLATFORM-$ARCH" $OUTPUT_ARG "runner-$PLATFORM-$ARCH"
|
||||||
|
|
||||||
if ! sha256sum -c hashes --ignore-missing; then
|
if ! $SHA256SUM $SHASUMFLAGS >&2 ; then
|
||||||
fail "Incorrect hashsum of runner"
|
fail "Incorrect hashsum of runner"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -88,9 +112,9 @@ chmod +x "runner-$PLATFORM-$ARCH"
|
||||||
|
|
||||||
print ":: Downloading binary"
|
print ":: Downloading binary"
|
||||||
|
|
||||||
$DOWNLOAD_COMMAND $EXTERNAL_ADDRESS/bin/$NAME/$PLATFORM/$ARCH $OUTPUT_ARG "$FILE"
|
$DOWNLOAD_COMMAND "$EXTERNAL_ADDRESS/bin/$NAME/$PLATFORM/$ARCH" $OUTPUT_ARG "$FILE"
|
||||||
|
|
||||||
if ! ./runner-$PLATFORM-$ARCH "$FILE" >&2; then
|
if ! "./runner-$PLATFORM-$ARCH" "$FILE" >&2; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue