Fix auto-installer progress function blocking issue

- Replace zenity-based progress with terminal progress bar
- Remove blocking pipe operations that were causing script hangs
- Add visual progress bar with filled/empty blocks
- Remove zenity completion dialog for terminal compatibility
- Clean up unused PROGRESS_PIPE variable
- Progress now works reliably in all terminal environments
parent 22e3891b
......@@ -23,7 +23,6 @@ NC='\033[0m'
# Progress tracking
TOTAL_STEPS=9
CURRENT_STEP=0
PROGRESS_PIPE="/tmp/installer_progress"
log() {
echo "$(date): $1" | tee -a "$INSTALL_LOG"
......@@ -35,37 +34,33 @@ update_progress() {
local message="$2"
CURRENT_STEP=$step
local percent=$((step * 100 / TOTAL_STEPS))
# Update progress display
if command -v zenity >/dev/null 2>&1; then
# Use zenity for graphical progress (preferred)
echo "# $message" > "$PROGRESS_PIPE"
echo "$percent" > "$PROGRESS_PIPE"
elif command -v dialog >/dev/null 2>&1; then
# Use dialog for text-based progress
echo "$percent" | dialog --gauge "$message" 10 70 "$percent"
fi
# Terminal-based progress bar
local width=50
local filled=$((percent * width / 100))
local empty=$((width - filled))
# Create progress bar
local bar=""
for ((i=0; i<filled; i++)); do bar="${bar}█"; done
for ((i=0; i<empty; i++)); do bar="${bar}░"; done
# Clear previous progress and show new one
echo -ne "\r${BLUE}[PROGRESS]${NC} $message\n${BLUE}[${bar}]${NC} ${percent}%"
print_status "$message ($percent%)"
}
start_progress_display() {
# Initialize progress display
mkfifo "$PROGRESS_PIPE" 2>/dev/null || true
if command -v zenity >/dev/null 2>&1; then
# Start zenity progress dialog in background
zenity --progress --title="MBetter Installation" --text="Starting installation..." --percentage=0 --auto-close < "$PROGRESS_PIPE" &
PROGRESS_PID=$!
fi
# Terminal progress - no initialization needed
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}MBetter Installation Progress${NC}"
echo -e "${BLUE}========================================${NC}"
}
cleanup_progress() {
# Cleanup progress display
if [ -n "$PROGRESS_PID" ]; then
kill "$PROGRESS_PID" 2>/dev/null || true
fi
rm -f "$PROGRESS_PIPE" 2>/dev/null || true
# Terminal cleanup - just add newline
echo -e "\n${GREEN}[INFO]${NC} Progress tracking completed"
}
print_status() {
......@@ -746,10 +741,10 @@ main() {
update_progress 9 "Finalizing installation..."
run_post_install
# Complete
if command -v zenity >/dev/null 2>&1; then
zenity --info --title="Installation Complete" --text="Installation completed successfully!\nSystem will reboot in 10 seconds."
fi
# Complete - terminal notification
print_header "Installation Complete!"
print_status "Installation completed successfully!"
print_status "System will reboot in 10 seconds..."
cleanup
}
......
......@@ -17,7 +17,7 @@ d-i netcfg/choose_interface select auto
# d-i netcfg/wireless_key string
# User accounts - predefined (root password set by set_root_password.sh)
d-i passwd/root-password-crypted password $1$GypdvIgJ$dEchrt9uror61HdjEeH19.
d-i passwd/root-password password changeme
d-i passwd/make-user boolean false
# Time configuration - predefined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment