Update install.func
This commit is contained in:
parent
bf09786550
commit
edac4a2293
@ -907,23 +907,27 @@ EOF
|
|||||||
# Backup original inittab
|
# Backup original inittab
|
||||||
cp /etc/inittab /etc/inittab.bak 2>/dev/null || true
|
cp /etc/inittab /etc/inittab.bak 2>/dev/null || true
|
||||||
|
|
||||||
# First, enable autologin on tty1 (for direct access)
|
# Enable autologin on tty1 (for direct access) - handle various formats
|
||||||
sed -i 's|^1:[0-9]*:respawn:.*/\(a\?getty\).*|1:2345:respawn:/sbin/agetty --autologin root --noclear tty1 38400 linux|' /etc/inittab
|
# Devuan uses format: 1:2345:respawn:/sbin/getty 38400 tty1
|
||||||
|
sed -i 's|^\(1:[0-9]*:respawn:\).*getty.*tty1.*|1:2345:respawn:/sbin/agetty --autologin root --noclear tty1 38400 linux|' /etc/inittab
|
||||||
|
|
||||||
# CRITICAL: Add console entry for LXC - this is what pct console uses!
|
# CRITICAL: Add/replace console entry for LXC - this is what pct console uses!
|
||||||
# Check if there's already a console getty entry
|
# Remove any existing console entries first (commented or not)
|
||||||
if ! grep -qE '^[^#].*respawn.*console' /etc/inittab; then
|
sed -i '/^[^#]*:.*:respawn:.*getty.*console/d' /etc/inittab
|
||||||
# Add new console entry for LXC
|
sed -i '/^# LXC console autologin/d' /etc/inittab
|
||||||
echo "" >>/etc/inittab
|
|
||||||
echo "# LXC console autologin (added by community-scripts)" >>/etc/inittab
|
|
||||||
echo "co:2345:respawn:/sbin/agetty --autologin root --noclear console 115200,38400,9600 linux" >>/etc/inittab
|
|
||||||
else
|
|
||||||
# Enable autologin on existing console entry
|
|
||||||
sed -i 's|^[^#]*:[0-9]*:respawn:.*/\(a\?getty\).*console.*|co:2345:respawn:/sbin/agetty --autologin root --noclear console 115200,38400,9600 linux|' /etc/inittab
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Force a reload of inittab - try multiple methods
|
# Add new console entry for LXC at the end
|
||||||
telinit q &>/dev/null || init q &>/dev/null || kill -1 1 &>/dev/null || true
|
echo "" >>/etc/inittab
|
||||||
|
echo "# LXC console autologin (added by community-scripts)" >>/etc/inittab
|
||||||
|
echo "co:2345:respawn:/sbin/agetty --autologin root --noclear console 115200 linux" >>/etc/inittab
|
||||||
|
|
||||||
|
# Force a reload of inittab and respawn console getty
|
||||||
|
# Kill existing getty on console to force respawn with new settings
|
||||||
|
pkill -9 -f 'getty.*console' &>/dev/null || true
|
||||||
|
pkill -9 -f 'agetty.*console' &>/dev/null || true
|
||||||
|
|
||||||
|
# Reload inittab - try multiple methods
|
||||||
|
telinit q &>/dev/null || init q &>/dev/null || kill -HUP 1 &>/dev/null || true
|
||||||
fi
|
fi
|
||||||
touch /root/.hushlogin
|
touch /root/.hushlogin
|
||||||
;;
|
;;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user