-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage-addon.sh
More file actions
executable file
·63 lines (53 loc) · 1.88 KB
/
package-addon.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.88 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
61
62
63
#!/bin/bash
# Script to build and package the BESS add-on for Home Assistant
#
# NOTE: This script is for LOCAL installation only.
# For GitHub/HACS installation, Home Assistant will build directly from the
# repository root when adding: https://github.com/johanzander/bess-manager
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/app.py "$BUILD_DIR/app.py"
cp backend/api.py "$BUILD_DIR/api.py"
cp backend/api_conversion.py "$BUILD_DIR/api_conversion.py"
cp backend/api_dataclasses.py "$BUILD_DIR/api_dataclasses.py"
cp backend/log_config.py "$BUILD_DIR/log_config.py"
cp backend/settings_store.py "$BUILD_DIR/settings_store.py"
cp backend/settings_store.py "$BUILD_DIR/settings_store.py"
cp backend/requirements.txt "$BUILD_DIR/requirements.txt"
cp backend/run.sh "$BUILD_DIR/run.sh"
cp config.yaml "$BUILD_DIR/config.yaml"
cp README.md "$BUILD_DIR/README.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!"