archy/image-recipe/alpine-profile/mkimg.archipelago.sh
Dorian ba1a7bd3f6 Enhance README and build scripts for hardware-specific optimizations
- Updated README.md to clarify development setup for macOS/Docker and added production build instructions for specific hardware.
- Introduced new build scripts for optimized OS images targeting Start9 Server Pure, HP ProDesk 400 G4 DM, and Dell OptiPlex.
- Enhanced Dockerfile to specify platform compatibility and improved Alpine profile for Archipelago builds.
- Updated configuration files and init scripts to support new hardware profiles and ensure proper service management.
2026-01-31 19:47:52 +00:00

90 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
# Alpine mkimage profile for Archipelago Bitcoin Node OS
profile_archipelago() {
profile_standard
# Additional packages for Archipelago
apks="$apks
systemd
systemd-openrc
podman
podman-compose
crun
fuse-overlayfs
slirp4netns
networkmanager
networkmanager-openrc
openssh
openssh-openrc
nginx
nginx-openrc
"
# Kernel flavor
kernel_flavors="lts"
# Bootloader
boot_addons="grub-efi"
# Initfs features
initfs_features="base squashfs ext4 usb pcmcia scsi mmc nvme virtio"
# Initfs modules
initfs_modules="loop squashfs"
}
# Post-install hook - called after base system is installed
profile_apkovl() {
local apkovl="$1"
local apkroot="$2"
# Copy overlay files
if [ -d "$(dirname "$0")/overlay" ]; then
echo "📦 Installing overlay files..."
cp -a "$(dirname "$0")/overlay/"* "$apkroot"/
fi
# Install Archipelago APK if available
local apk_file="$(dirname "$0")/../../apks/archipelago-backend-"*.apk"
if ls $apk_file 1> /dev/null 2>&1; then
echo "📦 Installing Archipelago backend APK..."
cp $apk_file "$apkroot"/tmp/archipelago-backend.apk
fi
# Create first boot script
mkdir -p "$apkroot"/etc/local.d
{
echo '#!/bin/sh'
echo '# First boot installation script for Archipelago'
echo ''
echo '# Install backend APK if available'
echo 'if [ -f /tmp/archipelago-backend.apk ]; then'
echo ' apk add --allow-untrusted /tmp/archipelago-backend.apk'
echo ' rm /tmp/archipelago-backend.apk'
echo 'fi'
echo ''
echo '# Enable services'
echo 'rc-update add archipelago default 2>/dev/null || true'
echo 'systemctl enable archipelago 2>/dev/null || true'
echo ''
echo '# Create archipelago user if needed'
echo 'if ! id archipelago >/dev/null 2>&1; then'
echo ' adduser -D -s /bin/bash archipelago'
echo ' echo "archipelago ALL=(ALL) NOPASSWD: /usr/bin/podman" >>/etc/sudoers'
echo 'fi'
echo ''
echo '# Setup Podman for archipelago user'
echo 'mkdir -p /home/archipelago/.config/containers'
echo 'chown -R archipelago:archipelago /home/archipelago'
echo ''
echo '# Create data directories'
echo 'mkdir -p /var/lib/archipelago/apps /var/lib/archipelago/secrets /var/lib/archipelago/logs /var/lib/archipelago/backups'
echo 'chown -R archipelago:archipelago /var/lib/archipelago'
echo ''
echo '# Start services'
echo 'rc-service archipelago start 2>/dev/null || systemctl start archipelago 2>/dev/null || true'
} > "$apkroot"/etc/local.d/archipelago-install.start
chmod +x "$apkroot"/etc/local.d/archipelago-install.start
}