Update .gitignore and remove obsolete documentation files
- Added new entries to .gitignore for build artifacts and macOS output directories to streamline the build process. - Deleted outdated documentation files: AUTH_LOGIN_FIX.md, AUTBOOT_CONFIGURATION.md, BACKEND_FIXES.md, BACKEND_STARTUP_FIX.md, BITCOIN_CORE_HEADLESS_FIX.md, BITCOIN_CORE_UI_COMPLETE.md, BITCOIN_STANDALONE_UI_COMPLETE.md, BITCOIN_UI_COMPLETE.md, BOOT_SEQUENCE_DIAGRAM.txt, and BUILD_COMMANDS_REFERENCE.txt to declutter the repository and remove unnecessary content.
This commit is contained in:
@@ -7,8 +7,8 @@ Helper scripts for building Archipelago OS images.
|
||||
### `build-backend.sh`
|
||||
Compiles the Archipelago Rust backend binary.
|
||||
- Output: `../build/backend/archipelago`
|
||||
- Requires: Rust toolchain
|
||||
- Optional: musl target for static binary
|
||||
- Requires: Rust toolchain (or Docker)
|
||||
- Builds for Linux x86_64
|
||||
|
||||
### `build-frontend.sh`
|
||||
Builds the Vue.js frontend for production.
|
||||
@@ -16,18 +16,6 @@ Builds the Vue.js frontend for production.
|
||||
- Requires: Node.js 18+, npm
|
||||
- Builds static files for serving
|
||||
|
||||
### `create-backend-apk.sh`
|
||||
Creates Alpine APK package from backend binary.
|
||||
- Output: `../apks/archipelago-backend-*.apk`
|
||||
- Includes: binary, systemd service, config files
|
||||
- Format: Alpine package format (tar.gz with metadata)
|
||||
|
||||
### `install-archipelago.sh`
|
||||
Installs Archipelago components into built image.
|
||||
- Called after image is created
|
||||
- Installs APK and frontend files
|
||||
- Configures services
|
||||
|
||||
### `convert-iso-to-disk.sh`
|
||||
Converts ISO image to raw disk image.
|
||||
- Input: ISO file
|
||||
@@ -36,19 +24,18 @@ Converts ISO image to raw disk image.
|
||||
|
||||
### `check-dependencies.sh`
|
||||
Checks if all build dependencies are available.
|
||||
- Checks: Rust, Node.js, Docker (if needed)
|
||||
- Checks: Rust, Node.js, Docker, xorriso
|
||||
- Provides installation instructions
|
||||
- Non-blocking (warns but continues)
|
||||
|
||||
### `setup-alpine-build.sh`
|
||||
Sets up Alpine build environment.
|
||||
- Installs Alpine build tools
|
||||
- Configures abuild keys
|
||||
- Only needed for native Alpine builds
|
||||
### `install-podman.sh`
|
||||
Installs Podman container runtime.
|
||||
- For use inside the target system
|
||||
- Configures rootless Podman
|
||||
|
||||
## Usage
|
||||
|
||||
These scripts are called automatically by the main build process. You typically don't need to run them manually, but you can for testing:
|
||||
These scripts are called automatically by the main build process. You can also run them manually for testing:
|
||||
|
||||
```bash
|
||||
# Build just the backend
|
||||
@@ -57,6 +44,6 @@ These scripts are called automatically by the main build process. You typically
|
||||
# Build just the frontend
|
||||
./scripts/build-frontend.sh
|
||||
|
||||
# Create APK package
|
||||
./scripts/create-backend-apk.sh
|
||||
# Check dependencies
|
||||
./scripts/check-dependencies.sh
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Build Archipelago backend binary for Alpine Linux
|
||||
# Build Archipelago backend binary for Debian Linux
|
||||
|
||||
set -e
|
||||
|
||||
@@ -13,39 +13,57 @@ echo " Source: $BACKEND_DIR"
|
||||
echo " Output: $OUTPUT_DIR"
|
||||
echo ""
|
||||
|
||||
# Check if Rust is installed
|
||||
if ! command -v rustc >/dev/null 2>&1; then
|
||||
echo "❌ Rust not found. Installing..."
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
source "$HOME/.cargo/env"
|
||||
fi
|
||||
|
||||
# Create output directory
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Build backend
|
||||
cd "$BACKEND_DIR"
|
||||
echo "📦 Compiling backend..."
|
||||
cargo build --release --target x86_64-unknown-linux-musl || {
|
||||
# Try without musl target if cross-compilation not set up
|
||||
echo "⚠️ Musl target not available, building for host..."
|
||||
cargo build --release
|
||||
}
|
||||
# Check if we should use Docker
|
||||
USE_DOCKER=false
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
USE_DOCKER=true
|
||||
echo "🍎 macOS detected - using Docker for Linux build"
|
||||
elif ! command -v rustc >/dev/null 2>&1; then
|
||||
USE_DOCKER=true
|
||||
echo "⚠️ Rust not found - using Docker"
|
||||
fi
|
||||
|
||||
# Copy binary
|
||||
if [ -f "target/x86_64-unknown-linux-musl/release/archipelago" ]; then
|
||||
cp "target/x86_64-unknown-linux-musl/release/archipelago" "$OUTPUT_DIR/archipelago"
|
||||
elif [ -f "target/release/archipelago" ]; then
|
||||
cp "target/release/archipelago" "$OUTPUT_DIR/archipelago"
|
||||
if [ "$USE_DOCKER" = true ]; then
|
||||
echo "🐳 Building in Docker container..."
|
||||
docker run --rm \
|
||||
-v "$PROJECT_ROOT:/workspace" \
|
||||
-v "$OUTPUT_DIR:/output" \
|
||||
-w /workspace/core/archipelago \
|
||||
rust:bookworm \
|
||||
sh -c '
|
||||
echo "📦 Installing build dependencies..."
|
||||
apt-get update && apt-get install -y pkg-config libssl-dev
|
||||
|
||||
echo "🔨 Building Archipelago backend..."
|
||||
cargo build --release
|
||||
|
||||
echo "📋 Copying binary to output..."
|
||||
cp ../target/release/archipelago /output/
|
||||
|
||||
echo "✅ Build complete!"
|
||||
ls -lh /output/archipelago
|
||||
'
|
||||
else
|
||||
echo "❌ Binary not found after build"
|
||||
exit 1
|
||||
# Native Linux build
|
||||
echo "🐧 Building natively..."
|
||||
cd "$BACKEND_DIR"
|
||||
cargo build --release
|
||||
|
||||
cp "../target/release/archipelago" "$OUTPUT_DIR/archipelago"
|
||||
fi
|
||||
|
||||
# Strip binary for smaller size
|
||||
if command -v strip >/dev/null 2>&1; then
|
||||
strip "$OUTPUT_DIR/archipelago"
|
||||
if [ -f "$OUTPUT_DIR/archipelago" ]; then
|
||||
if command -v strip >/dev/null 2>&1 && [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
strip "$OUTPUT_DIR/archipelago"
|
||||
fi
|
||||
echo ""
|
||||
echo "✅ Backend built: $OUTPUT_DIR/archipelago"
|
||||
ls -lh "$OUTPUT_DIR/archipelago"
|
||||
else
|
||||
echo "❌ Build failed - binary not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Backend built: $OUTPUT_DIR/archipelago"
|
||||
ls -lh "$OUTPUT_DIR/archipelago"
|
||||
|
||||
@@ -33,40 +33,49 @@ else
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
# Check Docker (for macOS or non-Alpine Linux)
|
||||
if [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
if docker info >/dev/null 2>&1; then
|
||||
echo "✅ Docker: $(docker --version)"
|
||||
else
|
||||
echo "⚠️ Docker: Installed but daemon not running"
|
||||
echo " Start Docker Desktop or: sudo systemctl start docker"
|
||||
fi
|
||||
# Check Docker
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
if docker info >/dev/null 2>&1; then
|
||||
echo "✅ Docker: $(docker --version)"
|
||||
else
|
||||
echo "❌ Docker: Not found (required for macOS, optional for Linux)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: https://www.docker.com/products/docker-desktop"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
else
|
||||
echo " Install: https://docs.docker.com/get-docker/"
|
||||
fi
|
||||
echo "⚠️ Docker: Installed but daemon not running"
|
||||
echo " Start Docker Desktop or: sudo systemctl start docker"
|
||||
fi
|
||||
else
|
||||
echo "❌ Docker: Not found"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: https://www.docker.com/products/docker-desktop"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
else
|
||||
echo " Install: https://docs.docker.com/get-docker/"
|
||||
echo " (Optional on Linux if building natively)"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check Alpine tools (for native Alpine Linux)
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
echo ""
|
||||
echo "🏔️ Alpine Linux detected - checking native tools..."
|
||||
|
||||
for tool in abuild alpine-conf syslinux xorriso; do
|
||||
if command -v $tool >/dev/null 2>&1; then
|
||||
echo "✅ $tool: Installed"
|
||||
else
|
||||
echo "❌ $tool: Not found"
|
||||
echo " Install: apk add alpine-sdk abuild alpine-conf syslinux xorriso"
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
done
|
||||
# Check xorriso (for ISO creation)
|
||||
if command -v xorriso >/dev/null 2>&1; then
|
||||
echo "✅ xorriso: Installed"
|
||||
else
|
||||
echo "❌ xorriso: Not found (needed for ISO creation)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: brew install xorriso"
|
||||
else
|
||||
echo " Install: apt-get install xorriso"
|
||||
fi
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
# Check 7z (for ISO extraction)
|
||||
if command -v 7z >/dev/null 2>&1; then
|
||||
echo "✅ 7z: Installed"
|
||||
else
|
||||
echo "❌ 7z: Not found (needed for ISO extraction)"
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo " Install: brew install p7zip"
|
||||
else
|
||||
echo " Install: apt-get install p7zip-full"
|
||||
fi
|
||||
MISSING_DEPS=$((MISSING_DEPS + 1))
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Create Alpine APK package for Archipelago backend
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
BUILD_DIR="$SCRIPT_DIR/../build"
|
||||
APK_DIR="$SCRIPT_DIR/../apks"
|
||||
ARCHIPELAGO_VERSION="${ARCHIPELAGO_VERSION:-0.1.0}"
|
||||
|
||||
echo "📦 Creating Archipelago backend APK..."
|
||||
echo ""
|
||||
|
||||
# Create APK directory
|
||||
mkdir -p "$APK_DIR"
|
||||
|
||||
# Create temporary APK build directory
|
||||
APK_BUILD_DIR=$(mktemp -d)
|
||||
trap "rm -rf $APK_BUILD_DIR" EXIT
|
||||
|
||||
cd "$APK_BUILD_DIR"
|
||||
|
||||
# APK package structure
|
||||
mkdir -p usr/bin
|
||||
mkdir -p usr/lib/systemd/system
|
||||
mkdir -p etc/archipelago
|
||||
mkdir -p etc/init.d
|
||||
|
||||
# Copy binary
|
||||
if [ -f "$BUILD_DIR/backend/archipelago" ]; then
|
||||
cp "$BUILD_DIR/backend/archipelago" usr/bin/archipelago
|
||||
chmod +x usr/bin/archipelago
|
||||
else
|
||||
echo "❌ Backend binary not found. Run build-backend.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create systemd service file
|
||||
cat > usr/lib/systemd/system/archipelago.service <<'EOF'
|
||||
[Unit]
|
||||
Description=Archipelago Bitcoin Node OS Backend
|
||||
After=network.target podman.service
|
||||
Wants=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=archipelago
|
||||
Group=archipelago
|
||||
WorkingDirectory=/var/lib/archipelago
|
||||
ExecStart=/usr/bin/archipelago
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
# Security
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ReadWritePaths=/var/lib/archipelago /tmp
|
||||
|
||||
# Environment
|
||||
Environment="RUST_LOG=info"
|
||||
Environment="ARCHIPELAGO_DATA_DIR=/var/lib/archipelago"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Create init.d script (for openrc)
|
||||
cat > etc/init.d/archipelago <<'EOF'
|
||||
#!/sbin/openrc-run
|
||||
# Archipelago Bitcoin Node OS Backend
|
||||
|
||||
name="Archipelago"
|
||||
command="/usr/bin/archipelago"
|
||||
command_user="archipelago:archipelago"
|
||||
command_background=true
|
||||
pidfile="/var/run/archipelago.pid"
|
||||
start_stop_daemon_args="--make-pidfile"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use podman
|
||||
}
|
||||
EOF
|
||||
chmod +x etc/init.d/archipelago
|
||||
|
||||
# Create default config
|
||||
mkdir -p etc/archipelago
|
||||
cat > etc/archipelago/config.toml <<EOF
|
||||
data_dir = "/var/lib/archipelago"
|
||||
bind_host = "0.0.0.0"
|
||||
bind_port = 5959
|
||||
log_level = "info"
|
||||
dev_mode = false
|
||||
container_runtime = "podman"
|
||||
port_offset = 0
|
||||
bitcoin_simulation = "none"
|
||||
EOF
|
||||
|
||||
# Calculate package size
|
||||
PKG_SIZE=$(du -sb "$APK_BUILD_DIR" | cut -f1)
|
||||
|
||||
# Create .PKGINFO (Alpine package format)
|
||||
cat > "$APK_BUILD_DIR/.PKGINFO" <<EOF
|
||||
pkgname = archipelago-backend
|
||||
pkgver = ${ARCHIPELAGO_VERSION}-r0
|
||||
pkgdesc = Archipelago Bitcoin Node OS Backend
|
||||
url = https://github.com/archipelago/archipelago
|
||||
arch = x86_64
|
||||
license = MIT
|
||||
size = ${PKG_SIZE}
|
||||
origin = archipelago
|
||||
EOF
|
||||
|
||||
# Create .SIGN.RSA (placeholder - would need signing key for production)
|
||||
touch "$APK_BUILD_DIR/.SIGN.RSA"
|
||||
|
||||
# Create tarball (Alpine APK format)
|
||||
cd "$APK_BUILD_DIR"
|
||||
tar -czf "$APK_DIR/archipelago-backend-${ARCHIPELAGO_VERSION}-r0.apk" \
|
||||
.PKGINFO .SIGN.RSA usr etc 2>/dev/null || {
|
||||
# Fallback: create without signing
|
||||
tar -czf "$APK_DIR/archipelago-backend-${ARCHIPELAGO_VERSION}-r0.apk" \
|
||||
.PKGINFO usr etc
|
||||
}
|
||||
|
||||
echo "✅ APK created: $APK_DIR/archipelago-backend-${ARCHIPELAGO_VERSION}-r0.apk"
|
||||
ls -lh "$APK_DIR/archipelago-backend-${ARCHIPELAGO_VERSION}-r0.apk"
|
||||
@@ -1,118 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Alpine Linux Hardening Script for Archipelago Bitcoin Node OS
|
||||
# This script applies security hardening to the Alpine base image
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔒 Starting Alpine Linux hardening..."
|
||||
|
||||
# Disable unnecessary services
|
||||
systemctl disable bluetooth || true
|
||||
systemctl disable avahi-daemon || true
|
||||
|
||||
# Configure kernel parameters for security
|
||||
cat >> /etc/sysctl.conf <<EOF
|
||||
|
||||
# Archipelago Security Hardening
|
||||
# Disable IP forwarding
|
||||
net.ipv4.ip_forward = 0
|
||||
net.ipv6.conf.all.forwarding = 0
|
||||
|
||||
# Enable SYN flood protection
|
||||
net.ipv4.tcp_syncookies = 1
|
||||
|
||||
# Disable source routing
|
||||
net.ipv4.conf.all.accept_source_route = 0
|
||||
net.ipv4.conf.default.accept_source_route = 0
|
||||
net.ipv6.conf.all.accept_source_route = 0
|
||||
net.ipv6.conf.default.accept_source_route = 0
|
||||
|
||||
# Disable ICMP redirects
|
||||
net.ipv4.conf.all.accept_redirects = 0
|
||||
net.ipv4.conf.default.accept_redirects = 0
|
||||
net.ipv6.conf.all.accept_redirects = 0
|
||||
net.ipv6.conf.default.accept_redirects = 0
|
||||
|
||||
# Disable send redirects
|
||||
net.ipv4.conf.all.send_redirects = 0
|
||||
net.ipv4.conf.default.send_redirects = 0
|
||||
|
||||
# Log martian packets
|
||||
net.ipv4.conf.all.log_martians = 1
|
||||
net.ipv4.conf.default.log_martians = 1
|
||||
|
||||
# Ignore ICMP ping requests (can be enabled if needed)
|
||||
# net.ipv4.icmp_echo_ignore_all = 1
|
||||
|
||||
# Ignore ICMP ping broadcasts
|
||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||
|
||||
# Ignore bogus ICMP errors
|
||||
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
||||
|
||||
# Enable RFC-recommended source validation
|
||||
net.ipv4.conf.all.rp_filter = 1
|
||||
net.ipv4.conf.default.rp_filter = 1
|
||||
|
||||
# Disable IPv6 if not needed (uncomment if IPv6 not required)
|
||||
# net.ipv6.conf.all.disable_ipv6 = 1
|
||||
# net.ipv6.conf.default.disable_ipv6 = 1
|
||||
EOF
|
||||
|
||||
# Configure SSH (if installed)
|
||||
if [ -f /etc/ssh/sshd_config ]; then
|
||||
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config || true
|
||||
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config || true
|
||||
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config || true
|
||||
fi
|
||||
|
||||
# Set up fail2ban basic configuration
|
||||
if [ -f /etc/fail2ban/jail.conf ]; then
|
||||
cat > /etc/fail2ban/jail.local <<EOF
|
||||
[DEFAULT]
|
||||
bantime = 3600
|
||||
findtime = 600
|
||||
maxretry = 5
|
||||
destemail = root@localhost
|
||||
sendername = Fail2Ban
|
||||
action = %(action_)s
|
||||
|
||||
[sshd]
|
||||
enabled = true
|
||||
port = ssh
|
||||
logpath = %(sshd_log)s
|
||||
backend = %(sshd_backend)s
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Configure automatic security updates
|
||||
cat > /etc/periodic/daily/archipelago-security-updates <<'EOF'
|
||||
#!/bin/sh
|
||||
# Automatic security updates for Archipelago
|
||||
apk update && apk upgrade -u || true
|
||||
EOF
|
||||
chmod +x /etc/periodic/daily/archipelago-security-updates
|
||||
|
||||
# Set restrictive file permissions
|
||||
chmod 700 /var/lib/archipelago/secrets
|
||||
chmod 755 /var/lib/archipelago/apps
|
||||
chmod 755 /var/lib/archipelago/logs
|
||||
|
||||
# Create log directory with proper permissions
|
||||
mkdir -p /var/log/archipelago
|
||||
chmod 755 /var/log/archipelago
|
||||
|
||||
# Configure log rotation for archipelago logs
|
||||
cat > /etc/logrotate.d/archipelago <<EOF
|
||||
/var/log/archipelago/*.log {
|
||||
daily
|
||||
rotate 30
|
||||
compress
|
||||
delaycompress
|
||||
missingok
|
||||
notifempty
|
||||
create 0644 root root
|
||||
}
|
||||
EOF
|
||||
|
||||
echo "✅ Alpine Linux hardening complete!"
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Install Archipelago components into Alpine image
|
||||
# This script is called after the base image is built
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
OUTPUT_DIR="${1:-$SCRIPT_DIR/../results}"
|
||||
BUILD_DIR="$SCRIPT_DIR/../build"
|
||||
APK_DIR="$SCRIPT_DIR/../apks"
|
||||
|
||||
echo "🔧 Installing Archipelago into image..."
|
||||
echo " Output: $OUTPUT_DIR"
|
||||
echo ""
|
||||
|
||||
# Find the built image (ISO or extracted)
|
||||
if [ -f "$OUTPUT_DIR"/*.iso ]; then
|
||||
ISO_FILE=$(ls "$OUTPUT_DIR"/*.iso | head -1)
|
||||
echo "📦 Found ISO: $ISO_FILE"
|
||||
echo " (Archipelago will be installed when ISO is booted)"
|
||||
# For ISO, we'd need to extract, modify, and rebuild
|
||||
# This is complex, so we'll do it in the init script instead
|
||||
elif [ -d "$OUTPUT_DIR" ]; then
|
||||
# Extracted image directory
|
||||
IMAGE_ROOT="$OUTPUT_DIR"
|
||||
echo "📁 Installing into extracted image: $IMAGE_ROOT"
|
||||
|
||||
# Install backend APK
|
||||
if [ -f "$APK_DIR"/*.apk ]; then
|
||||
APK_FILE=$(ls "$APK_DIR"/*.apk | head -1)
|
||||
echo "📦 Installing backend APK: $APK_FILE"
|
||||
# In a real chroot, we'd do: apk add --allow-untrusted "$APK_FILE"
|
||||
# For now, we'll extract and copy manually
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
cd "$TEMP_DIR"
|
||||
tar -xzf "$APK_FILE"
|
||||
|
||||
# Copy files to image
|
||||
if [ -d "$IMAGE_ROOT" ]; then
|
||||
cp -r usr/* "$IMAGE_ROOT/usr/" 2>/dev/null || true
|
||||
cp -r etc/* "$IMAGE_ROOT/etc/" 2>/dev/null || true
|
||||
fi
|
||||
rm -rf "$TEMP_DIR"
|
||||
fi
|
||||
|
||||
# Install frontend
|
||||
if [ -d "$BUILD_DIR/frontend" ]; then
|
||||
echo "🎨 Installing frontend..."
|
||||
mkdir -p "$IMAGE_ROOT/usr/share/archipelago/web"
|
||||
cp -r "$BUILD_DIR/frontend/"* "$IMAGE_ROOT/usr/share/archipelago/web/"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ No image found to install into"
|
||||
echo " Archipelago will be installed on first boot"
|
||||
fi
|
||||
|
||||
# Create first boot script
|
||||
cat > "$SCRIPT_DIR/../alpine-profile/overlay/etc/local.d/archipelago-install.start" <<'EOF'
|
||||
#!/bin/sh
|
||||
# First boot installation script for Archipelago
|
||||
|
||||
# Install backend APK if available
|
||||
if [ -f /tmp/archipelago-backend.apk ]; then
|
||||
apk add --allow-untrusted /tmp/archipelago-backend.apk
|
||||
rm /tmp/archipelago-backend.apk
|
||||
fi
|
||||
|
||||
# Enable services
|
||||
rc-update add archipelago default || true
|
||||
systemctl enable archipelago || true
|
||||
|
||||
# Create archipelago user if needed
|
||||
if ! id archipelago >/dev/null 2>&1; then
|
||||
adduser -D -s /bin/bash archipelago
|
||||
echo "archipelago ALL=(ALL) NOPASSWD: /usr/bin/podman" >> /etc/sudoers
|
||||
fi
|
||||
|
||||
# Setup Podman for archipelago user
|
||||
mkdir -p /home/archipelago/.config/containers
|
||||
chown -R archipelago:archipelago /home/archipelago
|
||||
|
||||
# Create data directories
|
||||
mkdir -p /var/lib/archipelago/{apps,secrets,logs,backups}
|
||||
chown -R archipelago:archipelago /var/lib/archipelago
|
||||
|
||||
# Start services
|
||||
rc-service archipelago start || systemctl start archipelago || true
|
||||
EOF
|
||||
|
||||
chmod +x "$SCRIPT_DIR/../alpine-profile/overlay/etc/local.d/archipelago-install.start"
|
||||
|
||||
echo "✅ Archipelago installation configured"
|
||||
@@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Setup Alpine build environment
|
||||
# Installs dependencies and prepares build environment
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
echo "🔧 Setting up Alpine build environment..."
|
||||
echo ""
|
||||
|
||||
# Detect OS
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo "🍎 macOS detected - Docker will be used"
|
||||
echo " Make sure Docker Desktop is installed and running"
|
||||
exit 0
|
||||
elif [ -f /etc/alpine-release ]; then
|
||||
echo "🏔️ Alpine Linux detected - installing native tools..."
|
||||
|
||||
# Install build dependencies
|
||||
apk add --no-cache \
|
||||
bash \
|
||||
git \
|
||||
alpine-sdk \
|
||||
abuild \
|
||||
alpine-conf \
|
||||
syslinux \
|
||||
xorriso \
|
||||
squashfs-tools \
|
||||
grub \
|
||||
grub-efi \
|
||||
mtools \
|
||||
dosfstools \
|
||||
e2fsprogs \
|
||||
rsync \
|
||||
curl \
|
||||
wget \
|
||||
ca-certificates || {
|
||||
echo "❌ Failed to install dependencies"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Setup abuild keys
|
||||
if [ ! -f ~/.abuild/abuild.conf ]; then
|
||||
echo "🔑 Generating abuild keys..."
|
||||
abuild-keygen -a -n
|
||||
fi
|
||||
|
||||
echo "✅ Alpine build environment ready!"
|
||||
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
echo "🐧 Linux detected (not Alpine) - Docker will be used"
|
||||
echo " Install Docker: https://docs.docker.com/get-docker/"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ Unsupported OS: $OSTYPE"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user