mirror of
https://github.com/Monadical-SAS/cubbi.git
synced 2025-12-22 21:29:06 +00:00
refactor: move drivers directory into mcontainer package
- Relocate goose driver to mcontainer/drivers/ - Update ConfigManager to dynamically scan for driver YAML files - Add support for mc-driver.yaml instead of mai-driver.yaml - Update Driver model to support init commands and other YAML fields - Auto-discover drivers at runtime instead of hardcoding them - Update documentation to reflect new directory structure
This commit is contained in:
65
mcontainer/drivers/goose/init-status.sh
Normal file
65
mcontainer/drivers/goose/init-status.sh
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
# Script to check and display initialization status
|
||||
|
||||
# Function to display initialization logs
|
||||
show_init_logs() {
|
||||
if [ -f "/init.log" ]; then
|
||||
echo "Displaying initialization logs:"
|
||||
echo "----------------------------------------"
|
||||
cat /init.log
|
||||
echo "----------------------------------------"
|
||||
else
|
||||
echo "No initialization logs found."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to follow logs until initialization completes
|
||||
follow_init_logs() {
|
||||
if [ ! -f "/init.log" ]; then
|
||||
echo "No initialization logs found."
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Initialization is still in progress. Showing logs:"
|
||||
echo "----------------------------------------"
|
||||
tail -f /init.log &
|
||||
tail_pid=$!
|
||||
|
||||
# Check every second if initialization has completed
|
||||
while true; do
|
||||
if [ -f "/init.status" ] && grep -q "INIT_COMPLETE=true" "/init.status"; then
|
||||
kill $tail_pid 2>/dev/null
|
||||
echo "----------------------------------------"
|
||||
echo "Initialization completed."
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
# Check if we're in an interactive shell
|
||||
if [ -t 0 ]; then
|
||||
INTERACTIVE=true
|
||||
else
|
||||
INTERACTIVE=false
|
||||
fi
|
||||
|
||||
# Check initialization status
|
||||
if [ -f "/init.status" ]; then
|
||||
if grep -q "INIT_COMPLETE=true" "/init.status"; then
|
||||
echo "MC initialization has completed."
|
||||
# No longer prompt to show logs when initialization is complete
|
||||
else
|
||||
echo "MC initialization is still in progress."
|
||||
follow_init_logs
|
||||
fi
|
||||
else
|
||||
echo "Cannot determine initialization status."
|
||||
# Ask if user wants to see logs if they exist (only in interactive mode)
|
||||
if [ -f "/init.log" ] && [ "$INTERACTIVE" = true ]; then
|
||||
read -p "Do you want to see initialization logs? (y/n): " show_logs
|
||||
if [[ "$show_logs" =~ ^[Yy] ]]; then
|
||||
show_init_logs
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user