Add README, update docs, fix CRLF, SSH, and playbook network detection
- Add comprehensive README.md with full project documentation - Update SETUP.md to reflect current state (7 image types, webapp, boot tools, Samba shares) - Enable SSH in autoinstall user-data for remote access - Fix ansible_default_ipv4.interface error when no default gateway exists - Fix Windows CRLF line endings on all shell scripts and YAML files - Fix test-vm.sh: use --install kernel extraction instead of --location, don't delete source ISO on --destroy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,94 +1,94 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# download-packages.sh — Download all .deb packages needed for offline PXE server setup
|
||||
#
|
||||
# Run this on a machine with internet access running Ubuntu 24.04 (Noble).
|
||||
# It downloads every .deb needed by the Ansible playbook into a local directory,
|
||||
# which then gets bundled onto the installer USB.
|
||||
#
|
||||
# Usage:
|
||||
# ./download-packages.sh [output_directory]
|
||||
#
|
||||
# Default output: ./offline-packages/
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
OUT_DIR="${1:-./offline-packages}"
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
# Packages installed by the Ansible playbook (pxe_server_setup.yml)
|
||||
PLAYBOOK_PACKAGES=(
|
||||
ansible
|
||||
dnsmasq
|
||||
apache2
|
||||
samba
|
||||
unzip
|
||||
ufw
|
||||
cron
|
||||
wimtools
|
||||
python3-pip
|
||||
python3-venv
|
||||
p7zip-full
|
||||
)
|
||||
|
||||
# Packages installed during autoinstall late-commands (NetworkManager, WiFi, etc.)
|
||||
# These are already in your ubuntu_playbook/*.deb files, but we can refresh them here too.
|
||||
AUTOINSTALL_PACKAGES=(
|
||||
network-manager
|
||||
wpasupplicant
|
||||
wireless-tools
|
||||
linux-firmware
|
||||
firmware-sof-signed
|
||||
)
|
||||
|
||||
ALL_PACKAGES=("${PLAYBOOK_PACKAGES[@]}" "${AUTOINSTALL_PACKAGES[@]}")
|
||||
|
||||
echo "============================================"
|
||||
echo "Offline Package Downloader"
|
||||
echo "============================================"
|
||||
echo "Output directory: $OUT_DIR"
|
||||
echo ""
|
||||
echo "Packages to resolve:"
|
||||
printf ' - %s\n' "${ALL_PACKAGES[@]}"
|
||||
echo ""
|
||||
|
||||
# Update package cache
|
||||
echo "[1/3] Updating package cache..."
|
||||
sudo apt-get update -qq
|
||||
|
||||
# Simulate install to find all dependencies
|
||||
echo "[2/3] Resolving dependencies..."
|
||||
DEPS=$(apt-get install --simulate "${ALL_PACKAGES[@]}" 2>&1 \
|
||||
| grep "^Inst " \
|
||||
| awk '{print $2}' \
|
||||
| sort -u)
|
||||
|
||||
DEP_COUNT=$(echo "$DEPS" | wc -l)
|
||||
echo " Found $DEP_COUNT packages (including dependencies)"
|
||||
|
||||
# Download all packages
|
||||
echo "[3/4] Downloading .deb packages to $OUT_DIR..."
|
||||
cd "$OUT_DIR"
|
||||
apt-get download $DEPS 2>&1 | tail -5
|
||||
|
||||
DEB_COUNT=$(ls -1 *.deb 2>/dev/null | wc -l)
|
||||
TOTAL_SIZE=$(du -sh . | cut -f1)
|
||||
|
||||
echo " $DEB_COUNT packages ($TOTAL_SIZE)"
|
||||
|
||||
# Download pip wheels for Flask webapp (offline install)
|
||||
echo "[4/4] Downloading Python wheels for webapp..."
|
||||
PIP_DIR="$(dirname "$OUT_DIR")/pip-wheels"
|
||||
mkdir -p "$PIP_DIR"
|
||||
pip3 download -d "$PIP_DIR" flask lxml 2>&1 | tail -5
|
||||
|
||||
WHL_COUNT=$(ls -1 "$PIP_DIR"/*.whl "$PIP_DIR"/*.tar.gz 2>/dev/null | wc -l)
|
||||
echo " $WHL_COUNT Python packages downloaded to pip-wheels/"
|
||||
|
||||
echo ""
|
||||
echo "============================================"
|
||||
echo "Download complete!"
|
||||
echo "============================================"
|
||||
echo " .deb packages: $DEB_COUNT ($TOTAL_SIZE) in $OUT_DIR/"
|
||||
echo " Python wheels: $WHL_COUNT in $PIP_DIR/"
|
||||
echo ""
|
||||
#!/bin/bash
|
||||
#
|
||||
# download-packages.sh — Download all .deb packages needed for offline PXE server setup
|
||||
#
|
||||
# Run this on a machine with internet access running Ubuntu 24.04 (Noble).
|
||||
# It downloads every .deb needed by the Ansible playbook into a local directory,
|
||||
# which then gets bundled onto the installer USB.
|
||||
#
|
||||
# Usage:
|
||||
# ./download-packages.sh [output_directory]
|
||||
#
|
||||
# Default output: ./offline-packages/
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
OUT_DIR="${1:-./offline-packages}"
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
# Packages installed by the Ansible playbook (pxe_server_setup.yml)
|
||||
PLAYBOOK_PACKAGES=(
|
||||
ansible
|
||||
dnsmasq
|
||||
apache2
|
||||
samba
|
||||
unzip
|
||||
ufw
|
||||
cron
|
||||
wimtools
|
||||
python3-pip
|
||||
python3-venv
|
||||
p7zip-full
|
||||
)
|
||||
|
||||
# Packages installed during autoinstall late-commands (NetworkManager, WiFi, etc.)
|
||||
# These are already in your ubuntu_playbook/*.deb files, but we can refresh them here too.
|
||||
AUTOINSTALL_PACKAGES=(
|
||||
network-manager
|
||||
wpasupplicant
|
||||
wireless-tools
|
||||
linux-firmware
|
||||
firmware-sof-signed
|
||||
)
|
||||
|
||||
ALL_PACKAGES=("${PLAYBOOK_PACKAGES[@]}" "${AUTOINSTALL_PACKAGES[@]}")
|
||||
|
||||
echo "============================================"
|
||||
echo "Offline Package Downloader"
|
||||
echo "============================================"
|
||||
echo "Output directory: $OUT_DIR"
|
||||
echo ""
|
||||
echo "Packages to resolve:"
|
||||
printf ' - %s\n' "${ALL_PACKAGES[@]}"
|
||||
echo ""
|
||||
|
||||
# Update package cache
|
||||
echo "[1/3] Updating package cache..."
|
||||
sudo apt-get update -qq
|
||||
|
||||
# Simulate install to find all dependencies
|
||||
echo "[2/3] Resolving dependencies..."
|
||||
DEPS=$(apt-get install --simulate "${ALL_PACKAGES[@]}" 2>&1 \
|
||||
| grep "^Inst " \
|
||||
| awk '{print $2}' \
|
||||
| sort -u)
|
||||
|
||||
DEP_COUNT=$(echo "$DEPS" | wc -l)
|
||||
echo " Found $DEP_COUNT packages (including dependencies)"
|
||||
|
||||
# Download all packages
|
||||
echo "[3/4] Downloading .deb packages to $OUT_DIR..."
|
||||
cd "$OUT_DIR"
|
||||
apt-get download $DEPS 2>&1 | tail -5
|
||||
|
||||
DEB_COUNT=$(ls -1 *.deb 2>/dev/null | wc -l)
|
||||
TOTAL_SIZE=$(du -sh . | cut -f1)
|
||||
|
||||
echo " $DEB_COUNT packages ($TOTAL_SIZE)"
|
||||
|
||||
# Download pip wheels for Flask webapp (offline install)
|
||||
echo "[4/4] Downloading Python wheels for webapp..."
|
||||
PIP_DIR="$(dirname "$OUT_DIR")/pip-wheels"
|
||||
mkdir -p "$PIP_DIR"
|
||||
pip3 download -d "$PIP_DIR" flask lxml 2>&1 | tail -5
|
||||
|
||||
WHL_COUNT=$(ls -1 "$PIP_DIR"/*.whl "$PIP_DIR"/*.tar.gz 2>/dev/null | wc -l)
|
||||
echo " $WHL_COUNT Python packages downloaded to pip-wheels/"
|
||||
|
||||
echo ""
|
||||
echo "============================================"
|
||||
echo "Download complete!"
|
||||
echo "============================================"
|
||||
echo " .deb packages: $DEB_COUNT ($TOTAL_SIZE) in $OUT_DIR/"
|
||||
echo " Python wheels: $WHL_COUNT in $PIP_DIR/"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user