Enhance README and RPC for package management
- Added instructions to README.md for building an ISO from source and flashing it to USB. - Introduced a new RPC method for package installation, including security checks and container management. - Updated Docker and Podman integration in build scripts to support both container runtimes. - Enhanced Nginx configuration for improved timeout settings and WebSocket support. - Added new app metadata for additional applications in the Docker package scanner.
This commit is contained in:
@@ -30,16 +30,27 @@ echo ""
|
||||
# Check for required tools
|
||||
check_tools() {
|
||||
local missing=""
|
||||
for tool in docker xorriso; do
|
||||
if ! command -v $tool >/dev/null 2>&1; then
|
||||
missing="$missing $tool"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for docker or podman
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
CONTAINER_CMD="docker"
|
||||
elif command -v podman >/dev/null 2>&1; then
|
||||
CONTAINER_CMD="podman"
|
||||
else
|
||||
missing="$missing docker-or-podman"
|
||||
fi
|
||||
|
||||
if ! command -v xorriso >/dev/null 2>&1; then
|
||||
missing="$missing xorriso"
|
||||
fi
|
||||
|
||||
if [ -n "$missing" ]; then
|
||||
echo "❌ Missing required tools:$missing"
|
||||
echo " Install with: brew install$missing"
|
||||
echo " Install with: apt install docker.io xorriso (or podman)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using container runtime: $CONTAINER_CMD"
|
||||
}
|
||||
|
||||
check_tools
|
||||
@@ -182,13 +193,13 @@ RestartSec=5
|
||||
WantedBy=multi-user.target
|
||||
SYSTEMDSERVICE
|
||||
|
||||
echo " Building Docker image (this may take a few minutes)..."
|
||||
docker build --platform linux/amd64 -t archipelago-rootfs -f "$WORK_DIR/Dockerfile.rootfs" "$WORK_DIR"
|
||||
echo " Building $CONTAINER_CMD image (this may take a few minutes)..."
|
||||
$CONTAINER_CMD build --platform linux/amd64 -t archipelago-rootfs -f "$WORK_DIR/Dockerfile.rootfs" "$WORK_DIR"
|
||||
|
||||
echo " Exporting filesystem..."
|
||||
docker create --platform linux/amd64 --name archipelago-rootfs-tmp archipelago-rootfs
|
||||
docker export archipelago-rootfs-tmp > "$ROOTFS_TAR"
|
||||
docker rm archipelago-rootfs-tmp
|
||||
$CONTAINER_CMD create --platform linux/amd64 --name archipelago-rootfs-tmp archipelago-rootfs
|
||||
$CONTAINER_CMD export archipelago-rootfs-tmp > "$ROOTFS_TAR"
|
||||
$CONTAINER_CMD rm archipelago-rootfs-tmp
|
||||
|
||||
echo "✅ Root filesystem created: $(du -h "$ROOTFS_TAR" | cut -f1)"
|
||||
else
|
||||
@@ -242,12 +253,12 @@ COPY core ./core
|
||||
RUN cd core && cargo build --release --bin archipelago
|
||||
BACKENDFILE
|
||||
|
||||
if docker build --platform linux/amd64 -t archipelago-backend -f "$BACKEND_DOCKERFILE" "$SCRIPT_DIR/.." 2>&1 | tail -20; then
|
||||
if $CONTAINER_CMD build --platform linux/amd64 -t archipelago-backend -f "$BACKEND_DOCKERFILE" "$SCRIPT_DIR/.." 2>&1 | tail -20; then
|
||||
echo " Extracting backend binary..."
|
||||
BACKEND_CONTAINER=$(docker create --platform linux/amd64 archipelago-backend)
|
||||
docker cp "$BACKEND_CONTAINER:/build/core/target/release/archipelago" "$ARCH_DIR/bin/" && \
|
||||
BACKEND_CONTAINER=$($CONTAINER_CMD create --platform linux/amd64 archipelago-backend)
|
||||
$CONTAINER_CMD cp "$BACKEND_CONTAINER:/build/core/target/release/archipelago" "$ARCH_DIR/bin/" && \
|
||||
echo " ✅ Backend binary included ($(du -h "$ARCH_DIR/bin/archipelago" | cut -f1))"
|
||||
docker rm "$BACKEND_CONTAINER"
|
||||
$CONTAINER_CMD rm "$BACKEND_CONTAINER"
|
||||
else
|
||||
echo " ⚠️ Backend build failed - using existing binary if available"
|
||||
if [ -f "$SCRIPT_DIR/../core/target/release/archipelago" ]; then
|
||||
@@ -311,9 +322,9 @@ echo "$CONTAINER_IMAGES" | while read -r image filename; do
|
||||
echo " ✅ Using cached: $filename"
|
||||
else
|
||||
echo " Pulling $image (linux/amd64)..."
|
||||
if docker pull --platform linux/amd64 "$image"; then
|
||||
if $CONTAINER_CMD pull --platform linux/amd64 "$image"; then
|
||||
echo " Saving $filename..."
|
||||
docker save "$image" -o "$tarpath"
|
||||
$CONTAINER_CMD save "$image" -o "$tarpath"
|
||||
echo " ✅ Saved: $(du -h "$tarpath" | cut -f1)"
|
||||
else
|
||||
echo " ⚠️ Failed to pull $image - skipping"
|
||||
@@ -729,7 +740,7 @@ TOOLS_DIR="$WORK_DIR/tools-extract"
|
||||
rm -rf "$TOOLS_DIR"
|
||||
mkdir -p "$TOOLS_DIR"
|
||||
|
||||
docker run --rm --platform linux/amd64 \
|
||||
$CONTAINER_CMD run --rm --platform linux/amd64 \
|
||||
-v "$TOOLS_DIR:/output" \
|
||||
debian:bookworm \
|
||||
bash -c '
|
||||
@@ -879,9 +890,9 @@ mkdir -p "$LIVE_DIR"
|
||||
if command -v mksquashfs >/dev/null 2>&1; then
|
||||
mksquashfs "$OVERLAY_DIR" "$LIVE_DIR/99-archipelago.squashfs" -comp xz -noappend
|
||||
else
|
||||
# Use Docker to create squashfs on macOS
|
||||
echo " Using Docker to create squashfs..."
|
||||
docker run --rm --platform linux/amd64 \
|
||||
# Use $CONTAINER_CMD to create squashfs on macOS
|
||||
echo " Using $CONTAINER_CMD to create squashfs..."
|
||||
$CONTAINER_CMD run --rm --platform linux/amd64 \
|
||||
-v "$OVERLAY_DIR:/overlay:ro" \
|
||||
-v "$LIVE_DIR:/output" \
|
||||
debian:bookworm \
|
||||
|
||||
Reference in New Issue
Block a user