diff --git a/README.md b/README.md index 92ee230a..fe23cff0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -ghostbsd-build (Greenfield) +ghostbsd-build ============== Live media creator for GhostBSD distribution @@ -8,14 +8,14 @@ The purpose of this tool is to quickly generate live images for GhostBSD. ## Features * Build GhostBSD from packages -* Multiple desktop environments (Mate, XFCE, Gershwin, Plasma, and more) +* Multiple desktop environments (Mate, XFCE, Gershwin, and KDE Plasma 6) * Hybrid DVD/USB image * Configurable ZFS memory management for build optimization * Gzip compression support for smaller system images * Enhanced error handling and debugging ## Graphics support -* Compatible with VirtualBox, VMware, NVIDIA graphics out of the box +* Compatible with VirtualBox, VMware, NVIDIA graphics out of box * SCFB support with automatic best resolution for UEFI enabled systems with Intel/AMD graphics ## System requirements @@ -60,16 +60,17 @@ or for unstable builds: ``` ./build.sh -d xfce -b release ``` -#### (Option) To build GhostBSD with __KDE Plasma 6__ as default desktop -``` -./build.sh -d plasma -b unstable -``` #### To build GhostBSD with __Gershwin__ as default desktop ``` ./build.sh -d gershwin -b release ``` +#### To build GhostBSD with __Kde Plasma 6__ as default desktop +``` +.build.sh -d plasma -b unstable +``` + ## Build options #### ZFS Memory Control @@ -103,6 +104,14 @@ All modes except 'off' automatically restore original ZFS settings after build c ./build.sh -h ``` +## Build process enhancements + +* **Memory requirement increase**: Builds now require 8GB minimum memory for reliable operation +* **Smart ZFS tuning**: Automatic host ZFS ARC optimization during builds with full restoration +* **Gzip compression**: System images are compressed for faster boot times and smaller ISOs +* **Enhanced error handling**: Better debugging output and recovery from common build failures +* **Login.conf fixes**: Prevents cap_mkdb errors during package installation + ## Burn an image to cd: ``` cdrecord /usr/local/ghostbsd-build/iso/GhostBSD-25.02-R14.3p2.iso diff --git a/assets/ghostbsd-logo.pcx b/assets/ghostbsd-logo.pcx new file mode 100644 index 00000000..4013539a Binary files /dev/null and b/assets/ghostbsd-logo.pcx differ diff --git a/boot/loader.conf b/boot/loader.conf index e7f7953e..2f6abbf5 100644 --- a/boot/loader.conf +++ b/boot/loader.conf @@ -47,3 +47,10 @@ hw.usb.usbhid.enable="1" usbhid_load="YES" # For UTouch Support utouch_load="YES" + +# GhostBSD Additional System Configuration +rc_system="bsdrc" +crypto_load="YES" +aesni_load="YES" +geom_eli_load="YES" + diff --git a/build.sh b/build.sh index ba4c8d75..189adbc9 100755 --- a/build.sh +++ b/build.sh @@ -2,16 +2,41 @@ set -e -u -cwd="$(realpath)" +cwd="$(realpath .)" export cwd # ZFS Control Configuration export zfs_control="${zfs_control:-auto}" # off, auto, conservative, aggressive, restore export ARC_WAS_TUNED=false # Initialize to prevent cleanup errors -# Enhanced logging function +# -------- Logging (color-ready, default OFF) -------- +# Toggle: 0 = plain (default), 1 = color on +# Honors NO_COLOR (https://no-color.org) and FORCE_COLOR. +: "${LOG_COLOR:=0}" +[ -n "${NO_COLOR:-}" ] && LOG_COLOR=0 +[ -n "${FORCE_COLOR:-}" ] && LOG_COLOR=1 + +# ANSI color codes +RED="\033[31m"; GREEN="\033[32m"; YELLOW="\033[33m"; BLUE="\033[34m"; CYAN="\033[36m"; RESET="\033[0m" + log() { - echo "$(date '+%H:%M:%S') [BUILD] $*" + # plain if disabled or not a TTY + if [ "$LOG_COLOR" -ne 1 ] || [ ! -t 1 ]; then + echo "$*" + return + fi + + # Color by common prefixes/headings + _c="$CYAN" + case "$1" in + ERROR:*|Error:*|error:*) _c="$RED" ;; + WARNING:*|Warning:*|warn:*) _c="$YELLOW" ;; + SUCCESS:*|Success:*) _c="$GREEN" ;; + INFO:*|Info:*) _c="$BLUE" ;; + "=== "*) _c="$BLUE" ;; # section headers like "=== Creating ..." + esac + # shellcheck disable=SC2059 + printf "%b\n" "${_c}$*${RESET}" } error_exit() { @@ -69,7 +94,7 @@ done # Validate zfs_control option case "$zfs_control" in "off"|"auto"|"conservative"|"aggressive"|"restore") ;; - *) + *) printf "Invalid ZFS control option: %s\n" "$zfs_control" printf "Valid options: off, auto, conservative, aggressive, restore\n" exit 1 @@ -133,17 +158,17 @@ zfs_arc_save() { log "ZFS not loaded, skipping ARC management" return 0 fi - + # Save current ARC settings original_arc_max=$(sysctl -n vfs.zfs.arc_max 2>/dev/null || echo "0") original_arc_min=$(sysctl -n vfs.zfs.arc_min 2>/dev/null || echo "0") - + log "Current ARC settings: max=${original_arc_max}, min=${original_arc_min}" - + # Save to temp files for restoration echo "$original_arc_max" > /tmp/ghostbsd_build_arc_max echo "$original_arc_min" > /tmp/ghostbsd_build_arc_min - + export SAVED_ARC_SETTINGS=true } @@ -152,24 +177,24 @@ zfs_arc_analyze_and_tune() { log "ZFS control disabled, leaving host ARC unchanged" return 0 fi - + if ! kldstat | grep -q zfs; then log "ZFS not detected" return 0 fi - + # Calculate optimal build settings realmem=$(sysctl -n hw.realmem) realmem_gb=$((realmem / 1024 / 1024 / 1024)) current_arc_max=$(sysctl -n vfs.zfs.arc_max 2>/dev/null || echo "0") current_arc_max_gb=$((current_arc_max / 1024 / 1024 / 1024)) - + # Calculate build-optimized ARC (30% of RAM, leaves more for build processes) build_arc_max=$((realmem * 30 / 100)) build_arc_max_gb=$((build_arc_max / 1024 / 1024 / 1024)) - + log "Memory analysis: ${realmem_gb}GB total, current ARC: ${current_arc_max_gb}GB, optimal build ARC: ${build_arc_max_gb}GB" - + # Decision logic based on zfs_control setting should_tune=false case "$zfs_control" in @@ -198,7 +223,7 @@ zfs_arc_analyze_and_tune() { log "${zfs_control} mode: Applying build-optimized ARC settings" ;; esac - + if [ "$should_tune" = "true" ]; then log "Applying build-optimized ZFS ARC settings..." sysctl vfs.zfs.arc_max=$build_arc_max >/dev/null 2>&1 || true @@ -214,15 +239,15 @@ zfs_arc_restore() { if [ "$zfs_control" = "off" ] || [ "$ARC_WAS_TUNED" != "true" ]; then return 0 fi - + if [ ! -f /tmp/ghostbsd_build_arc_max ]; then log "Warning: No saved ARC settings found for restoration" return 0 fi - + original_arc_max=$(cat /tmp/ghostbsd_build_arc_max) original_arc_min=$(cat /tmp/ghostbsd_build_arc_min) - + if [ "$original_arc_max" != "0" ]; then log "Restoring original ZFS ARC settings..." # shellcheck disable=SC2086 @@ -231,11 +256,11 @@ zfs_arc_restore() { # shellcheck disable=SC2086 sysctl vfs.zfs.arc_min=$original_arc_min >/dev/null 2>&1 || true fi - + restored_max_gb=$((original_arc_max / 1024 / 1024 / 1024)) log "Restored ARC max to ${restored_max_gb}GB" fi - + # Clean up temp files rm -f /tmp/ghostbsd_build_arc_max /tmp/ghostbsd_build_arc_min } @@ -254,35 +279,35 @@ workspace() { log "=== Enhanced Workspace Setup with ZFS Control ===" log "ZFS control mode: ${zfs_control}" - + # Save current ARC settings first zfs_arc_save - + # Pre-build environment analysis log "Analyzing build environment..." - + # 1. Memory Analysis - Updated for 8GB minimum realmem=$(sysctl -n hw.realmem) realmem_gb=$((realmem / 1024 / 1024 / 1024)) log "Available memory: ${realmem_gb}GB" - + if [ $realmem_gb -lt 8 ]; then error_exit "GhostBSD build requires at least 8GB RAM. Detected: ${realmem_gb}GB. Please use a system with more memory." elif [ $realmem_gb -lt 12 ]; then log "WARNING: 8-12GB RAM detected. Build will work but may experience memory pressure." log "Consider using a system with 16GB+ RAM for optimal build performance." fi - + # 2. Disk Space Analysis - Updated for larger requirements log "Analyzing disk space..." workdir_avail=$(df /usr/local | tail -1 | awk '{print $4}') workdir_avail_gb=$((workdir_avail / 1024 / 1024)) log "Available space in /usr/local: ${workdir_avail_gb}GB" - + if [ $workdir_avail_gb -lt 20 ]; then error_exit "Insufficient disk space. Need at least 20GB free in /usr/local for 8GB minimum builds, have ${workdir_avail_gb}GB" fi - + # 3. Check for previous failed builds if [ -d "${livecd}" ]; then log "Found previous build directory, analyzing..." @@ -295,10 +320,10 @@ workspace() fi fi fi - + # 4. ZFS ARC tuning with user control zfs_arc_analyze_and_tune - + # Unmount any existing mounts and clean up log "Cleaning up previous build artifacts..." umount ${packages_storage} >/dev/null 2>/dev/null || true @@ -314,7 +339,7 @@ workspace() # Detach memory device if previously attached mdconfig -d -u 0 >/dev/null 2>/dev/null || true - + # Remove old pool image if it exists if [ -f "${livecd}/pool.img" ] ; then rm ${livecd}/pool.img @@ -327,7 +352,7 @@ workspace() POOL_SIZE='6656M' # 6.5GB in MB (6.5 * 1024 = 6656) - increased from 6g to accommodate larger 8GB systems log "Creating ${POOL_SIZE} pool image for 8GB minimum system..." truncate -s ${POOL_SIZE} ${livecd}/pool.img - + # Attach the pool image as a memory disk mdconfig -f ${livecd}/pool.img -u 0 @@ -337,21 +362,21 @@ workspace() # Provide detailed error message in case of failure log "Error: Failed to create ZFS pool 'ghostbsd' with the following command:" log "zpool create -O mountpoint='${release}' -O compression=zstd-9 ghostbsd /dev/md0" - + # Clean up resources in case of failure zpool destroy ghostbsd 2>/dev/null || true mdconfig -d -u 0 2>/dev/null || true rm -f ${livecd}/pool.img 2>/dev/null || true - + # Exit with an error code exit 1 fi - + # Verify pool creation log "Verifying ZFS pool..." zpool status ghostbsd zpool list ghostbsd - + log "Workspace setup completed successfully for 8GB minimum system" } @@ -366,10 +391,10 @@ base() base_list="$(cat "${cwd}/packages/base")" vital_base="$(cat "${cwd}/packages/vital/base")" fi - + mkdir -p ${release}/etc cp /etc/resolv.conf ${release}/etc/resolv.conf - + # CRITICAL FIX: Create a proper login.conf BEFORE installing packages log "Creating login.conf to prevent cap_mkdb errors..." cat > "${release}/etc/login.conf" << 'EOF' @@ -435,16 +460,16 @@ EOF # Don't try to run cap_mkdb in chroot before base packages are installed # Just create a minimal database file to prevent package installation failures touch "${release}/etc/login.conf.db" - + # Verify the files were created if [ ! -f "${release}/etc/login.conf" ]; then error_exit "Failed to create login.conf" fi log "login.conf created successfully" - + mkdir -p ${release}/var/cache/pkg mount_nullfs ${packages_storage} ${release}/var/cache/pkg - + # Install base packages with enhanced error handling log "Installing base packages with login.conf fix..." # shellcheck disable=SC2086 @@ -456,16 +481,16 @@ EOF tail -20 /var/log/messages 2>/dev/null || echo "No system logs available" error_exit "Base package installation failed" fi - + # shellcheck disable=SC2086 pkg -r ${release} -R "${cwd}/pkg/" set -y -v 1 ${vital_base} - + # Clean up rm ${release}/etc/resolv.conf umount ${release}/var/cache/pkg touch ${release}/etc/fstab mkdir ${release}/cdrom ${release}/mnt ${release}/media - + log "Base system setup completed" } @@ -488,19 +513,19 @@ set_ghostbsd_version() packages_software() { log "=== Installing desktop and software packages with enhanced protection ===" - + if [ "${build_type}" = "unstable" ] ; then cp pkg/GhostBSD_Unstable.conf ${release}/etc/pkg/GhostBSD.conf fi if [ "${build_type}" = "testing" ] ; then cp pkg/GhostBSD_Testing.conf ${release}/etc/pkg/GhostBSD.conf fi - + cp /etc/resolv.conf ${release}/etc/resolv.conf mkdir -p ${release}/var/cache/pkg mount_nullfs ${packages_storage} ${release}/var/cache/pkg mount -t devfs devfs ${release}/dev - + # Double-check login.conf before package installation log "Verifying login.conf before package installation..." if [ ! -f "${release}/etc/login.conf" ]; then @@ -515,19 +540,19 @@ default:\ EOF chroot ${release} cap_mkdb /etc/login.conf 2>/dev/null || touch "${release}/etc/login.conf.db" fi - + # Verify login.conf.db exists if [ ! -f "${release}/etc/login.conf.db" ]; then log "Creating login.conf.db..." chroot ${release} cap_mkdb /etc/login.conf 2>/dev/null || touch "${release}/etc/login.conf.db" fi - + de_packages="$(cat "${cwd}/packages/${desktop}")" common_packages="$(cat "${cwd}/packages/common")" drivers_packages="$(cat "${cwd}/packages/drivers")" vital_de_packages="$(cat "${cwd}/packages/vital/${desktop}")" vital_common_packages="$(cat "${cwd}/packages/vital/common")" - + # Install packages with better error handling log "Installing desktop environment and common packages..." # shellcheck disable=SC2086 @@ -537,25 +562,25 @@ EOF dmesg | tail -10 log "Login.conf status:" ls -la ${release}/etc/login.conf* - + # Try to fix and retry once log "Attempting to fix login.conf and retry..." chroot ${release} cap_mkdb /etc/login.conf 2>/dev/null || true - + # shellcheck disable=SC2086 if ! pkg -c ${release} install -y ${de_packages} ${common_packages} ${drivers_packages}; then error_exit "Package installation failed even after login.conf fix" fi fi - + # shellcheck disable=SC2086 pkg -c ${release} set -y -v 1 ${vital_de_packages} ${vital_common_packages} - + mkdir -p ${release}/proc mkdir -p ${release}/compat/linux/proc rm ${release}/etc/resolv.conf umount ${release}/var/cache/pkg - + log "Package installation completed successfully" } @@ -579,7 +604,7 @@ fetch_x_drivers_packages() fetch -o ${release}/xdrivers "${pkg_url}/All/$line" done ls ${release}/xdrivers - + log "X driver packages fetched" } @@ -605,7 +630,7 @@ rc() chroot ${release} sysrc ntpd_enable="YES" chroot ${release} sysrc ntpd_sync_on_start="YES" chroot ${release} sysrc clear_tmp_enable="YES" - + log "System services configured" } @@ -615,6 +640,15 @@ ghostbsd_config() # echo "gop set 0" >> ${release}/boot/loader.rc.local mkdir -p ${release}/usr/local/share/ghostbsd echo "${desktop}" > ${release}/usr/local/share/ghostbsd/desktop + + # Add splash screen image to boot directory + if [ -f "${cwd}/assets/ghostbsd-logo.pcx" ]; then + cp "${cwd}/assets/ghostbsd-logo.pcx" "${release}/boot/splash.pcx" + log "Splash screen image added to boot directory" + else + log "WARNING: No splash screen image found at ${cwd}/assets/ghostbsd-logo.pcx" + fi + # Mkdir for linux compat to ensure /etc/fstab can mount when booting LiveCD chroot ${release} mkdir -p /compat/linux/dev/shm chroot ${release} mkdir -p /compat/linux/proc @@ -623,11 +657,11 @@ ghostbsd_config() chroot ${release} touch /boot/entropy # default GhostBSD to local time instead of UTC chroot ${release} touch /etc/wall_cmos_clock - + log "GhostBSD configuration applied" } -# Clean desktop_config function that avoids user creation conflicts +# Enhanced desktop_config function with post-package splash setup desktop_config() { # shellcheck disable=SC2218 @@ -637,78 +671,121 @@ desktop_config() # shellcheck disable=SC2218 log "Loading common configuration functions..." . "${cwd}/common_config/base-setting.sh" - . "${cwd}/common_config/gitpkg.sh" + . "${cwd}/common_config/gitpkg.sh" . "${cwd}/common_config/finalize.sh" - + # Apply base patches and settings log "Applying base system patches..." patch_etc_files - + # Install git packages log "Installing git-based packages..." git_pc_sysinstall git_gbi git_install_station git_setup_station - + # Run desktop-specific configuration script (this handles user setup) log "Running desktop-specific configuration script..." sh "${cwd}/desktop_config/${desktop}.sh" - + # Apply final setup log "Applying final system setup..." final_setup + + # POST-PACKAGE HOOKS: Apply splash screen configuration AFTER everything else + log "=== POST-PACKAGE HOOKS: Applying splash screen configuration ===" + + # Source splash screen configuration + log "Loading splash screen configuration (post-package)..." + . "${cwd}/common_config/splash-setup.sh" + + # Apply splash setup AFTER all packages and configs are done + log "Configuring splash screen system (post-package)..." + setup_interactive_splash + + log "Creating splash scripts (post-package)..." + create_extended_boot_script + create_interactive_boot_script + create_console_logo_script + create_boot_monitor_service + + # Verify scripts were created and not overwritten + log "Verifying splash scripts exist after package installation..." + if [ -f "${release}/usr/local/bin/ghostbsd-extended-boot" ]; then + log "SUCCESS: ghostbsd-extended-boot script exists" + else + log "WARNING: ghostbsd-extended-boot script missing" + fi - log "Desktop configuration completed" + if [ -f "${release}/usr/local/bin/ghostbsd-interactive-boot" ]; then + log "SUCCESS: ghostbsd-interactive-boot script exists" + else + log "WARNING: ghostbsd-interactive-boot script missing" + fi + + if [ -f "${release}/usr/local/bin/ghostbsd-ascii-logo" ]; then + log "SUCCESS: ghostbsd-ascii-logo script exists" + else + log "WARNING: ghostbsd-ascii-logo script missing" + fi + + if [ -f "${release}/usr/local/etc/rc.d/ghostbsd_boot_monitor" ]; then + log "SUCCESS: ghostbsd_boot_monitor service exists" + else + log "WARNING: ghostbsd_boot_monitor service missing" + fi + + log "Desktop configuration with post-package splash hooks completed" } # Enhanced uzip function with zstd compression uzip() { log "=== Creating zstd compressed system image ===" - + install -o root -g wheel -m 755 -d "${cd_root}" mkdir "${cd_root}/data" - + # Pre-send analysis log "Analyzing system before image creation..." - + # Check available space for system.img cd_data_avail=$(df "${cd_root}/data" | tail -1 | awk '{print $4}') cd_data_avail_gb=$((cd_data_avail / 1024 / 1024)) log "Available space for system.img: ${cd_data_avail_gb}GB" - + if [ $cd_data_avail_gb -lt 8 ]; then error_exit "Insufficient space for system.img. Need at least 8GB, have ${cd_data_avail_gb}GB" fi - + # Analyze ZFS pool status log "ZFS pool analysis:" zpool list ghostbsd zfs list ghostbsd - + # Check for any pool issues if ! zpool status ghostbsd | grep -q "state: ONLINE"; then error_exit "ZFS pool 'ghostbsd' is not in ONLINE state" fi - + # Force synchronization before snapshot log "Synchronizing pool before snapshot..." sync zpool sync ghostbsd sleep 3 - + # Create snapshot with verification log "Creating clean snapshot..." if ! zfs snapshot ghostbsd@clean; then error_exit "Failed to create snapshot ghostbsd@clean" fi - + # Verify snapshot exists if ! zfs list -t snapshot ghostbsd@clean >/dev/null 2>&1; then error_exit "Snapshot ghostbsd@clean was not created properly" fi - + # Estimate send size if possible log "Estimating send size..." if command -v zstreamdump >/dev/null 2>&1; then @@ -718,7 +795,7 @@ uzip() log "Estimated uncompressed send size: ${estimated_mb}MB" fi fi - + # Start background monitoring - zstd only log "Starting background monitoring..." ( @@ -734,12 +811,12 @@ uzip() current_size=$(stat -f %z "${cd_root}/data/system.img" 2>/dev/null || echo 0) current_file="system.img" fi - + if [ "$current_size" -gt 0 ]; then current_mb=$((current_size / 1024 / 1024)) log "${current_file} current size: ${current_mb}MB" fi - + # Check if zfs send or zstd process is still running if ! pgrep -f "zfs send\|zstd" >/dev/null 2>&1; then break @@ -747,12 +824,12 @@ uzip() done ) & MONITOR_PID=$! - + # Enhanced ZFS send with zstd compression log "Creating zstd compressed system image..." send_success=false compression_used="none" - + # Use zstd compression (confirmed working) if command -v zstd >/dev/null 2>&1; then log "Using zstd -9 compression..." @@ -767,7 +844,7 @@ uzip() else log "ERROR: zstd not available for compression" fi - + # Fallback: uncompressed only if [ "$send_success" != "true" ]; then log "Zstd failed, trying uncompressed fallback..." @@ -781,47 +858,47 @@ uzip() send_success=false fi fi - + # Stop monitoring kill $MONITOR_PID 2>/dev/null || true - + # Verify the created image and report compression results if [ "$send_success" = "true" ] && [ "$compression_used" = "zstd" ] && [ -f "${cd_root}/data/system.img.zst" ]; then # Zstd compressed image exists img_size=$(stat -f %z "${cd_root}/data/system.img.zst") img_size_mb=$((img_size / 1024 / 1024)) log "Final system.img.zst size: ${img_size_mb}MB (zstd compressed)" - + # Create compression metadata file echo "zstd" > "${cd_root}/data/compression.txt" - + # Calculate compression ratio if we have the estimated size if [ "$estimated_size" != "unknown" ] && [ -n "$estimated_mb" ]; then compression_ratio=$((100 - (img_size_mb * 100 / estimated_mb))) log "Compression ratio: ${compression_ratio}% reduction (${estimated_mb}MB -> ${img_size_mb}MB)" fi - + # Comprehensive validation if [ $img_size_mb -lt 100 ]; then error_exit "system.img.zst appears truncated (${img_size_mb}MB is too small)" fi - + log "Zstd compressed system image creation completed successfully: ${img_size_mb}MB" - + elif [ "$send_success" = "true" ] && [ "$compression_used" = "none" ] && [ -f "${cd_root}/data/system.img" ]; then # Uncompressed image exists img_size=$(stat -f %z "${cd_root}/data/system.img") img_size_mb=$((img_size / 1024 / 1024)) log "Final system.img size: ${img_size_mb}MB (uncompressed)" - + # Create compression metadata file echo "none" > "${cd_root}/data/compression.txt" - + # Comprehensive validation if [ $img_size_mb -lt 100 ]; then error_exit "system.img appears truncated (${img_size_mb}MB is too small)" fi - + log "Uncompressed system image creation completed successfully: ${img_size_mb}MB" else error_exit "System image creation failed" @@ -846,7 +923,7 @@ ramdisk() makefs -b '10%' "${cd_root}/data/ramdisk.ufs" "${ramdisk_root}" gzip "${cd_root}/data/ramdisk.ufs" rm -rf "${ramdisk_root}" - + log "Ramdisk creation completed" } @@ -864,7 +941,7 @@ boot() # Try to unmount dev and release if mounted umount ${release}/dev >/dev/null 2>/dev/null || true umount ${release} >/dev/null 2>/dev/null || true - + # Export ZFS pool and ensure it's clean log "Exporting ZFS pool..." zpool export ghostbsd @@ -877,7 +954,7 @@ boot() break fi done - + log "Boot environment preparation completed" } @@ -887,16 +964,16 @@ image() cd script sh mkisoimages.sh -b $label "$iso_path" ${cd_root} cd - - + # Verify ISO was created if [ ! -f "$iso_path" ]; then error_exit "ISO image was not created" fi - + iso_size=$(stat -f %z "$iso_path") iso_size_mb=$((iso_size / 1024 / 1024)) log "Created ISO: $(basename "$iso_path") (${iso_size_mb}MB)" - + ls -lh "$iso_path" cd ${iso} shafile=$(echo "${iso_path}" | cut -d / -f6).sha256 @@ -910,15 +987,22 @@ image() transmission-create -o "${iso}/${torrent}" -t ${tracker1} -t ${tracker2} -t ${tracker3} "${iso_path}" chmod 644 "${iso}/${torrent}" cd - - + log "=== Build completed successfully ===" log "ISO: $iso_path (${iso_size_mb}MB)" log "SHA256: ${iso}/${shafile}" log "Torrent: ${iso}/${torrent}" + log "" + log "=== Interactive Splash Screen Features ===" + log "• Boot loader splash with ESC toggle support" + log "• Console splash during system initialization" + log "• Animated service loading screen" + log "• ESC key reveals bootstrap messages anytime" + log "• Clean transition to desktop environment" } # Execute build pipeline with enhanced integration -log "=== Starting GhostBSD build process ===" +log "=== Starting GhostBSD build process with Interactive Splash Screen ===" log "Desktop: ${desktop}, Build type: ${build_type}, ZFS control: ${zfs_control}" workspace @@ -927,7 +1011,7 @@ set_ghostbsd_version packages_software fetch_x_drivers_packages rc -desktop_config +desktop_config # This now includes splash setup ghostbsd_config uzip ramdisk diff --git a/common_config/autologin.sh b/common_config/autologin.sh index 5c37dfca..df977762 100644 --- a/common_config/autologin.sh +++ b/common_config/autologin.sh @@ -90,3 +90,162 @@ EOF chown 1100:wheel "${release}/Users/${live_user}/.zshrc" fi } + +# FIXED FUNCTIONS FOR INTERACTIVE SPLASH SCREEN WITH TTY-SAFE EXTENDED BOOT + +community_setup_autologin_interactive() +{ + { + echo "# ${live_user} user autologin" + echo "${live_user}:\\" + echo ":al=${live_user}:ht:np:sp#115200:" + } >> "${release}/etc/gettytab" + sed -i "" "/ttyv0/s/Pc/${live_user}/g" "${release}/etc/ttys" + + mkdir -p "${release}/home/${live_user}/.config/fish" + + cat > "${release}/home/${live_user}/.config/fish/config.fish" << 'EOF' +if not test -f /tmp/.xstarted + touch /tmp/.xstarted + set tty (tty) + if test $tty = "/dev/ttyv0" + # Start extended boot splash screen (direct call, no backgrounding) + if test -f /usr/local/bin/ghostbsd-extended-boot + /usr/local/bin/ghostbsd-extended-boot + end + + echo "Configuring display drivers..." + if test -f /usr/local/bin/xconfig + if test -f /tmp/.verbose_boot + sudo xconfig auto + else + sudo xconfig auto >/dev/null 2>&1 + end + sleep 1 + echo "X configuration completed" + sleep 1 + sudo rm -rf /xdrivers >/dev/null 2>&1 + sleep 1 + end + + echo "Starting desktop environment..." + if test -f /tmp/.verbose_boot + startx + else + startx >/dev/null 2>&1 + end + end +end +EOF + chmod 765 "${release}/home/${live_user}/.config/fish/config.fish" +} + +community_setup_autologin_interactive_gershwin() +{ + { + echo "# ${live_user} user autologin" + echo "${live_user}:\\" + echo ":al=${live_user}:ht:np:sp#115200:" + } >> "${release}/etc/gettytab" + + sed -i "" "/ttyv0/s/Pc/${live_user}/g" "${release}/etc/ttys" + + if [ -f "${release}/usr/local/bin/xconfig" ] ; then + cat > "${release}/Users/${live_user}/.zshrc" << 'EOF' +if [ ! -f /tmp/.xstarted ]; then + touch /tmp/.xstarted + + # Check if extended boot script exists and run it directly (no backgrounding) + if [ -f /usr/local/bin/ghostbsd-extended-boot ]; then + /usr/local/bin/ghostbsd-extended-boot + else + echo "GhostBSD Live System Loading..." + sleep 2 + fi + + echo "Configuring display drivers..." + if [ -f /tmp/.verbose_boot ]; then + sudo xconfig auto + else + sudo xconfig auto >/dev/null 2>&1 + fi + sleep 1 + echo "X configuration completed" + sleep 1 + sudo rm -rf /xdrivers >/dev/null 2>&1 + sleep 1 + + echo "Starting desktop environment..." + if [ -f /tmp/.verbose_boot ]; then + startx + else + startx >/dev/null 2>&1 + fi +fi +EOF + + chmod 765 "${release}/Users/${live_user}/.zshrc" + chown 1100:wheel "${release}/Users/${live_user}/.zshrc" + fi +} + +# Interactive autologin with extended boot splash for GhostBSD edition - FIXED +ghostbsd_setup_autologin_interactive() +{ + { + echo "# ${live_user} user autologin" + echo "${live_user}:\\" + echo ":al=${live_user}:ht:np:sp#115200:" + } >> "${release}/etc/gettytab" + sed -i "" "/ttyv0/s/Pc/${live_user}/g" "${release}/etc/ttys" + + mkdir -p "${release}/home/${live_user}/.config/fish" + printf "set tty (tty) + if test \$tty = \"/dev/ttyv0\" + # Start extended boot splash screen (direct call, no backgrounding) + if test -f /usr/local/bin/ghostbsd-extended-boot + /usr/local/bin/ghostbsd-extended-boot + end + + echo \"Configuring display drivers...\" + if test -f /tmp/.verbose_boot + sudo xconfig auto + else + sudo xconfig auto >/dev/null 2>&1 + end + sleep 1 + sudo rm -rf /xdrivers >/dev/null 2>&1 + sleep 1 + + echo \"Starting desktop environment...\" + if test -f /tmp/.verbose_boot + startx + else + startx >/dev/null 2>&1 + end + sleep 1 + if test -f /tmp/.verbose_boot + startx + else + startx >/dev/null 2>&1 + end + end +" > "${release}/home/${live_user}/.config/fish/config.fish" + chmod 765 "${release}/home/${live_user}/.config/fish/config.fish" + + # setup root with extended boot splash support - FIXED + mkdir -p "${release}/root/.config/fish" + printf "set tty (tty) + if test \$tty = \"/dev/ttyv0\" + if test -f /tmp/.verbose_boot + exec startx + else + if test -f /usr/local/bin/ghostbsd-ascii-logo + /usr/local/bin/ghostbsd-ascii-logo + end + exec startx >/dev/null 2>&1 + end + end +" > "${release}/root/.config/fish/config.fish" + chmod 765 "${release}/root/.config/fish/config.fish" +} diff --git a/common_config/finalize.sh b/common_config/finalize.sh index 1511c402..5f4e9f7a 100755 --- a/common_config/finalize.sh +++ b/common_config/finalize.sh @@ -13,8 +13,70 @@ set_sudoers() sed -i "" -e 's/# %sudo/%sudo/g' "${release}/usr/local/etc/sudoers" } +# NEW FUNCTION FOR QUIET BOOT SETUP +setup_quiet_boot() +{ + # Suppress kernel messages during early boot + echo 'kern.msgbuf_show_timestamp=0' >> "${release}/etc/sysctl.conf" + echo 'kern.log_console_output=0' >> "${release}/etc/sysctl.conf" + + # Add quiet boot options to loader.conf if not already present + if ! grep -q "boot_verbose" "${release}/boot/loader.conf" 2>/dev/null; then + cat >> "${release}/boot/loader.conf" << 'EOF' + +# Quiet boot options +boot_verbose="NO" +autoboot_delay="3" +EOF + fi +} + +# NEW FUNCTION FOR LOADER SPLASH CONFIGURATION +setup_loader_splash() +{ + # Loader splash disabled - "ghostbsd" is not a valid compiled brand + # The boot/loader.conf template already has the necessary configuration + : # no-op +} + +# NEW FUNCTION FOR BOOT MENU CUSTOMIZATION +setup_boot_menu() +{ + # Create custom boot menu configuration + cat > "${release}/boot/menu.rc" << 'EOF' +\ Boot Menu for GhostBSD Live System +\ ESC to interrupt autoboot, or any other key to boot immediately. + +only forth definitions also support-functions + +: init-menu + ." Loading GhostBSD..." cr + ." Press ESC for boot options, or any key to continue..." cr +; + +: (boot-menu) + init-menu + 500 ms + key? if + drop exit + then + autoboot +; + +: boot-menu + (boot-menu) +; +EOF + + # Make it executable + chmod 644 "${release}/boot/menu.rc" +} + final_setup() { default_ghostbsd_rc_conf set_sudoers + setup_quiet_boot + setup_loader_splash + setup_boot_menu } diff --git a/common_config/gitpkg.sh b/common_config/gitpkg.sh index b3783b37..2750e68b 100755 --- a/common_config/gitpkg.sh +++ b/common_config/gitpkg.sh @@ -2,39 +2,126 @@ set -e -u +# -------- Logging (color-ready, default OFF) -------- +# Toggle: 0 = plain (default), 1 = color on +# Honors NO_COLOR (https://no-color.org) and FORCE_COLOR. +: "${LOG_COLOR:=0}" +[ -n "${NO_COLOR:-}" ] && LOG_COLOR=0 +[ -n "${FORCE_COLOR:-}" ] && LOG_COLOR=1 + +# ANSI color codes +RED="\033[31m"; GREEN="\033[32m"; YELLOW="\033[33m"; BLUE="\033[34m"; CYAN="\033[36m"; RESET="\033[0m" + log() { - echo "$(date '+%H:%M:%S') [GITPKG] $*" + # plain if disabled or not a TTY + if [ "$LOG_COLOR" -ne 1 ] || [ ! -t 1 ]; then + echo "$*" + return + fi + + _c="$CYAN" + case "$1" in + ERROR:*|Error:*|error:*) _c="$RED" ;; + WARNING:*|Warning:*|warn:*) _c="$YELLOW" ;; + SUCCESS:*|Success:*) _c="$GREEN" ;; + INFO:*|Info:*) _c="$BLUE" ;; + esac + + # shellcheck disable=SC2059 + printf "%b\n" "${_c}$*${RESET}" +} + +# Helper function to check network connectivity +check_network() { + log "INFO: Checking network connectivity to GitHub..." + if ping -c 1 -t 5 github.com >/dev/null 2>&1; then + log "SUCCESS: Network connectivity confirmed" + return 0 + else + log "WARNING: Cannot reach github.com" + return 1 + fi +} + +# Helper function for git clone with timeout +git_clone_with_timeout() { + local repo_url="$1" + local dest_path="$2" + local timeout="${3:-60}" # default 60 seconds + local branch="${4:-}" + + local git_cmd="git clone" + [ -n "$branch" ] && git_cmd="$git_cmd -b $branch" + git_cmd="$git_cmd $repo_url $dest_path" + + log "INFO: Cloning with ${timeout}s timeout..." + + # Run git clone with timeout + if timeout "$timeout" sh -c "$git_cmd" 2>&1 | while IFS= read -r line; do + # Show progress for verbose output + case "$line" in + *"Cloning into"*|*"remote: Counting"*|*"Receiving objects"*) + echo " $line" + ;; + *"error"*|*"fatal"*|*"Error"*|*"Fatal"*) + log "ERROR: $line" + ;; + esac + done; then + return 0 + else + local exit_code=$? + if [ $exit_code -eq 124 ]; then + log "ERROR: Git clone timed out after ${timeout}s" + else + log "ERROR: Git clone failed with exit code $exit_code" + fi + return 1 + fi } # Enhanced pc-sysinstall installation with proper git clone git_pc_sysinstall() { if [ ! -d "${release}/pc-sysinstall" ]; then - log "Downloading pc-sysinstall from GitHub" - + log "INFO: Downloading pc-sysinstall from GitHub" + # Check if git is available if ! command -v git >/dev/null 2>&1; then log "ERROR: git not found, cannot clone pc-sysinstall" - log "Installing git..." + log "INFO: Installing git..." pkg install -y git || { log "ERROR: Failed to install git, skipping pc-sysinstall" return 0 } fi - - # Try git clone with fallback to local copy - if git clone -b master https://github.com/ghostbsd/pc-sysinstall.git "${release}/pc-sysinstall" >/dev/null 2>&1; then - log "Successfully cloned pc-sysinstall from GitHub" - elif [ -d "/usr/home/ericbsd/projects/ghostbsd/pc-sysinstall" ]; then - log "Git clone failed, using local copy" - cp -R /usr/home/ericbsd/projects/ghostbsd/pc-sysinstall "${release}/pc-sysinstall" + + # Check network connectivity + if ! check_network; then + log "WARNING: No network connectivity, checking for local copy" + if [ -d "/usr/home/ericbsd/projects/ghostbsd/pc-sysinstall" ]; then + log "INFO: Using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/pc-sysinstall "${release}/pc-sysinstall" + else + log "WARNING: Cannot find local copy, skipping pc-sysinstall" + return 0 + fi else - log "WARNING: Cannot clone or find pc-sysinstall, skipping" - return 0 + # Try git clone with timeout and fallback to local copy + if git_clone_with_timeout "https://github.com/ghostbsd/pc-sysinstall.git" \ + "${release}/pc-sysinstall" 60 "master"; then + log "SUCCESS: Successfully cloned pc-sysinstall from GitHub" + elif [ -d "/usr/home/ericbsd/projects/ghostbsd/pc-sysinstall" ]; then + log "WARNING: Git clone failed, using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/pc-sysinstall "${release}/pc-sysinstall" + else + log "WARNING: Cannot clone or find pc-sysinstall, skipping" + return 0 + fi fi fi - log "Installing pc-sysinstall" + log "INFO: Installing pc-sysinstall" cat > "${release}/config.sh" << 'EOF' #!/bin/sh set -e -u @@ -44,11 +131,11 @@ sh install.sh >/dev/null 2>&1 EOF if chroot "${release}" sh /config.sh; then - log "pc-sysinstall installed successfully" + log "SUCCESS: pc-sysinstall installed successfully" else log "WARNING: pc-sysinstall installation failed, continuing anyway" fi - + rm -f "${release}/config.sh" rm -rf "${release}/pc-sysinstall" } @@ -56,27 +143,40 @@ EOF git_gbi() { if [ ! -d "${release}/gbi" ]; then - log "Downloading gbi from GitHub" - + log "INFO: Downloading gbi from GitHub" + # Check if git is available if ! command -v git >/dev/null 2>&1; then log "WARNING: git not found, skipping gbi" return 0 fi - - # Try git clone with fallback to local copy - if git clone -b main https://github.com/GhostBSD/gbi.git "${release}/gbi" >/dev/null 2>&1; then - log "Successfully cloned gbi from GitHub" - elif [ -d "/usr/home/ericbsd/projects/ghostbsd/gbi" ]; then - log "Git clone failed, using local copy" - cp -R /usr/home/ericbsd/projects/ghostbsd/gbi "${release}/gbi" + + # Check network connectivity + if ! check_network; then + log "WARNING: No network connectivity, checking for local copy" + if [ -d "/usr/home/ericbsd/projects/ghostbsd/gbi" ]; then + log "INFO: Using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/gbi "${release}/gbi" + else + log "WARNING: Cannot find local copy, skipping gbi" + return 0 + fi else - log "WARNING: Cannot clone or find gbi, skipping" - return 0 + # Try git clone with timeout and fallback to local copy + if git_clone_with_timeout "https://github.com/ghostbsd/gbi.git" \ + "${release}/gbi" 60; then + log "SUCCESS: Successfully cloned gbi from GitHub" + elif [ -d "/usr/home/ericbsd/projects/ghostbsd/gbi" ]; then + log "WARNING: Git clone failed, using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/gbi "${release}/gbi" + else + log "WARNING: Cannot clone or find gbi, skipping" + return 0 + fi fi fi - log "Installing gbi" + log "INFO: Installing gbi" cat > "${release}/config.sh" << 'EOF' #!/bin/sh set -e -u @@ -86,39 +186,52 @@ python3 setup.py install >/dev/null 2>&1 EOF if chroot "${release}" sh /config.sh; then - log "gbi installed successfully" + log "SUCCESS: gbi installed successfully" else log "WARNING: gbi installation failed, continuing anyway" fi - + rm -f "${release}/config.sh" rm -rf "${release}/gbi" } git_install_station() -{ + { if [ ! -d "${release}/install-station" ]; then - log "Downloading install-station from GitHub" - + log "INFO: Downloading install-station from GitHub" + # Check if git is available if ! command -v git >/dev/null 2>&1; then log "WARNING: git not found, skipping install-station" return 0 fi - - # Try git clone with fallback to local copy - if git clone https://github.com/GhostBSD/install-station.git "${release}/install-station" >/dev/null 2>&1; then - log "Successfully cloned install-station from GitHub" - elif [ -d "/usr/home/ericbsd/projects/ghostbsd/install-station" ]; then - log "Git clone failed, using local copy" - cp -R /usr/home/ericbsd/projects/ghostbsd/install-station "${release}/install-station" + + # Check network connectivity + if ! check_network; then + log "WARNING: No network connectivity, checking for local copy" + if [ -d "/usr/home/ericbsd/projects/ghostbsd/install-station" ]; then + log "INFO: Using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/install-station "${release}/install-station" + else + log "WARNING: Cannot find local copy, skipping install-station" + return 0 + fi else - log "WARNING: Cannot clone or find install-station, skipping" - return 0 + # Try git clone with timeout and fallback to local copy + if git_clone_with_timeout "https://github.com/GhostBSD/install-station.git" \ + "${release}/install-station" 60; then + log "SUCCESS: Successfully cloned install-station from GitHub" + elif [ -d "/usr/home/ericbsd/projects/ghostbsd/install-station" ]; then + log "WARNING: Git clone failed, using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/install-station "${release}/install-station" + else + log "WARNING: Cannot clone or find install-station, skipping" + return 0 + fi fi fi - log "Installing install-station" + log "INFO: Installing install-station" cat > "${release}/config.sh" << 'EOF' #!/bin/sh set -e -u @@ -128,11 +241,11 @@ python3 setup.py install >/dev/null 2>&1 EOF if chroot "${release}" sh /config.sh; then - log "install-station installed successfully" + log "SUCCESS: install-station installed successfully" else log "WARNING: install-station installation failed, continuing anyway" fi - + rm -f "${release}/config.sh" rm -rf "${release}/install-station" } @@ -140,27 +253,40 @@ EOF git_setup_station() { if [ ! -d "${release}/setup-station" ]; then - log "Downloading setup-station from GitHub" - + log "INFO: Downloading setup-station from GitHub" + # Check if git is available if ! command -v git >/dev/null 2>&1; then log "WARNING: git not found, skipping setup-station" return 0 fi - - # Try git clone with fallback to local copy - if git clone https://github.com/GhostBSD/setup-station.git "${release}/setup-station" >/dev/null 2>&1; then - log "Successfully cloned setup-station from GitHub" - elif [ -d "/usr/home/ericbsd/projects/ghostbsd/setup-station" ]; then - log "Git clone failed, using local copy" - cp -R /usr/home/ericbsd/projects/ghostbsd/setup-station "${release}/setup-station" + + # Check network connectivity + if ! check_network; then + log "WARNING: No network connectivity, checking for local copy" + if [ -d "/usr/home/ericbsd/projects/ghostbsd/setup-station" ]; then + log "INFO: Using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/setup-station "${release}/setup-station" + else + log "WARNING: Cannot find local copy, skipping setup-station" + return 0 + fi else - log "WARNING: Cannot clone or find setup-station, skipping" - return 0 + # Try git clone with timeout and fallback to local copy + if git_clone_with_timeout "https://github.com/GhostBSD/setup-station.git" \ + "${release}/setup-station" 60; then + log "SUCCESS: Successfully cloned setup-station from GitHub" + elif [ -d "/usr/home/ericbsd/projects/ghostbsd/setup-station" ]; then + log "WARNING: Git clone failed, using local copy" + cp -R /usr/home/ericbsd/projects/ghostbsd/setup-station "${release}/setup-station" + else + log "WARNING: Cannot clone or find setup-station, skipping" + return 0 + fi fi fi - log "Installing setup-station" + log "INFO: Installing setup-station" cat > "${release}/config.sh" << 'EOF' #!/bin/sh set -e -u @@ -170,11 +296,11 @@ python3 setup.py install >/dev/null 2>&1 EOF if chroot "${release}" sh /config.sh; then - log "setup-station installed successfully" + log "SUCCESS: setup-station installed successfully" else log "WARNING: setup-station installation failed, continuing anyway" fi - + rm -f "${release}/config.sh" rm -rf "${release}/setup-station" } diff --git a/common_config/setuser.sh b/common_config/setuser.sh index 74bb3b00..6caf2ca8 100755 --- a/common_config/setuser.sh +++ b/common_config/setuser.sh @@ -66,4 +66,120 @@ community_setup_liveuser_gershwin() set_user_gershwin chroot "${release}" su - "${live_user}" -c "xdg-user-dirs-update" chroot "${release}" su - "${live_user}" -c "ln -sf /System/Applications/Installer.app \"/Users/${live_user}/Desktop/Installer.app\"" -} \ No newline at end of file +} + +# NEW FUNCTIONS FOR INTERACTIVE SPLASH SCREEN SUPPORT + +ghostbsd_setup_liveuser_interactive() +{ + # Set up user first + set_user + + # Configure GTK settings + chroot "${release}" su "${live_user}" -c "mkdir -p /home/${live_user}/.config/gtk-3.0" + chroot "${release}" su "${live_user}" -c "echo '[Settings]' >> /home/${live_user}/.config/gtk-3.0/settings.ini" + chroot "${release}" su "${live_user}" -c "echo 'gtk-application-prefer-dark-theme = false' >> /home/${live_user}/.config/gtk-3.0/settings.ini" + chroot "${release}" su "${live_user}" -c "echo 'gtk-theme-name = Vimix' >> /home/${live_user}/.config/gtk-3.0/settings.ini" + chroot "${release}" su "${live_user}" -c "echo 'gtk-icon-theme-name = Vivacious-Colors-Dark' >> /home/${live_user}/.config/gtk-3.0/settings.ini" + chroot "${release}" su "${live_user}" -c "echo 'gtk-font-name = Droid Sans Bold 12' >> /home/${live_user}/.config/gtk-3.0/settings.ini" + + # Configure root GTK settings + mkdir -p "${release}/root/.config/gtk-3.0" + { + echo '[Settings]' + echo 'gtk-application-prefer-dark-theme = false' + echo 'gtk-theme-name = Vimix' + echo 'gtk-icon-theme-name = Vivacious-Colors-Dark' + echo 'gtk-font-name = Droid Sans Bold 12' + } > "${release}/root/.config/gtk-3.0/settings.ini" + + # Create splash screen configuration directory for user + chroot "${release}" su "${live_user}" -c "mkdir -p /home/${live_user}/.config/ghostbsd" + chroot "${release}" su "${live_user}" -c "echo 'splash_enabled=yes' > /home/${live_user}/.config/ghostbsd/boot.conf" + chroot "${release}" su "${live_user}" -c "echo 'esc_to_verbose=yes' >> /home/${live_user}/.config/ghostbsd/boot.conf" +} + +community_setup_liveuser_interactive() +{ + # Set up user first + set_user + + # Create desktop directory + chroot "${release}" su "${live_user}" -c "mkdir -p /home/${live_user}/Desktop" + + # Set up GBI installer desktop shortcut + if [ -e "${release}/usr/local/share/applications/gbi.desktop" ] ; then + chroot "${release}" su "${live_user}" -c "cp -af /usr/local/share/applications/gbi.desktop /home/${live_user}/Desktop" + chroot "${release}" su "${live_user}" -c "chmod +x /home/${live_user}/Desktop/gbi.desktop" + sed -i '' -e 's/NoDisplay=true/NoDisplay=false/g' "${release}/home/${live_user}/Desktop/gbi.desktop" + # Trust desktop file for XFCE 4.18+ using checksum metadata + if [ "${desktop}" = "xfce" ] ; then + chroot "${release}" su - "${live_user}" -c ' + dbus-run-session -- sh -c " + /usr/local/libexec/gvfsd >/dev/null 2>&1 & + /usr/local/libexec/gvfsd-metadata >/dev/null 2>&1 & + sleep 1 + f=\$HOME/Desktop/gbi.desktop + sum=\$(sha256 -q \"\$f\") + gio set -t string \"\$f\" metadata::xfce-exe-checksum \"\$sum\" + " + ' + fi + fi + + # Create splash screen configuration directory for user + chroot "${release}" su "${live_user}" -c "mkdir -p /home/${live_user}/.config/ghostbsd" + chroot "${release}" su "${live_user}" -c "echo 'splash_enabled=yes' > /home/${live_user}/.config/ghostbsd/boot.conf" + chroot "${release}" su "${live_user}" -c "echo 'esc_to_verbose=yes' >> /home/${live_user}/.config/ghostbsd/boot.conf" + + # Create desktop notification script for splash info + cat > "${release}/home/${live_user}/Desktop/splash-info.txt" << 'EOF' +GhostBSD Interactive Splash Screen + +Features: +- Press ESC during boot to view bootstrap messages +- Boot loader splash screen with 3-second delay +- Console splash during system initialization +- Animated service loading screen +- Clean transition to desktop environment + +The splash screen provides a professional boot experience +while allowing developers and power users to access +detailed system messages when needed. +EOF +chroot "${release}" chown "${live_user}:wheel" "/home/${live_user}/Desktop/splash-info.txt" +} + +community_setup_liveuser_interactive_gershwin() +{ + # Set up user first + set_user_gershwin + + # Update user directories + chroot "${release}" su - "${live_user}" -c "xdg-user-dirs-update" + + # Create installer shortcut + chroot "${release}" su - "${live_user}" -c "ln -sf /System/Applications/Installer.app \"/Users/${live_user}/Desktop/Installer.app\"" + + # Create splash screen configuration directory for user + chroot "${release}" su - "${live_user}" -c "mkdir -p /Users/${live_user}/.config/ghostbsd" + chroot "${release}" su - "${live_user}" -c "echo 'splash_enabled=yes' > /Users/${live_user}/.config/ghostbsd/boot.conf" + chroot "${release}" su - "${live_user}" -c "echo 'esc_to_verbose=yes' >> /Users/${live_user}/.config/ghostbsd/boot.conf" + + # Create desktop notification script for splash info (macOS-style) + cat > "${release}/Users/${live_user}/Desktop/GhostBSD Splash Info.txt" << 'EOF' +GhostBSD Interactive Splash Screen + +Features: +- Press ESC during boot to view bootstrap messages +- Boot loader splash screen with 3-second delay +- Console splash during system initialization +- Animated service loading screen +- Clean transition to desktop environment + +The splash screen provides a professional boot experience +while allowing developers and power users to access +detailed system messages when needed. +EOF + chroot "${release}" chown "1100:wheel" "/Users/${live_user}/Desktop/GhostBSD Splash Info.txt" +} diff --git a/common_config/splash-setup.sh b/common_config/splash-setup.sh new file mode 100644 index 00000000..b21a617d --- /dev/null +++ b/common_config/splash-setup.sh @@ -0,0 +1,252 @@ +#!/bin/sh + +set -e -u + +# Shared logo function to reduce duplication +create_logo_function() { + cat << 'EOF' +show_ghostbsd_logo() { + cat << 'LOGO_EOF' +╔═══════════════════════════════════╗ +║ ║ +║ G h o s t B S D ║ +║ ────────── ║ +║ Live System ║ +║ ║ +╚═══════════════════════════════════╝ +LOGO_EOF +} + +EOF +} + +setup_interactive_splash() +{ + echo "Current working directory: $(pwd)" + echo "cwd variable: ${cwd}" + + # Splash configuration - no bootloader logo modifications + echo "Console splash system configured (init.sh.in handles early boot splash)" +} + +create_extended_boot_script() +{ + echo "Creating extended boot script at ${release}/usr/local/bin/ghostbsd-extended-boot" + + cat > "${release}/usr/local/bin/ghostbsd-extended-boot" << 'EOF' +#!/bin/sh +# Extended boot splash - SIMPLIFIED for late boot phase (post init.sh.in) + +EOF + # Add the logo function to the script + create_logo_function >> "${release}/usr/local/bin/ghostbsd-extended-boot" + + cat >> "${release}/usr/local/bin/ghostbsd-extended-boot" << 'EOF' +# Check if we're in a proper terminal environment +if [ ! -t 0 ] || [ ! -t 1 ]; then + # Not in interactive terminal, skip splash + exit 0 +fi + +# Redirect stderr to avoid boot message conflicts +exec 2>/dev/null + +SPLASH_DURATION=3 + +show_boot_phases() { + _counter=0 + + while [ $_counter -lt $((SPLASH_DURATION * 10)) ]; do + # Update display + if command -v clear >/dev/null 2>&1; then + clear 2>/dev/null || printf "\033[2J\033[H" 2>/dev/null || true + else + printf "\033[2J\033[H" 2>/dev/null || true + fi + printf "\033[?25l" 2>/dev/null || true # Hide cursor + + show_ghostbsd_logo + + echo "" + echo " Finalizing Desktop Setup..." + echo "" + + # Progress indicator + PROGRESS=$(($_counter * 100 / (SPLASH_DURATION * 10))) + if [ $PROGRESS -gt 100 ]; then + PROGRESS=100 + fi + + printf " [" + FILLED=$((PROGRESS / 5)) + p=1 + while [ $p -le 20 ]; do + if [ $p -le $FILLED ]; then + printf "█" + else + printf "░" + fi + p=$((p + 1)) + done + printf "] %d%%\n" $PROGRESS + echo "" + + sleep 0.1 + _counter=$(($_counter + 1)) + done + + # Restore terminal + printf "\033[?25h" 2>/dev/null || true # Show cursor +} + +# Check if verbose boot was requested +if [ -f /tmp/.verbose_boot ]; then + clear 2>/dev/null || true + echo "GhostBSD Bootstrap Messages:" + echo "==================================" + exit 0 +fi + +# Run splash +show_boot_phases + +# Clean exit +clear 2>/dev/null || true + +exit 0 +EOF + + chmod +x "${release}/usr/local/bin/ghostbsd-extended-boot" + echo "Extended boot script created (late-boot phase only)" +} + +create_interactive_boot_script() +{ + echo "Creating interactive boot script at ${release}/usr/local/bin/ghostbsd-interactive-boot" + + cat > "${release}/usr/local/bin/ghostbsd-interactive-boot" << 'EOF' +#!/bin/sh +# Interactive boot screen - SIMPLIFIED for late boot phase + +EOF + # Add the logo function to the script + create_logo_function >> "${release}/usr/local/bin/ghostbsd-interactive-boot" + + cat >> "${release}/usr/local/bin/ghostbsd-interactive-boot" << 'EOF' +# Check if we're in a proper terminal environment +if [ ! -t 0 ] || [ ! -t 1 ]; then + # Not in interactive terminal, skip splash + exit 0 +fi + +# Redirect stderr to avoid boot message conflicts +exec 2>/dev/null + +SPLASH_DURATION=2 + +show_logo_with_message() { + _counter=0 + + while [ $_counter -lt $((SPLASH_DURATION * 10)) ]; do + # Update display + if command -v clear >/dev/null 2>&1; then + clear 2>/dev/null || printf "\033[2J\033[H" 2>/dev/null || true + else + printf "\033[2J\033[H" 2>/dev/null || true + fi + printf "\033[?25l" 2>/dev/null || true # Hide cursor + + show_ghostbsd_logo + + echo "" + echo " Starting Desktop..." + echo "" + + sleep 0.1 + _counter=$(($_counter + 1)) + done + + # Restore terminal + printf "\033[?25h" 2>/dev/null || true # Show cursor +} + +# Check if verbose boot was requested or skip splash flag +if [ -f /tmp/.verbose_boot ] || [ "${1:-}" = "--no-splash" ]; then + clear 2>/dev/null || true + echo "GhostBSD Bootstrap Messages:" + echo "==================================" + exit 0 +fi + +# Run splash +show_logo_with_message + +# Clean exit +clear 2>/dev/null || true + +exit 0 +EOF + + chmod +x "${release}/usr/local/bin/ghostbsd-interactive-boot" + echo "Interactive boot script created (late-boot phase only)" +} + +create_console_logo_script() +{ + echo "Creating console logo script at ${release}/usr/local/bin/ghostbsd-ascii-logo" + + cat > "${release}/usr/local/bin/ghostbsd-ascii-logo" << 'EOF' +#!/bin/sh +# Display GhostBSD ASCII logo - SIMPLIFIED + +EOF + # Add the logo function to the script + create_logo_function >> "${release}/usr/local/bin/ghostbsd-ascii-logo" + + cat >> "${release}/usr/local/bin/ghostbsd-ascii-logo" << 'EOF' +# Check if we're in a proper terminal environment +if [ ! -t 1 ]; then + # Not in interactive terminal, just show simple message + echo "GhostBSD Loading..." + sleep 1 + exit 0 +fi + +# Safe terminal clear +if command -v clear >/dev/null 2>&1; then + clear 2>/dev/null || printf "\033[2J\033[H" 2>/dev/null || true +else + printf "\033[2J\033[H" 2>/dev/null || true +fi + +show_ghostbsd_logo + +echo "" +echo "Starting Desktop..." +echo "Please wait..." + +sleep 2 +printf "\n" +EOF + + chmod +x "${release}/usr/local/bin/ghostbsd-ascii-logo" + echo "Console logo script created (simplified)" +} + +# NOTE: No boot monitor service since init.sh.in handles early boot splash +create_boot_monitor_service() +{ + echo "Skipping boot monitor service - init.sh.in handles early boot splash" + + # Create a minimal service for consistency if needed + cat > "${release}/usr/local/bin/ghostbsd-service-splash" << 'EOF' +#!/bin/sh +# Minimal service splash placeholder - init.sh.in handles the real work + +echo "ghostbsd desktop loading..." +sleep 1 +EOF + + chmod +x "${release}/usr/local/bin/ghostbsd-service-splash" + echo "Created minimal service placeholder" +} diff --git a/desktop_config/gershwin.sh b/desktop_config/gershwin.sh index 295db8a4..7d2dbe62 100644 --- a/desktop_config/gershwin.sh +++ b/desktop_config/gershwin.sh @@ -1,11 +1,12 @@ #!/bin/sh - set -e -u . "${cwd}/common_config/autologin.sh" . "${cwd}/common_config/base-setting.sh" . "${cwd}/common_config/finalize.sh" +. "${cwd}/common_config/gitpkg.sh" . "${cwd}/common_config/setuser.sh" +. "${cwd}/common_config/splash-setup.sh" lightdm_setup() { @@ -20,9 +21,16 @@ setup_xinit() echo "exec /usr/local/bin/gershwin-x11" > "${release}/usr/share/skel/dot.xinitrc" } +# Apply base system patches patch_etc_files -community_setup_liveuser_gershwin -community_setup_autologin_gershwin + +# Set up user and autologin with interactive splash support (using Gershwin functions) +community_setup_liveuser_interactive_gershwin +community_setup_autologin_interactive_gershwin + +# Configure desktop environment lightdm_setup setup_xinit + +# Apply final setup final_setup diff --git a/desktop_config/mate.sh b/desktop_config/mate.sh index 82d12842..7d4e7157 100644 --- a/desktop_config/mate.sh +++ b/desktop_config/mate.sh @@ -5,7 +5,9 @@ set -e -u . "${cwd}/common_config/autologin.sh" . "${cwd}/common_config/base-setting.sh" . "${cwd}/common_config/finalize.sh" +. "${cwd}/common_config/gitpkg.sh" . "${cwd}/common_config/setuser.sh" +. "${cwd}/common_config/splash-setup.sh" lightdm_setup() { @@ -24,9 +26,16 @@ setup_xinit() echo "exec ck-launch-session mate-session" > "${release}/usr/share/skel/dot.xinitrc" } +# Apply base system patches patch_etc_files -community_setup_liveuser -community_setup_autologin + +# Set up user and autologin with interactive splash support +community_setup_liveuser_interactive +community_setup_autologin_interactive + +# Configure desktop environment lightdm_setup setup_xinit + +# Apply final setup final_setup diff --git a/desktop_config/plasma.sh b/desktop_config/plasma.sh index b4429cf4..fa7b7ba3 100644 --- a/desktop_config/plasma.sh +++ b/desktop_config/plasma.sh @@ -6,7 +6,9 @@ set -e -u . "${cwd}/common_config/autologin.sh" . "${cwd}/common_config/base-setting.sh" . "${cwd}/common_config/finalize.sh" +. "${cwd}/common_config/gitpkg.sh" . "${cwd}/common_config/setuser.sh" +. "${cwd}/common_config/splash-setup.sh" sddm_setup() { # Path to SDDM config @@ -55,8 +57,8 @@ setup_xinit() { # Execute setup routines patch_etc_files -community_setup_liveuser -community_setup_autologin +community_setup_liveuser_interactive +community_setup_autologin_interactive sddm_setup setup_xinit final_setup diff --git a/desktop_config/xfce.sh b/desktop_config/xfce.sh index 8603e25d..58de3029 100644 --- a/desktop_config/xfce.sh +++ b/desktop_config/xfce.sh @@ -5,7 +5,9 @@ set -e -u . "${cwd}/common_config/autologin.sh" . "${cwd}/common_config/base-setting.sh" . "${cwd}/common_config/finalize.sh" +. "${cwd}/common_config/gitpkg.sh" . "${cwd}/common_config/setuser.sh" +. "${cwd}/common_config/splash-setup.sh" lightdm_setup() { @@ -20,9 +22,16 @@ setup_xinit() echo "exec ck-launch-session startxfce4" > "${release}/usr/share/skel/dot.xinitrc" } +# Apply base system patches patch_etc_files -community_setup_liveuser -community_setup_autologin + +# Set up user and autologin with interactive splash support +community_setup_liveuser_interactive +community_setup_autologin_interactive + +# Configure desktop environment lightdm_setup setup_xinit + +# Apply final setup final_setup diff --git a/init.sh.in b/init.sh.in index e3f3c5f7..6ecd2d5f 100644 --- a/init.sh.in +++ b/init.sh.in @@ -57,18 +57,196 @@ normalize_used_token() { # Simplified monitor - avoid background processes in rescue environment start_monitor() { - log "DEBUG: Monitor function called (simplified version)" + log "Monitor function called" # Return a dummy PID to avoid hanging echo "999" } -# -------- Logging / errors -------- +# -------- Splash Screen Functions (rescue-safe) -------- + +SPLASH_ENABLED=0 +PROGRESS=0 +SPLASH_PHASE="Starting..." + +# Shared logo function to reduce duplication +show_ghostbsd_logo() { + cat << 'EOF' +╔═══════════════════════════════════╗ +║ ║ +║ G h o s t B S D ║ +║ ────────── ║ +║ Live System ║ +║ ║ +╚═══════════════════════════════════╝ +EOF +} + +# Check if we should show splash (console tty and no verbose mode requested) +# Rescue-safe TTY detection without using 'tty' command +init_splash() { + # Check for verbose boot parameter or file + if [ -f /tmp/.verbose_boot ] || grep -q "verbose" /proc/cmdline 2>/dev/null; then + SPLASH_ENABLED=0 + echo "GhostBSD Bootstrap Messages:" + echo "==================================" + echo "Verbose boot mode enabled" + echo "" + return + fi + + # Check if stdout is a terminal and console device exists + if [ -t 1 ] && [ -c /dev/ttyv0 ] 2>/dev/null; then + SPLASH_ENABLED=1 + clear_screen + show_splash + else + SPLASH_ENABLED=0 + fi +} + +clear_screen() { + if [ $SPLASH_ENABLED -eq 1 ]; then + printf "\033[2J\033[H\033[?25l" + fi +} + +show_splash() { + if [ $SPLASH_ENABLED -eq 0 ]; then + return + fi + + clear_screen + + show_ghostbsd_logo + + echo "" + echo " ${SPLASH_PHASE}" + echo "" + + # Progress bar (rescue-safe, no seq command) + printf " [" + filled=$((PROGRESS / 5)) + i=1 + while [ $i -le 20 ]; do + if [ $i -le $filled ]; then + printf "█" + else + printf "░" + fi + i=$((i + 1)) + done + printf "] %d%%\n" $PROGRESS + echo "" +} + +update_splash() { + _new_phase="$1" + _new_progress="$2" + + SPLASH_PHASE="$_new_phase" + PROGRESS="$_new_progress" + + if [ $SPLASH_ENABLED -eq 1 ]; then + show_splash + fi +} + +finish_splash() { + if [ $SPLASH_ENABLED -eq 1 ]; then + printf "\033[?25h" # Show cursor + clear_screen + fi +} + +# -------- Logging / errors (color-ready, default OFF) with splash integration -------- + +# Toggle: 0 = plain (default), 1 = color on +: "${LOG_COLOR:=0}" + +# ANSI color codes +RED="\033[31m"; GREEN="\033[32m"; YELLOW="\033[33m"; BLUE="\033[34m"; CYAN="\033[36m"; RESET="\033[0m" log() { - echo "$(date '+%H:%M:%S') [INIT] $*" + # Handle splash updates based on log messages + case "$*" in + *"GhostBSD Live System Initialization"*) + init_splash + update_splash "System Analysis..." 2 + ;; + *"System Analysis"*) + update_splash "System Analysis..." 5 + ;; + *"Remount rootfs"*) + update_splash "Mounting filesystems..." 8 + ;; + *"Waiting for GhostBSD media"*) + update_splash "Detecting boot media..." 12 + ;; + *"Found /dev/iso9660/GHOSTBSD"*) + update_splash "Boot media found..." 15 + ;; + *"Mount GhostBSD media"*) + update_splash "Mounting boot media..." 18 + ;; + *"Mount swap-based memdisk"*) + update_splash "Creating memory disk..." 22 + ;; + *"Creating ZFS pool"*) + update_splash "Creating ZFS pool..." 25 + ;; + *"ZFS pool created successfully"*) + update_splash "ZFS pool ready..." 30 + ;; + *"System Image Analysis"*) + update_splash "Analyzing system image..." 35 + ;; + *"compression type"*) + update_splash "Loading system image..." 38 + ;; + *"Starting"*"decompression"*) + update_splash "Decompressing system..." 42 + ;; + *"receive completed successfully"*) + update_splash "System loaded..." 85 + ;; + *"Post-Receive Configuration"*) + update_splash "Configuring system..." 90 + ;; + *"System Load Complete"*) + update_splash "Finalizing setup..." 95 + ;; + *"Initialization completed successfully"*) + update_splash "Boot complete!" 100 + sleep 2 + finish_splash + ;; + esac + + # Original logging functionality - only show if splash disabled + if [ $SPLASH_ENABLED -eq 0 ]; then + # If not a TTY or color disabled, print plain + if [ "$LOG_COLOR" -ne 1 ] || [ ! -t 1 ]; then + echo "$*" + return + fi + + # Choose color by prefix + _c="$CYAN" + case "$1" in + ERROR:*|Error:*|error:*) _c="$RED" ;; + WARNING:*|Warning:*|warn:*) _c="$YELLOW" ;; + SUCCESS:*|Success:*) _c="$GREEN" ;; + INFO:*|Info:*) _c="$BLUE" ;; + esac + # shellcheck disable=SC2059 + printf "%b\n" "${_c} $*${RESET}" + fi } error_exit() { + if [ $SPLASH_ENABLED -eq 1 ]; then + finish_splash + fi log "ERROR: $*" exit 1 } @@ -101,6 +279,7 @@ timeout=60 while [ $timeout -gt 0 ]; do if [ -e "/dev/iso9660/GHOSTBSD" ]; then log "Found /dev/iso9660/GHOSTBSD" + LOG_COLOR=1 # enable color now that we're booting the live ISO sleep 2 break fi @@ -112,7 +291,7 @@ if [ $timeout -eq 0 ]; then error_exit "Timeout waiting for GhostBSD media" fi -log "Mount cdrom" +echo "Mount GhostBSD media" if ! mount_cd9660 /dev/iso9660/@VOLUME@ /cdrom; then error_exit "Failed to mount cdrom" fi @@ -277,74 +456,86 @@ log "=== System Image Loading with Zstd Compression Support ===" receive_success=false receive_method="" -log "DEBUG: Skipping complex monitoring in rescue environment" +log "Skipping complex monitoring in rescue environment" # Simplified monitoring - no background processes MONITOR_PID="999" -log "DEBUG: Using simplified monitor (PID: $MONITOR_PID)" +log "Using simplified monitor (PID: $MONITOR_PID)" -log "DEBUG: Compression type: ${compression_type}" -log "DEBUG: System image path: ${system_img_path}" -log "DEBUG: About to attempt streaming receive" +log "Compression type: ${compression_type}" +log "System image path: ${system_img_path}" +log "About to attempt streaming receive" log "Attempting direct streaming receive with ${compression_type} decompression" case "$compression_type" in "zstd") - log "DEBUG: Starting zstd decompression + ZFS receive (with force flag)" + log "Starting zstd decompression + ZFS receive" + update_splash "Decompressing system..." 45 if zstd -dc "${system_img_path}" 2>/tmp/zstd1.log | zfs recv -F livecd 2>/tmp/zfs_recv1.log; then log "Zstd decompression + receive completed successfully" receive_success=true receive_method="zstd_stream" else log "Zstd streaming failed" - log "DEBUG: zstd/zfs recv pipeline exit code: $?" + log "zstd/zfs recv pipeline exit code: $?" [ -f /tmp/zstd1.log ] && log "Zstd log:" && cat /tmp/zstd1.log [ -f /tmp/zfs_recv1.log ] && log "ZFS recv log:" && cat /tmp/zfs_recv1.log fi ;; "none") - log "DEBUG: Starting direct DD + ZFS receive (with force flag)" + log "Starting direct DD + ZFS receive" + update_splash "Loading system image..." 45 if dd if="${system_img_path}" bs=1m 2>/tmp/dd1.log | zfs recv -F livecd 2>/tmp/zfs_recv1.log; then log "Uncompressed direct streaming receive completed successfully" receive_success=true receive_method="direct_stream" else log "Direct streaming receive failed" - log "DEBUG: dd/zfs recv pipeline exit code: $?" + log "dd/zfs recv pipeline exit code: $?" [ -f /tmp/dd1.log ] && log "DD log:" && cat /tmp/dd1.log [ -f /tmp/zfs_recv1.log ] && log "ZFS recv log:" && cat /tmp/zfs_recv1.log fi ;; esac -log "DEBUG: After first attempt, receive_success=$receive_success" +# Add progress update after first attempt +if [ "$receive_success" = "true" ]; then + update_splash "System image loaded..." 75 +fi + +log "After first attempt, receive_success=$receive_success" # Fallback forced receive if [ "$receive_success" != "true" ]; then log "Direct streaming failed, trying forced receive methods..." + update_splash "Retrying system load..." 50 case "$compression_type" in "zstd") - log "DEBUG: Attempting zstd forced receive" + log "Attempting zstd forced receive" + update_splash "Decompressing system (retry)..." 55 if zstd -dc "${system_img_path}" 2>/tmp/zstd2.log | zfs recv -F livecd 2>/tmp/zfs_recv2.log; then log "Zstd forced receive completed successfully" receive_success=true receive_method="zstd_forced" + update_splash "System image loaded..." 75 else log "Zstd forced receive failed" - log "DEBUG: Forced receive exit code: $?" + log "Forced receive exit code: $?" [ -f /tmp/zstd2.log ] && log "Zstd error log:" && cat /tmp/zstd2.log [ -f /tmp/zfs_recv2.log ] && log "ZFS recv error log:" && cat /tmp/zfs_recv2.log fi ;; "none") - log "DEBUG: Attempting direct forced receive" + log "Attempting direct forced receive" + update_splash "Loading system (retry)..." 55 if dd if="${system_img_path}" bs=64k 2>/tmp/dd2.log | zfs recv -F livecd 2>/tmp/zfs_recv2.log; then log "Uncompressed forced receive completed successfully" receive_success=true receive_method="direct_forced" + update_splash "System image loaded..." 75 else log "Uncompressed forced receive failed" - log "DEBUG: Forced receive exit code: $?" + log "Forced receive exit code: $?" [ -f /tmp/dd2.log ] && log "DD error log:" && cat /tmp/dd2.log [ -f /tmp/zfs_recv2.log ] && log "ZFS recv error log:" && cat /tmp/zfs_recv2.log fi @@ -352,26 +543,30 @@ if [ "$receive_success" != "true" ]; then esac fi -log "DEBUG: After forced attempt, receive_success=$receive_success" +log "After forced attempt, receive_success=$receive_success" # Last resort: decompress to memory first (space-checked) if [ "$receive_success" != "true" ] && [ "$compression_type" = "zstd" ]; then log "All streaming methods failed, attempting zstd decompress-to-memory approach..." + update_splash "Trying alternate method..." 60 tmp_avail_kb=$(df_avail_kb /tmp) tmp_avail_mb=$((tmp_avail_kb / 1024)) - log "DEBUG: Available temp space: ${tmp_avail_mb}MB, need: ~${estimated_decompressed_mb}MB" + log "Available temp space: ${tmp_avail_mb}MB, need: ~${estimated_decompressed_mb}MB" if [ $tmp_avail_mb -gt $((estimated_decompressed_mb + 100)) ]; then log "Decompressing zstd to /tmp/system.img (estimated ${estimated_decompressed_mb}MB)" + update_splash "Decompressing to memory..." 65 if zstd -dc "${system_img_path}" > /tmp/system.img 2>/tmp/zstd_decompress.log; then log "Zstd decompression completed, attempting receive" actual_size=$(file_size_bytes /tmp/system.img) actual_size_mb=$((actual_size / 1024 / 1024)) log "Actual decompressed size: ${actual_size_mb}MB" + update_splash "Loading decompressed image..." 70 if zfs recv -F livecd < /tmp/system.img 2>/tmp/zfs_recv3.log; then log "Zstd decompress-then-receive completed successfully" receive_success=true receive_method="zstd_decompress_then_receive" + update_splash "System image loaded..." 75 else log "Zstd decompress-then-receive failed:" cat /tmp/zfs_recv3.log @@ -386,10 +581,10 @@ if [ "$receive_success" != "true" ] && [ "$compression_type" = "zstd" ]; then fi fi -log "DEBUG: After all attempts, receive_success=$receive_success" +log "After all attempts, receive_success=$receive_success" # Simplified cleanup - no background processes to manage -log "DEBUG: Simplified monitor cleanup (no background processes used)" +log "Simplified monitor cleanup (no background processes used)" # -------- Final result check --------