Dorian c9722a34f6 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.
2026-02-01 02:22:02 +00:00

274 lines
7.8 KiB
Bash
Executable File

#!/bin/bash
#
# Archipelago Disk Installer
# Installs Archipelago Bitcoin Node OS to a disk
#
set -e
echo ""
echo "╔═══════════════════════════════════════════════════════════╗"
echo "║ 🏝️ ARCHIPELAGO DISK INSTALLER ║"
echo "╚═══════════════════════════════════════════════════════════╝"
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "❌ Please run as root: sudo $0"
exit 1
fi
# Install required tools if missing
echo "📦 Checking required tools..."
NEED_INSTALL=""
for tool in parted debootstrap; do
if ! command -v $tool >/dev/null 2>&1; then
NEED_INSTALL="$NEED_INSTALL $tool"
fi
done
if [ -n "$NEED_INSTALL" ]; then
echo "📥 Installing required tools:$NEED_INSTALL"
apt-get update
apt-get install -y $NEED_INSTALL dosfstools e2fsprogs
echo ""
fi
# List available disks
echo "📋 Available disks:"
echo ""
lsblk -d -o NAME,SIZE,MODEL | grep -v loop | grep -v sr
echo ""
# Get target disk
read -p "Enter target disk (e.g., sda, nvme0n1): " TARGET_DISK
TARGET_DEVICE="/dev/$TARGET_DISK"
if [ ! -b "$TARGET_DEVICE" ]; then
echo "❌ Device $TARGET_DEVICE not found"
exit 1
fi
# Confirm
echo ""
echo "⚠️ WARNING: This will ERASE ALL DATA on $TARGET_DEVICE"
echo ""
read -p "Type 'yes' to continue: " CONFIRM
if [ "$CONFIRM" != "yes" ]; then
echo "Aborted."
exit 1
fi
echo ""
echo "🔧 Partitioning $TARGET_DEVICE..."
# Unmount any existing partitions
umount ${TARGET_DEVICE}* 2>/dev/null || true
# Create GPT partition table
parted -s "$TARGET_DEVICE" mklabel gpt
# Create partitions:
# 1. EFI System Partition (512MB)
# 2. Root partition (remaining space)
parted -s "$TARGET_DEVICE" mkpart primary fat32 1MiB 513MiB
parted -s "$TARGET_DEVICE" set 1 esp on
parted -s "$TARGET_DEVICE" mkpart primary ext4 513MiB 100%
# Wait for partitions to appear
sleep 2
# Determine partition names (handle both /dev/sdX and /dev/nvmeXnYpZ naming)
if [[ "$TARGET_DISK" == nvme* ]]; then
EFI_PART="${TARGET_DEVICE}p1"
ROOT_PART="${TARGET_DEVICE}p2"
else
EFI_PART="${TARGET_DEVICE}1"
ROOT_PART="${TARGET_DEVICE}2"
fi
echo "🗂️ Formatting partitions..."
# Format EFI partition
mkfs.vfat -F32 -n ARCHIPELAGO "$EFI_PART"
# Format root partition
mkfs.ext4 -L archipelago-root "$ROOT_PART"
echo "📦 Mounting partitions..."
# Create mount points
mkdir -p /mnt/archipelago
mount "$ROOT_PART" /mnt/archipelago
mkdir -p /mnt/archipelago/boot/efi
mount "$EFI_PART" /mnt/archipelago/boot/efi
echo "📋 Installing base system..."
# Install base system using debootstrap
if command -v debootstrap >/dev/null 2>&1; then
debootstrap --arch=amd64 bookworm /mnt/archipelago http://deb.debian.org/debian
else
echo "❌ debootstrap not found. Installing..."
apt-get update && apt-get install -y debootstrap
debootstrap --arch=amd64 bookworm /mnt/archipelago http://deb.debian.org/debian
fi
echo "⚙️ Configuring system..."
# Mount virtual filesystems
mount --bind /dev /mnt/archipelago/dev
mount --bind /proc /mnt/archipelago/proc
mount --bind /sys /mnt/archipelago/sys
# Create fstab
cat > /mnt/archipelago/etc/fstab <<EOF
# Archipelago Bitcoin Node OS
UUID=$(blkid -s UUID -o value "$ROOT_PART") / ext4 errors=remount-ro 0 1
UUID=$(blkid -s UUID -o value "$EFI_PART") /boot/efi vfat umask=0077 0 1
EOF
# Set hostname
echo "archipelago" > /mnt/archipelago/etc/hostname
# Configure hosts
cat > /mnt/archipelago/etc/hosts <<EOF
127.0.0.1 localhost
127.0.1.1 archipelago
::1 localhost ip6-localhost ip6-loopback
EOF
# Install bootloader and essential packages
chroot /mnt/archipelago /bin/bash <<'CHROOT_EOF'
export DEBIAN_FRONTEND=noninteractive
# Add sources
cat > /etc/apt/sources.list <<EOF
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
EOF
apt-get update
# Install kernel, bootloader, and essentials
apt-get install -y \
linux-image-amd64 \
grub-efi-amd64 \
sudo \
networkmanager \
openssh-server \
curl \
wget \
htop \
vim \
git \
podman \
podman-compose \
buildah \
skopeo
# Install GRUB
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=archipelago
update-grub
# Create archipelago user
useradd -m -s /bin/bash -G sudo,podman archipelago
echo "archipelago:archipelago" | chpasswd
# Enable services
systemctl enable NetworkManager
systemctl enable ssh
systemctl enable podman
# Create Archipelago directories
mkdir -p /var/lib/archipelago/{data,config,containers}
mkdir -p /etc/archipelago
chown -R archipelago:archipelago /var/lib/archipelago
echo "✅ Base system installed"
CHROOT_EOF
# Copy Archipelago files
echo "📋 Installing Archipelago components..."
BOOT_MEDIA=""
for dev in /run/live/medium /lib/live/mount/medium /cdrom; do
if [ -d "$dev/archipelago" ]; then
BOOT_MEDIA="$dev"
break
fi
done
if [ -n "$BOOT_MEDIA" ]; then
echo " Copying from: $BOOT_MEDIA/archipelago"
# Copy entire archipelago directory
mkdir -p /mnt/archipelago/opt/archipelago
cp -r "$BOOT_MEDIA/archipelago/"* /mnt/archipelago/opt/archipelago/ 2>/dev/null || true
# Install binaries
if [ -d "$BOOT_MEDIA/archipelago/bin" ]; then
cp "$BOOT_MEDIA/archipelago/bin/"* /mnt/archipelago/usr/local/bin/ 2>/dev/null || true
chmod +x /mnt/archipelago/usr/local/bin/* 2>/dev/null || true
fi
# Install scripts
if [ -d "$BOOT_MEDIA/archipelago/scripts" ]; then
mkdir -p /mnt/archipelago/opt/archipelago/scripts
cp "$BOOT_MEDIA/archipelago/scripts/"* /mnt/archipelago/opt/archipelago/scripts/ 2>/dev/null || true
chmod +x /mnt/archipelago/opt/archipelago/scripts/*.sh 2>/dev/null || true
fi
# Install app manifests
if [ -d "$BOOT_MEDIA/archipelago/apps" ]; then
mkdir -p /mnt/archipelago/etc/archipelago
cp -r "$BOOT_MEDIA/archipelago/apps" /mnt/archipelago/etc/archipelago/
fi
# Create profile.d script for auto-menu on login
mkdir -p /mnt/archipelago/etc/profile.d
cat > /mnt/archipelago/etc/profile.d/archipelago.sh <<'PROFILE_EOF'
#!/bin/bash
# Archipelago welcome message
if [ -t 0 ] && [ -z "$ARCHIPELAGO_WELCOMED" ]; then
export ARCHIPELAGO_WELCOMED=1
IP=$(hostname -I 2>/dev/null | awk '{print $1}')
echo ""
echo " 🏝️ Welcome to Archipelago Bitcoin Node OS"
echo ""
if [ -n "$IP" ]; then
echo " Web UI: http://$IP"
fi
echo " Menu: Type 'archipelago' to open setup menu"
echo ""
fi
PROFILE_EOF
chmod +x /mnt/archipelago/etc/profile.d/archipelago.sh
fi
echo "🧹 Cleaning up..."
# Unmount
umount /mnt/archipelago/dev
umount /mnt/archipelago/proc
umount /mnt/archipelago/sys
umount /mnt/archipelago/boot/efi
umount /mnt/archipelago
echo ""
echo "╔═══════════════════════════════════════════════════════════╗"
echo "║ ✅ INSTALLATION COMPLETE! ║"
echo "╚═══════════════════════════════════════════════════════════╝"
echo ""
echo "Remove the USB drive and reboot to start Archipelago."
echo ""
echo "Default login:"
echo " Username: archipelago"
echo " Password: archipelago"
echo ""
echo "⚠️ Please change the password after first login!"
echo ""