mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
committed by
Aiden McClelland
parent
6eb2dfbb5e
commit
d55586755d
@@ -37,6 +37,7 @@ use crate::s9pk::reader::S9pkReader;
|
||||
use crate::status::{MainStatus, Status};
|
||||
use crate::util::io::copy_and_shutdown;
|
||||
use crate::util::{display_none, display_serializable, AsyncFileExt, Version};
|
||||
use crate::version::{Current, VersionT};
|
||||
use crate::volume::asset_dir;
|
||||
use crate::{Error, ResultExt};
|
||||
|
||||
@@ -83,12 +84,20 @@ pub async fn install(
|
||||
let reg_url = ctx.package_registry_url().await?;
|
||||
let (man_res, s9pk) = tokio::try_join!(
|
||||
reqwest::get(format!(
|
||||
"{}/package/manifest/{}?version={}",
|
||||
reg_url, pkg_id, version
|
||||
"{}/package/manifest/{}?version={}&eos-version={}&arch={}",
|
||||
reg_url,
|
||||
pkg_id,
|
||||
version,
|
||||
Current::new().semver(),
|
||||
platforms::TARGET_ARCH,
|
||||
)),
|
||||
reqwest::get(format!(
|
||||
"{}/package/{}.s9pk?version={}",
|
||||
reg_url, pkg_id, version
|
||||
"{}/package/{}.s9pk?version={}&eos-version={}&arch={}",
|
||||
reg_url,
|
||||
pkg_id,
|
||||
version,
|
||||
Current::new().semver(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
)
|
||||
.with_kind(crate::ErrorKind::Registry)?;
|
||||
@@ -386,8 +395,12 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
||||
let reg_url = ctx.package_registry_url().await?;
|
||||
for (dep, info) in &manifest.dependencies.0 {
|
||||
let manifest: Option<Manifest> = match reqwest::get(format!(
|
||||
"{}/package/manifest/{}?version={}",
|
||||
reg_url, dep, info.version
|
||||
"{}/package/manifest/{}?version={}&eos-version={}&arch={}",
|
||||
reg_url,
|
||||
dep,
|
||||
info.version,
|
||||
Current::new().semver(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
.await
|
||||
.with_kind(crate::ErrorKind::Registry)?
|
||||
@@ -412,8 +425,12 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
|
||||
if tokio::fs::metadata(&icon_path).await.is_err() {
|
||||
tokio::fs::create_dir_all(&dir).await?;
|
||||
let icon = reqwest::get(format!(
|
||||
"{}/package/icon/{}?version={}",
|
||||
reg_url, dep, info.version
|
||||
"{}/package/icon/{}?version={}&eos-version={}&arch={}",
|
||||
reg_url,
|
||||
dep,
|
||||
info.version,
|
||||
Current::new().semver(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
.await
|
||||
.with_kind(crate::ErrorKind::Registry)?;
|
||||
|
||||
@@ -28,6 +28,7 @@ use crate::db::util::WithRevision;
|
||||
use crate::notifications::NotificationLevel;
|
||||
use crate::update::latest_information::LatestInformation;
|
||||
use crate::util::Invoke;
|
||||
use crate::version::{Current, VersionT};
|
||||
use crate::{Error, ErrorKind, ResultExt};
|
||||
|
||||
lazy_static! {
|
||||
@@ -177,13 +178,18 @@ lazy_static! {
|
||||
#[instrument(skip(ctx))]
|
||||
async fn maybe_do_update(ctx: RpcContext) -> Result<Option<Arc<Revision>>, Error> {
|
||||
let mut db = ctx.db.handle();
|
||||
let latest_version = reqwest::get(format!("{}/eos/latest", ctx.eos_registry_url().await?))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?
|
||||
.json::<LatestInformation>()
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?
|
||||
.version;
|
||||
let latest_version = reqwest::get(format!(
|
||||
"{}/eos/latest?eos-version={}&arch={}",
|
||||
ctx.eos_registry_url().await?,
|
||||
Current::new().semver(),
|
||||
platforms::TARGET_ARCH,
|
||||
))
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?
|
||||
.json::<LatestInformation>()
|
||||
.await
|
||||
.with_kind(ErrorKind::Network)?
|
||||
.version;
|
||||
let current_version = crate::db::DatabaseModel::new()
|
||||
.server_info()
|
||||
.version()
|
||||
@@ -321,7 +327,14 @@ struct EosUrl {
|
||||
}
|
||||
impl std::fmt::Display for EosUrl {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}/eos/eos.img?version=={}", self.base, self.version)
|
||||
write!(
|
||||
f,
|
||||
"{}/eos/eos.img?version=={}&eos-version={}&arch={}",
|
||||
self.base,
|
||||
self.version,
|
||||
Current::new().semver(),
|
||||
platforms::TARGET_ARCH,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user