Run Newt inside the add-on without Docker - v1.1.8

This commit is contained in:
Jørgen Ferdinand 2025-03-07 23:17:14 +01:00
parent c4b7f4da90
commit bbfd2398cd
2 changed files with 15 additions and 34 deletions

View file

@ -1,7 +1,7 @@
name: "Newt Add-on"
version: "1.1.7"
version: "1.1.8"
slug: "newt"
description: "Runs the Newt container inside Home Assistant using Supervisor API"
description: "Runs Newt inside Home Assistant OS"
arch:
- amd64
- armv7
@ -15,9 +15,9 @@ privileged:
- NET_ADMIN
- DAC_READ_SEARCH
options:
PANGOLIN_ENDPOINT: "https://example.com"
NEWT_ID: ""
NEWT_SECRET: ""
PANGOLIN_ENDPOINT: "https://dash.opland.net"
NEWT_ID: "your_newt_id"
NEWT_SECRET: "your_newt_secret"
schema:
PANGOLIN_ENDPOINT: "str"
NEWT_ID: "str"

View file

@ -1,40 +1,21 @@
#!/usr/bin/env bash
set -e # Stop the script on errors
echo "🔹 Starting Newt container using Home Assistant OS..."
echo "🔹 Starting Newt inside Home Assistant OS..."
# Check if Docker is available
if ! command -v docker &> /dev/null; then
echo "❌ ERROR: Docker is NOT available inside Home Assistant OS!"
exit 1
fi
echo "✅ Docker is available!"
# Retrieve environment variables
# Load configuration values
PANGOLIN_ENDPOINT=${PANGOLIN_ENDPOINT:-"https://dash.opland.net"}
NEWT_ID=${NEWT_ID:-"ru32vsg8ls5lx93"}
NEWT_SECRET=${NEWT_SECRET:-"5rbqgpc292989uk9kz52hmypoyz6u9jf7k670fqja8p4un8o"}
NEWT_ID=${NEWT_ID:-"your_newt_id"}
NEWT_SECRET=${NEWT_SECRET:-"your_newt_secret"}
echo "🔹 Environment Variables:"
echo "✅ Configuration Loaded:"
echo " PANGOLIN_ENDPOINT=$PANGOLIN_ENDPOINT"
echo " NEWT_ID=$NEWT_ID"
echo " NEWT_SECRET=$NEWT_SECRET"
# Remove old Newt container if it exists
if docker ps -a --format '{{.Names}}' | grep -q "newt"; then
echo "🔹 Stopping and removing existing Newt container..."
docker stop newt
docker rm newt
fi
# Run Newt inside the add-on container
echo "🔹 Running Newt..."
/usr/bin/newt --id "$NEWT_ID" --secret "$NEWT_SECRET" --endpoint "$PANGOLIN_ENDPOINT" &
# Run the Newt container
echo "🔹 Starting Newt container..."
docker run -d --restart unless-stopped \
--name newt \
-e PANGOLIN_ENDPOINT="$PANGOLIN_ENDPOINT" \
-e NEWT_ID="$NEWT_ID" \
-e NEWT_SECRET="$NEWT_SECRET" \
fosrl/newt || { echo "❌ ERROR: Failed to start Newt container"; exit 22; }
echo "✅ Newt container started successfully!"
echo "✅ Newt is running!"
exec tail -f /dev/null # Keep the add-on running