v0.4.1
This commit is contained in:
@@ -6,6 +6,7 @@ All operator-facing scripts live in this directory.
|
||||
- `update.sh` — safe in-place update with SQLite/config/binary backup and automatic rollback on failed health check.
|
||||
- `service.sh` — start, stop, restart, status, logs and health helper.
|
||||
- `dev.sh` — development build/run/check workflow.
|
||||
- `build-web.sh` — local/offline Tailwind CSS build; use `--install` once to install the development dependency.
|
||||
- `smoke.sh` — HTTP/API smoke test used by `dev.sh --check`.
|
||||
- `generate_ha_migration.py` — legacy/manual Home Assistant entity mapping helper.
|
||||
- `install-lxc.sh` — compatibility alias for `install.sh`.
|
||||
@@ -15,3 +16,5 @@ All operator-facing scripts live in this directory.
|
||||
|
||||
- `configure-gree-network.sh <interface>` — configures a dedicated GREE NIC, automatic subnet broadcast, disables the simulator, and restarts the service.
|
||||
- `network-debug.sh <interface> [broadcast-ip]` — prints interface/routing diagnostics and a tcpdump command.
|
||||
|
||||
The running controller never uses a CDN. `web/styles.css` is embedded into the Rust binary. Tailwind is only a local development/build tool.
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=common.sh
|
||||
source "$SCRIPT_DIR/common.sh"
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
INSTALL=0
|
||||
WATCH=0
|
||||
|
||||
usage() {
|
||||
cat <<'TXT'
|
||||
Build the embedded Web UI CSS with the local Tailwind CLI.
|
||||
|
||||
Usage:
|
||||
./scripts/build-web.sh
|
||||
./scripts/build-web.sh --install install npm dev dependencies first
|
||||
./scripts/build-web.sh --watch rebuild CSS while editing web files
|
||||
|
||||
The controller never loads Tailwind or any CSS from a CDN. web/styles.css is
|
||||
committed and embedded into the Rust binary, so Node.js is not required at runtime.
|
||||
TXT
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--install) INSTALL=1; shift ;;
|
||||
--watch) WATCH=1; shift ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) echo "Unknown argument: $1" >&2; usage; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$INSTALL" -eq 1 ]]; then
|
||||
command -v npm >/dev/null 2>&1 || fail "npm is required for --install. Install Node.js/npm first."
|
||||
say "Installing local Tailwind build dependency"
|
||||
npm install --no-audit --no-fund
|
||||
fi
|
||||
|
||||
TAILWIND="$PROJECT_ROOT/node_modules/.bin/tailwindcss"
|
||||
if [[ ! -x "$TAILWIND" ]]; then
|
||||
fail "Local Tailwind CLI is missing. Run: ./scripts/build-web.sh --install"
|
||||
fi
|
||||
|
||||
if [[ "$WATCH" -eq 1 ]]; then
|
||||
say "Watching the Web UI with local Tailwind"
|
||||
exec "$TAILWIND" -c ./tailwind.config.js -i ./web/tailwind.input.css -o ./web/styles.css --watch
|
||||
fi
|
||||
|
||||
say "Building the Web UI with local Tailwind"
|
||||
"$TAILWIND" -c ./tailwind.config.js -i ./web/tailwind.input.css -o ./web/styles.css --minify
|
||||
say "Generated web/styles.css"
|
||||
@@ -60,6 +60,15 @@ install_build_dependencies() {
|
||||
fi
|
||||
}
|
||||
|
||||
build_web_assets_if_available() {
|
||||
local tailwind="$PROJECT_ROOT/node_modules/.bin/tailwindcss"
|
||||
if [[ -x "$tailwind" ]]; then
|
||||
"$PROJECT_ROOT/scripts/build-web.sh"
|
||||
else
|
||||
say "Using committed offline Web UI CSS (web/styles.css)"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_rust() {
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
return 0
|
||||
|
||||
@@ -46,6 +46,8 @@ else
|
||||
command -v cargo >/dev/null 2>&1 || fail "Cargo is not installed and --no-install was requested."
|
||||
fi
|
||||
|
||||
build_web_assets_if_available
|
||||
|
||||
if [[ ! -f .env ]]; then
|
||||
cp .env.example .env
|
||||
say "Created .env from the example configuration"
|
||||
|
||||
@@ -38,6 +38,7 @@ if [[ -x "$INSTALL_BINARY" && -f "$SERVICE_FILE" ]]; then
|
||||
fi
|
||||
install_build_dependencies
|
||||
ensure_rust
|
||||
build_web_assets_if_available
|
||||
|
||||
if command -v systemd-detect-virt >/dev/null 2>&1; then
|
||||
virt="$(systemd-detect-virt --container 2>/dev/null || true)"
|
||||
@@ -74,11 +75,17 @@ GREE_CONTROLLER_AUTO_SEED=false
|
||||
GREE_CONTROLLER_POLL_INTERVAL_SECONDS=15
|
||||
GREE_CONTROLLER_ZONE_INTERVAL_SECONDS=5
|
||||
GREE_CONTROLLER_DISCOVERY_TIMEOUT_MS=3000
|
||||
GREE_CONTROLLER_DISCOVERY_BROADCAST=255.255.255.255:7000
|
||||
GREE_CONTROLLER_GREE_INTERFACE=
|
||||
GREE_CONTROLLER_ID=gree-controller
|
||||
GREE_CONTROLLER_HOUSE_MODE=cool
|
||||
GREE_CONTROLLER_OUTDOOR_ASSIST_ENABLED=true
|
||||
RUST_LOG=info,tower_http=info
|
||||
HA_URL=
|
||||
HA_TOKEN=
|
||||
HA_ENTITY_ID=
|
||||
HA_OUTDOOR_ENTITY_ID=
|
||||
HA_ALLOW_INVALID_TLS=false
|
||||
ENV
|
||||
chmod 0600 "$ENV_FILE"
|
||||
say "Generated administrator token and saved it to $ENV_FILE"
|
||||
|
||||
@@ -40,6 +40,7 @@ require_systemd
|
||||
|
||||
install_build_dependencies
|
||||
ensure_rust
|
||||
build_web_assets_if_available
|
||||
version="$(project_version)"
|
||||
say "Preparing update to GREE Controller ${version:-unknown}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user