224 lines
5.9 KiB
Bash
Executable File
224 lines
5.9 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# AtlasOS Bundle Downloader for Ubuntu 24.04
|
|
# Downloads all required packages and dependencies for airgap installation
|
|
#
|
|
# Usage: sudo ./installer/bundle-downloader.sh [output-dir]
|
|
# or: sudo ./bundle-downloader.sh [output-dir] (if run from installer/ directory)
|
|
#
|
|
# This script must be run on a system with internet access and Ubuntu 24.04
|
|
# The downloaded packages can then be transferred to airgap systems
|
|
#
|
|
# Example:
|
|
# sudo ./installer/bundle-downloader.sh ./atlas-bundle
|
|
# # Transfer ./atlas-bundle to airgap system
|
|
# # On airgap: sudo ./installer/install.sh --offline-bundle ./atlas-bundle
|
|
#
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Default output directory
|
|
OUTPUT_DIR="${1:-./atlas-bundle-ubuntu24.04}"
|
|
OUTPUT_DIR=$(realpath "$OUTPUT_DIR")
|
|
|
|
echo -e "${GREEN}========================================${NC}"
|
|
echo -e "${GREEN}AtlasOS Bundle Downloader${NC}"
|
|
echo -e "${GREEN}For Ubuntu 24.04 (Noble Numbat)${NC}"
|
|
echo -e "${GREEN}========================================${NC}"
|
|
echo ""
|
|
|
|
# Check if running on Ubuntu 24.04
|
|
if [[ ! -f /etc/os-release ]]; then
|
|
echo -e "${RED}Error: Cannot detect Linux distribution${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
. /etc/os-release
|
|
|
|
if [[ "$ID" != "ubuntu" ]] || [[ "$VERSION_ID" != "24.04" ]]; then
|
|
echo -e "${YELLOW}Warning: This script is designed for Ubuntu 24.04${NC}"
|
|
echo " Detected: $ID $VERSION_ID"
|
|
read -p "Continue anyway? (y/n) " -n 1 -r
|
|
echo ""
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Check if running as root (needed for apt operations)
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo -e "${RED}Error: This script must be run as root (use sudo)${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Create output directory
|
|
echo "Creating output directory: $OUTPUT_DIR"
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
# Update package lists
|
|
echo "Updating package lists..."
|
|
apt-get update -qq
|
|
|
|
# List of packages to download (all dependencies will be included)
|
|
PACKAGES=(
|
|
# Build essentials
|
|
"build-essential"
|
|
"git"
|
|
"curl"
|
|
"wget"
|
|
"ca-certificates"
|
|
"software-properties-common"
|
|
"apt-transport-https"
|
|
|
|
# ZFS utilities
|
|
"zfsutils-linux"
|
|
"zfs-zed"
|
|
"zfs-initramfs"
|
|
|
|
# Storage services
|
|
"samba"
|
|
"samba-common-bin"
|
|
"nfs-kernel-server"
|
|
"rpcbind"
|
|
|
|
# iSCSI target
|
|
"targetcli-fb"
|
|
|
|
# Database
|
|
"sqlite3"
|
|
"libsqlite3-dev"
|
|
|
|
# Go compiler
|
|
"golang-go"
|
|
|
|
# Additional utilities
|
|
"openssl"
|
|
"net-tools"
|
|
"iproute2"
|
|
)
|
|
|
|
echo ""
|
|
echo -e "${GREEN}Downloading packages and all dependencies...${NC}"
|
|
echo ""
|
|
|
|
# Download all packages with dependencies
|
|
cd "$OUTPUT_DIR"
|
|
|
|
# Use apt-get download to get all packages including dependencies
|
|
for pkg in "${PACKAGES[@]}"; do
|
|
echo -n " Downloading $pkg... "
|
|
if apt-get download "$pkg" 2>/dev/null; then
|
|
echo -e "${GREEN}✓${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠ (may not be available)${NC}"
|
|
fi
|
|
done
|
|
|
|
# Download all dependencies recursively
|
|
echo ""
|
|
echo "Downloading all dependencies..."
|
|
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances "${PACKAGES[@]}" | grep "^\w" | sort -u) 2>/dev/null || {
|
|
echo -e "${YELLOW}Warning: Some dependencies may have been skipped${NC}"
|
|
}
|
|
|
|
# Download Go binary (if golang-go package is not sufficient)
|
|
echo ""
|
|
echo "Downloading Go binary (fallback)..."
|
|
GO_VERSION="1.22.0"
|
|
if ! wget -q "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O "$OUTPUT_DIR/go.tar.gz" 2>/dev/null; then
|
|
echo -e "${YELLOW}Warning: Could not download Go binary${NC}"
|
|
echo " You may need to download it manually from https://go.dev/dl/"
|
|
fi
|
|
|
|
# Create manifest file
|
|
echo ""
|
|
echo "Creating manifest..."
|
|
cat > "$OUTPUT_DIR/MANIFEST.txt" <<EOF
|
|
AtlasOS Bundle for Ubuntu 24.04 (Noble Numbat)
|
|
Generated: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
|
Packages: ${#PACKAGES[@]} main packages + dependencies
|
|
|
|
Main Packages:
|
|
$(printf '%s\n' "${PACKAGES[@]}")
|
|
|
|
Total .deb files: $(find "$OUTPUT_DIR" -name "*.deb" | wc -l)
|
|
|
|
Installation Instructions:
|
|
1. Transfer this entire directory to your airgap system
|
|
2. Run: sudo ./installer/install.sh --offline-bundle "$OUTPUT_DIR"
|
|
|
|
Note: Ensure all .deb files are present before transferring
|
|
EOF
|
|
|
|
# Create README
|
|
cat > "$OUTPUT_DIR/README.md" <<'EOF'
|
|
# AtlasOS Offline Bundle for Ubuntu 24.04
|
|
|
|
This bundle contains all required packages and dependencies for installing AtlasOS on an airgap (offline) Ubuntu 24.04 system.
|
|
|
|
## Contents
|
|
|
|
- All required .deb packages with dependencies
|
|
- Go binary (fallback, if needed)
|
|
- Installation manifest
|
|
|
|
## Usage
|
|
|
|
1. Transfer this entire directory to your airgap system
|
|
2. On the airgap system, run:
|
|
```bash
|
|
sudo ./installer/install.sh --offline-bundle /path/to/this/directory
|
|
```
|
|
|
|
## Bundle Size
|
|
|
|
The bundle typically contains:
|
|
- ~100-200 .deb packages (including dependencies)
|
|
- Total size: ~500MB - 1GB (depending on architecture)
|
|
|
|
## Verification
|
|
|
|
Before transferring, verify the bundle:
|
|
```bash
|
|
# Count .deb files
|
|
find . -name "*.deb" | wc -l
|
|
|
|
# Check manifest
|
|
cat MANIFEST.txt
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
If installation fails:
|
|
1. Check that all .deb files are present
|
|
2. Verify you're on Ubuntu 24.04
|
|
3. Check disk space (need at least 2GB free)
|
|
4. Review installation logs
|
|
EOF
|
|
|
|
# Summary
|
|
echo ""
|
|
echo -e "${GREEN}========================================${NC}"
|
|
echo -e "${GREEN}Bundle Download Complete!${NC}"
|
|
echo -e "${GREEN}========================================${NC}"
|
|
echo ""
|
|
echo "Output directory: $OUTPUT_DIR"
|
|
echo "Total .deb files: $(find "$OUTPUT_DIR" -name "*.deb" | wc -l)"
|
|
echo "Total size: $(du -sh "$OUTPUT_DIR" | cut -f1)"
|
|
echo ""
|
|
echo "Manifest: $OUTPUT_DIR/MANIFEST.txt"
|
|
echo "README: $OUTPUT_DIR/README.md"
|
|
echo ""
|
|
echo -e "${YELLOW}Next Steps:${NC}"
|
|
echo "1. Transfer this directory to your airgap system"
|
|
echo "2. On airgap system, run:"
|
|
echo " sudo ./installer/install.sh --offline-bundle \"$OUTPUT_DIR\""
|
|
echo ""
|