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' ...@@ -23,7 +23,6 @@ NC='\033[0m'
# Progress tracking # Progress tracking
TOTAL_STEPS=9 TOTAL_STEPS=9
CURRENT_STEP=0 CURRENT_STEP=0
PROGRESS_PIPE="/tmp/installer_progress"
log() { log() {
echo "$(date): $1" | tee -a "$INSTALL_LOG" echo "$(date): $1" | tee -a "$INSTALL_LOG"
...@@ -36,36 +35,32 @@ update_progress() { ...@@ -36,36 +35,32 @@ update_progress() {
CURRENT_STEP=$step CURRENT_STEP=$step
local percent=$((step * 100 / TOTAL_STEPS)) local percent=$((step * 100 / TOTAL_STEPS))
# Update progress display # Terminal-based progress bar
if command -v zenity >/dev/null 2>&1; then local width=50
# Use zenity for graphical progress (preferred) local filled=$((percent * width / 100))
echo "# $message" > "$PROGRESS_PIPE" local empty=$((width - filled))
echo "$percent" > "$PROGRESS_PIPE"
elif command -v dialog >/dev/null 2>&1; then # Create progress bar
# Use dialog for text-based progress local bar=""
echo "$percent" | dialog --gauge "$message" 10 70 "$percent" for ((i=0; i<filled; i++)); do bar="${bar}█"; done
fi 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%)" print_status "$message ($percent%)"
} }
start_progress_display() { start_progress_display() {
# Initialize progress display # Terminal progress - no initialization needed
mkfifo "$PROGRESS_PIPE" 2>/dev/null || true echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE}MBetter Installation Progress${NC}"
if command -v zenity >/dev/null 2>&1; then echo -e "${BLUE}========================================${NC}"
# Start zenity progress dialog in background
zenity --progress --title="MBetter Installation" --text="Starting installation..." --percentage=0 --auto-close < "$PROGRESS_PIPE" &
PROGRESS_PID=$!
fi
} }
cleanup_progress() { cleanup_progress() {
# Cleanup progress display # Terminal cleanup - just add newline
if [ -n "$PROGRESS_PID" ]; then echo -e "\n${GREEN}[INFO]${NC} Progress tracking completed"
kill "$PROGRESS_PID" 2>/dev/null || true
fi
rm -f "$PROGRESS_PIPE" 2>/dev/null || true
} }
print_status() { print_status() {
...@@ -746,10 +741,10 @@ main() { ...@@ -746,10 +741,10 @@ main() {
update_progress 9 "Finalizing installation..." update_progress 9 "Finalizing installation..."
run_post_install run_post_install
# Complete # Complete - terminal notification
if command -v zenity >/dev/null 2>&1; then print_header "Installation Complete!"
zenity --info --title="Installation Complete" --text="Installation completed successfully!\nSystem will reboot in 10 seconds." print_status "Installation completed successfully!"
fi print_status "System will reboot in 10 seconds..."
cleanup cleanup
} }
......
...@@ -17,7 +17,7 @@ d-i netcfg/choose_interface select auto ...@@ -17,7 +17,7 @@ d-i netcfg/choose_interface select auto
# d-i netcfg/wireless_key string # d-i netcfg/wireless_key string
# User accounts - predefined (root password set by set_root_password.sh) # 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 d-i passwd/make-user boolean false
# Time configuration - predefined # 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