diff --git a/Makefile b/Makefile index a6d73e819..68ef34f68 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ FRONTEND_DIAGNOSTIC_UI_SRC := $(shell find frontend/projects/diagnostic-ui) FRONTEND_INSTALL_WIZARD_SRC := $(shell find frontend/projects/install-wizard) PATCH_DB_CLIENT_SRC := $(shell find patch-db/client -not -path patch-db/client/dist -and -not -path patch-db/client/node_modules) GZIP_BIN := $(shell which pigz || which gzip) +TAR_BIN := $(shell which gtar || which tar) ALL_TARGETS := $(EMBASSY_BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar $(EMBASSY_SRC) $(shell if [ "$(OS_ARCH)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep; fi) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) ifeq ($(REMOTE),) @@ -26,11 +27,11 @@ ifeq ($(REMOTE),) cp = cp -r $1 $2 ln = ln -sf $1 $2 else - mkdir = ssh $(REMOTE) 'mkdir -p $1' + mkdir = ssh $(REMOTE) 'sudo mkdir -p $1' rm = ssh $(REMOTE) 'sudo rm -rf $1' ln = ssh $(REMOTE) 'sudo ln -sf $1 $2' define cp - tar --transform "s|^$1|x|" -czv -f- $1 | ssh $(REMOTE) "sudo tar --transform 's|^x|$2|' -xzv -f- -C /" + $(TAR_BIN) --transform "s|^$1|x|" -czv -f- $1 | ssh $(REMOTE) "sudo tar --transform 's|^x|$2|' -xzv -f- -C /" endef endif diff --git a/backend/Cargo.toml b/backend/Cargo.toml index d4b4e30ad..99e449ab8 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -26,7 +26,7 @@ path = "src/main.rs" [features] avahi = ["avahi-sys"] -default = ["avahi-alias", "cli", "sdk", "daemon", "js_engine"] +default = ["cli", "sdk", "daemon", "js_engine"] dev = [] unstable = ["patch-db/unstable"] avahi-alias = ["avahi"] diff --git a/backend/README.md b/backend/README.md index 986972efd..01d0b2a4d 100644 --- a/backend/README.md +++ b/backend/README.md @@ -5,6 +5,7 @@ - Recommended: [rust-analyzer](https://rust-analyzer.github.io/) - [Docker](https://docs.docker.com/get-docker/) - [Rust ARM64 Build Container](https://github.com/Start9Labs/rust-arm-builder) + - Mac `brew install gnu-tar` - Scripts (run within the `./backend` directory) - `build-prod.sh` - compiles a release build of the artifacts for running on ARM64 @@ -12,7 +13,7 @@ ## Structure -The StartOS backend is packed into a single binary `startbox` that is symlinked under +The StartOS backend is packed into a single binary `startbox` that is symlinked under several different names for different behaviour: - startd: This is the main workhorse of StartOS - any new functionality you diff --git a/backend/build-prod.sh b/backend/build-prod.sh index db2331eb4..c2a68b251 100755 --- a/backend/build-prod.sh +++ b/backend/build-prod.sh @@ -37,7 +37,7 @@ fi set +e fail= if [[ "$FLAGS" = "" ]]; then - rust-gnu-builder sh -c "(cd backend && cargo build --release --locked --target=$ARCH-unknown-linux-gnu)" + rust-gnu-builder sh -c "(cd backend && cargo build --release --locked --features avahi-alias, --target=$ARCH-unknown-linux-gnu)" if test $? -ne 0; then fail=true fi @@ -50,7 +50,7 @@ if [[ "$FLAGS" = "" ]]; then done else echo "FLAGS=$FLAGS" - rust-gnu-builder sh -c "(cd backend && cargo build --release --features $FLAGS --locked --target=$ARCH-unknown-linux-gnu)" + rust-gnu-builder sh -c "(cd backend && cargo build --release --features avahi-alias,$FLAGS --locked --target=$ARCH-unknown-linux-gnu)" if test $? -ne 0; then fail=true fi diff --git a/backend/src/disk/mount/filesystem/cifs.rs b/backend/src/disk/mount/filesystem/cifs.rs index c456bce63..91b477fcf 100644 --- a/backend/src/disk/mount/filesystem/cifs.rs +++ b/backend/src/disk/mount/filesystem/cifs.rs @@ -19,7 +19,6 @@ async fn resolve_hostname(hostname: &str) -> Result { if let Ok(addr) = hostname.parse() { return Ok(addr); } - #[cfg(feature = "avahi")] if hostname.ends_with(".local") { return Ok(IpAddr::V4(crate::net::mdns::resolve_mdns(hostname).await?)); } diff --git a/backend/src/net/mod.rs b/backend/src/net/mod.rs index 1c6010662..02788f018 100644 --- a/backend/src/net/mod.rs +++ b/backend/src/net/mod.rs @@ -10,7 +10,6 @@ pub mod dhcp; pub mod dns; pub mod interface; pub mod keys; -#[cfg(feature = "avahi")] pub mod mdns; pub mod net_controller; pub mod ssl; diff --git a/backend/src/net/net_controller.rs b/backend/src/net/net_controller.rs index 1ecf49f6b..cfd17a282 100644 --- a/backend/src/net/net_controller.rs +++ b/backend/src/net/net_controller.rs @@ -11,7 +11,6 @@ use crate::error::ErrorCollection; use crate::hostname::Hostname; use crate::net::dns::DnsController; use crate::net::keys::Key; -#[cfg(feature = "avahi")] use crate::net::mdns::MdnsController; use crate::net::ssl::{export_cert, export_key, SslManager}; use crate::net::tor::TorController; @@ -22,7 +21,6 @@ use crate::{Error, HOST_IP}; pub struct NetController { pub(super) tor: TorController, - #[cfg(feature = "avahi")] pub(super) mdns: MdnsController, pub(super) vhost: VHostController, pub(super) dns: DnsController, @@ -43,7 +41,6 @@ impl NetController { let ssl = Arc::new(ssl); let mut res = Self { tor: TorController::new(tor_control, tor_socks), - #[cfg(feature = "avahi")] mdns: MdnsController::init().await?, vhost: VHostController::new(ssl.clone()), dns: DnsController::init(dns_bind).await?, @@ -201,14 +198,12 @@ impl NetController { ) .await?, ); - #[cfg(feature = "avahi")] rcs.push(self.mdns.add(key.base_address()).await?); Ok(rcs) } async fn remove_lan(&self, key: &Key, external: u16, rcs: Vec>) -> Result<(), Error> { drop(rcs); - #[cfg(feature = "avahi")] self.mdns.gc(key.base_address()).await?; self.vhost.gc(Some(key.local_address()), external).await } diff --git a/compress-uis.sh b/compress-uis.sh index 964ddeb57..d6713d7b9 100755 --- a/compress-uis.sh +++ b/compress-uis.sh @@ -8,9 +8,9 @@ find frontend/dist/raw -type f -not -name '*.gz' -and -not -name '*.br' | xargs find frontend/dist/raw -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 brotli -kf for file in $(find frontend/dist/raw -type f -not -name '*.gz' -and -not -name '*.br'); do - raw_size=$(du --bytes $file | awk '{print $1}') - gz_size=$(du --bytes $file.gz | awk '{print $1}') - br_size=$(du --bytes $file.br | awk '{print $1}') + raw_size=$(du $file | awk '{print $1 * 512}') + gz_size=$(du $file.gz | awk '{print $1 * 512}') + br_size=$(du $file.br | awk '{print $1 * 512}') if [ $((gz_size * 100 / raw_size)) -gt 70 ]; then rm $file.gz fi