fix feature flag for avahi

This commit is contained in:
Aiden McClelland
2021-07-08 10:28:32 -06:00
parent 8035fb285c
commit a2188be4cd
6 changed files with 34 additions and 26 deletions

View File

@@ -8,8 +8,8 @@ if [ "$0" != "./build-portable.sh" ]; then
exit 1
fi
alias 'rust-musl-builder'='docker run --rm -it -v "$HOME"/.cargo/registry:/root/.cargo/registry -v "$(pwd)":/home/rust/src messense/rust-musl-cross:x86_64-musl'
alias 'rust-musl-builder'='docker run --rm -it -v "$HOME"/.cargo/registry:/root/.cargo/registry -v "$(pwd)":/home/rust/src start9/rust-musl-cross:x86_64-musl'
cd ..
rust-musl-builder sh -c "(cd appmgr && cargo build --release --target=x86_64-unknown-linux-musl --features=portable,production --no-default-features)"
cd appmgr
cd ../..
rust-musl-builder sh -c "(cd embassy-os/appmgr && cargo +beta build --release --target=x86_64-unknown-linux-musl --no-default-features)"
cd embassy-os/appmgr

BIN
appmgr/embassy-pages.s9pk Normal file

Binary file not shown.

View File

@@ -12,6 +12,7 @@ use serde::Deserialize;
use sqlx::SqlitePool;
use tokio::fs::File;
#[cfg(feature = "avahi")]
use crate::net::mdns::MdnsController;
use crate::net::tor::TorController;
use crate::util::{from_toml_async_reader, AsyncFileExt, Container};
@@ -34,6 +35,7 @@ pub struct RpcContextSeed {
pub secret_store: SqlitePool,
pub docker: Docker,
pub tor_controller: TorController,
#[cfg(feature = "avahi")]
pub mdns_controller: MdnsController,
}
@@ -72,6 +74,7 @@ impl RpcContext {
&mut secret_store.acquire().await?,
)
.await?;
#[cfg(feature = "avahi")]
let mdns_controller = MdnsController::init(&mut db_handle).await?;
let seed = Arc::new(RpcContextSeed {
bind_rpc: base.bind_rpc.unwrap_or(([127, 0, 0, 1], 5959).into()),
@@ -80,6 +83,7 @@ impl RpcContext {
secret_store,
docker: Docker::connect_with_unix_defaults()?,
tor_controller,
#[cfg(feature = "avahi")]
mdns_controller,
});
Ok(Self(seed))

View File

@@ -87,26 +87,24 @@ impl HasModel for AllPackageData {
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct StaticFiles {
license: Url,
instructions: Url,
icon: Url,
license: String,
instructions: String,
icon: String,
}
impl StaticFiles {
pub fn local(id: &PackageId, version: &Version, icon_type: &str) -> Result<Self, Error> {
Ok(StaticFiles {
license: format!("/public/package-data/{}/{}/LICENSE.md", id, version).parse()?,
instructions: format!("/public/package-data/{}/{}/INSTRUCTIONS.md", id, version)
.parse()?,
icon: format!("/public/package-data/{}/{}/icon.{}", id, version, icon_type).parse()?,
})
pub fn local(id: &PackageId, version: &Version, icon_type: &str) -> Self {
StaticFiles {
license: format!("/public/package-data/{}/{}/LICENSE.md", id, version),
instructions: format!("/public/package-data/{}/{}/INSTRUCTIONS.md", id, version),
icon: format!("/public/package-data/{}/{}/icon.{}", id, version, icon_type),
}
}
pub fn remote(id: &PackageId, version: &Version, icon_type: &str) -> Result<Self, Error> {
Ok(StaticFiles {
license: format!("/registry/packages/{}/{}/LICENSE.md", id, version).parse()?,
instructions: format!("/registry/packages/{}/{}/INSTRUCTIONS.md", id, version)
.parse()?,
icon: format!("/registry/packages/{}/{}/icon.{}", id, version, icon_type).parse()?,
})
pub fn remote(id: &PackageId, version: &Version, icon_type: &str) -> Self {
StaticFiles {
license: format!("/registry/packages/{}/{}/LICENSE.md", id, version),
instructions: format!("/registry/packages/{}/{}/INSTRUCTIONS.md", id, version),
icon: format!("/registry/packages/{}/{}/icon.{}", id, version, icon_type),
}
}
}

View File

@@ -8,11 +8,16 @@ use crate::s9pk::reader::S9pkReader;
use crate::util::{display_none, display_serializable, IoFormat};
use crate::Error;
#[command(subcommands(manifest, license, icon, instructions, docker_images))]
#[command(subcommands(hash, manifest, license, icon, instructions, docker_images))]
pub fn inspect(#[context] ctx: EitherContext) -> Result<(), Error> {
Ok(())
}
#[command(cli_only)]
pub async fn hash(#[arg] path: PathBuf) -> Result<String, Error> {
Ok(S9pkReader::open(path).await?.hash_str().to_owned())
}
#[command(cli_only, display(display_serializable))]
pub async fn manifest(
#[arg] path: PathBuf,

View File

@@ -53,11 +53,11 @@ pub async fn install(#[context] ctx: EitherContext, #[arg] id: String) -> Result
let reg_url = rpc_ctx.package_registry_url().await?;
let (man_res, s9pk) = tokio::try_join!(
reqwest::get(format!(
"{}/packages/manifest/{}?version={}",
"{}/package/manifest/{}?version={}",
reg_url, pkg_id, version
)),
reqwest::get(format!(
"{}/packages/{}.s9pk?version={}",
"{}/package/{}.s9pk?version={}",
reg_url, pkg_id, version
))
)
@@ -86,7 +86,7 @@ pub async fn download_install_s9pk(
let res = (|| async {
let progress = InstallProgress::new(s9pk.content_length());
let static_files = StaticFiles::remote(pkg_id, version, temp_manifest.assets.icon_type())?;
let static_files = StaticFiles::remote(pkg_id, version, temp_manifest.assets.icon_type());
let mut pde = pkg_data_entry.get_mut(&mut db).await?;
match pde.take() {
Some(PackageDataEntry::Installed { installed, .. }) => {
@@ -381,7 +381,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
log::info!("Install {}@{}: Complete", pkg_id, version);
let static_files = StaticFiles::local(pkg_id, version, manifest.assets.icon_type())?;
let static_files = StaticFiles::local(pkg_id, version, manifest.assets.icon_type());
let current_dependencies = manifest
.dependencies
.0
@@ -490,6 +490,7 @@ pub async fn install_s9pk<R: AsyncRead + AsyncSeek + Unpin>(
}
ctx.tor_controller.sync(&mut tx, &mut sql_tx).await?;
#[cfg(feature = "avahi")]
ctx.mdns_controller.sync(&mut tx).await?;
tx.commit(None).await?;