-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage-addon.sh
More file actions
executable file
·60 lines (50 loc) · 1.75 KB
/
Copy pathpackage-addon.sh
File metadata and controls
executable file
·60 lines (50 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Script to build and package the BESS add-on for Home Assistant
#
# NOTE: This script is for LOCAL installation only.
# For GitHub-based installation, Home Assistant pulls pre-built images from GHCR
# (configured via bess_manager/config.yaml image field).
set -e
echo "Building BESS Manager add-on for Home Assistant (local installation)..."
echo "Cleaning old build directory..."
BUILD_DIR="./build/bess_manager"
echo "Cleaning old build directory..."
rm -rf "$BUILD_DIR"
echo "Creating new build directory..."
mkdir -p "$BUILD_DIR"
# Build frontend
echo "Building frontend..."
cd frontend
npm ci
npm run build
cd ..
# Copy base files - make sure these match what Dockerfile expects
cp backend/Dockerfile "$BUILD_DIR/Dockerfile"
cp build.json "$BUILD_DIR/build.json"
cp backend/*.py "$BUILD_DIR/"
cp backend/requirements.txt "$BUILD_DIR/requirements.txt"
cp backend/run.sh "$BUILD_DIR/run.sh"
# Use bess_manager/config.yaml as single source of truth, strip the GHCR
# image line so HA builds locally instead of pulling from the registry.
sed '/^image:/d' bess_manager/config.yaml > "$BUILD_DIR/config.yaml"
cp README.md "$BUILD_DIR/README.md"
cp CHANGELOG.md "$BUILD_DIR/CHANGELOG.md"
# Copy core files
mkdir -p "$BUILD_DIR/core"
cp -r core/* "$BUILD_DIR/core/"
# Copy frontend files
mkdir -p "$BUILD_DIR/frontend"
cp -r frontend/dist/* "$BUILD_DIR/frontend/"
# Create repository structure
REPO_DIR="./build/repository"
mkdir -p "$REPO_DIR/bess_manager"
cp -r "$BUILD_DIR"/* "$REPO_DIR/bess_manager/"
# Create repository.json
cat > "$REPO_DIR/repository.json" << EOF
{
"name": "BESS Battery Manager Repository",
"url": "https://github.com/johanzander/bess-manager",
"maintainer": "Johan Zander <johanzander@gmail.com>"
}
EOF
echo "Add-on built successfully!"