4e0ab94ee2
- Added start-llama-server.bat with cross-brand GPU auto-detection: * Detection 1: nvidia-smi for NVIDIA * Detection 2: WMIC for AMD, Intel Arc, Intel HD/Iris/UHD * Detection 3: vulkaninfo as final fallback probe * Falls back to CPU-only build when no GPU found - Downloaded llama-server b9947 builds: * Vulkan build (91 MB) - supports all GPU brands * CPU build (45 MB) - fallback in cpu/ subdir - Downloaded Qwen2.5-Coder-1.5B Q4_K_M model (1.1 GB) - Fixed run-hermes.bat polling: replaces fixed 5s timeout with curl-based readiness polling (up to 30 attempts, 1s apart) - All .bat files verified: ASCII text, CRLF line terminators - Added .gitignore for build artifacts and large binaries
97 lines
3.4 KiB
Bash
Executable File
97 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Quick rebuild: extract existing ISO, update files, repack
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
BUILD_DIR="$PROJECT_DIR/build"
|
|
EXISTING_ISO="$BUILD_DIR/output/hermes-rescue.iso"
|
|
OUTPUT_DIR="$BUILD_DIR/output"
|
|
WORKDIR="/tmp/hermes-iso-quick"
|
|
SOURCE_DIR="$PROJECT_DIR/src"
|
|
|
|
info() { echo -e "\033[0;34m[INFO]\033[0m $*"; }
|
|
ok() { echo -e "\033[0;32m[OK]\033[0m $*"; }
|
|
die() { echo -e "\033[0;31m[ERROR]\033[0m $*"; exit 1; }
|
|
|
|
# Check prerequisites
|
|
for cmd in unsquashfs mksquashfs xorriso rsync; do
|
|
command -v "$cmd" &>/dev/null || die "$cmd not found"
|
|
done
|
|
|
|
[[ -f "$EXISTING_ISO" ]] || die "Existing ISO not found: $EXISTING_ISO"
|
|
|
|
rm -rf "$WORKDIR"
|
|
mkdir -p "$WORKDIR/iso-contents" "$WORKDIR/squashfs-root"
|
|
|
|
info "Mounting existing ISO..."
|
|
mkdir -p /mnt/hermes-iso-source
|
|
mount -o loop "$EXISTING_ISO" /mnt/hermes-iso-source 2>/dev/null || die "Failed to mount ISO"
|
|
|
|
info "Copying ISO contents (excluding squashfs)..."
|
|
rsync -a --exclude="casper/filesystem.squashfs" \
|
|
/mnt/hermes-iso-source/ "$WORKDIR/iso-contents/" 2>/dev/null
|
|
|
|
info "Extracting squashfs..."
|
|
cp /mnt/hermes-iso-source/casper/filesystem.squashfs "$WORKDIR/filesystem.squashfs"
|
|
umount /mnt/hermes-iso-source 2>/dev/null || true
|
|
|
|
unsquashfs -d "$WORKDIR/squashfs-root" -f "$WORKDIR/filesystem.squashfs" 2>&1 | tail -3
|
|
ok "Squashfs extracted ($(du -sh "$WORKDIR/squashfs-root" | cut -f1))"
|
|
|
|
info "Updating config.yaml..."
|
|
cp "$SOURCE_DIR/hermes/config.yaml" "$WORKDIR/squashfs-root/hermes/config.yaml"
|
|
ok "config.yaml updated"
|
|
|
|
info "Updating auth.json..."
|
|
cp "$SOURCE_DIR/hermes/auth.json" "$WORKDIR/squashfs-root/hermes/auth.json"
|
|
ok "auth.json updated"
|
|
|
|
info "Updating autorun.sh..."
|
|
cp "$SOURCE_DIR/hermes/autorun.sh" "$WORKDIR/squashfs-root/hermes/autorun.sh"
|
|
ok "autorun.sh updated"
|
|
|
|
info "Re-packing squashfs..."
|
|
mksquashfs "$WORKDIR/squashfs-root" "$WORKDIR/iso-contents/casper/filesystem.squashfs" \
|
|
-comp lz4 -b 1M -noappend -processors 1 2>&1 | tail -5
|
|
ok "Squashfs repacked ($(du -sh "$WORKDIR/iso-contents/casper/filesystem.squashfs" | cut -f1))"
|
|
|
|
# Update filesystem.size
|
|
fs_size=$(du -sx --block-size=1 "$WORKDIR/squashfs-root" 2>/dev/null | cut -f1)
|
|
echo "$fs_size" > "$WORKDIR/iso-contents/casper/filesystem.size"
|
|
ok "filesystem.size updated"
|
|
|
|
info "Generating ISO..."
|
|
OUTPUT_ISO="$OUTPUT_DIR/hermes-rescue.iso"
|
|
EFI_IMG=$(find "$WORKDIR/iso-contents" -name "efi.img" -o -name "eltorito.img" 2>/dev/null | head -1 | sed "s|$WORKDIR/iso-contents/||")
|
|
|
|
if [[ -n "$EFI_IMG" ]]; then
|
|
xorriso -as mkisofs -r -V "HERMES_RESCUE" \
|
|
-J -joliet-long \
|
|
-isohybrid-mbr "$WORKDIR/iso-contents/isohdpfx.bin" \
|
|
-b isolinux/isolinux.bin \
|
|
-c isolinux/boot.cat \
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
|
-eltorito-alt-boot -e "$EFI_IMG" -no-emul-boot \
|
|
-isohybrid-gpt-basdat \
|
|
-isohybrid-apm-hfsplus \
|
|
-o "$OUTPUT_ISO" \
|
|
"$WORKDIR/iso-contents" 2>&1 | tail -5
|
|
else
|
|
xorriso -as mkisofs -r -V "HERMES_RESCUE" \
|
|
-J -joliet-long \
|
|
-isohybrid-mbr "$WORKDIR/iso-contents/isohdpfx.bin" \
|
|
-b isolinux/isolinux.bin \
|
|
-c isolinux/boot.cat \
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
|
-o "$OUTPUT_ISO" \
|
|
"$WORKDIR/iso-contents" 2>&1 | tail -5
|
|
fi
|
|
|
|
iso_size=$(du -h "$OUTPUT_ISO" | cut -f1)
|
|
ok "ISO generated: $OUTPUT_ISO ($iso_size)"
|
|
|
|
info "Cleaning up..."
|
|
rm -rf "$WORKDIR"
|
|
ok "Done!"
|