fix: Multi-distro LXC container fixes for autologin and package installation

- Rocky/AlmaLinux 10 (EL10): Version detection for DNF 5 with correct packages (langpacks-en instead of glibc-langpack-en), makecache refresh, fallback to minimal install
- openSUSE: Install ncurses-utils and terminfo-base, set TERM in /etc/profile.d and /etc/environment to fix 'unknown terminal type'
- Gentoo: Fixed template pattern to use underscore (-openrc_) instead of dash, special version handling
- openEuler: Set privileged container (var_unprivileged=0) to workaround PVE setup hook limitation
- Devuan: Enhanced sysvinit autologin with multiple inittab patterns, fallback console entry, telinit reload
- CentOS/all: Updated URLs from raw.githubusercontent.com to git.community-scripts.org
- General: Better error handling and removed duplicate code blocks
This commit is contained in:
MickLesk
2026-01-12 21:34:58 +01:00
parent 021a4c612a
commit b8afdab106
3 changed files with 3406 additions and 3307 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -898,11 +898,34 @@ EOF
;;
sysvinit)
# Devuan/older systems - modify inittab with flexible runlevel matching
# Devuan/older systems - modify inittab for auto-login
# Devuan 5 (daedalus) uses SysVinit with various inittab formats
if [[ -f /etc/inittab ]]; then
# Match various runlevel patterns (23, 2345, 12345, etc.) and both getty/agetty
sed -i 's|^1:[0-9]*:respawn:/sbin/a\?getty.*|1:2345:respawn:/sbin/agetty --autologin root tty1 38400 linux|' /etc/inittab
# Backup original inittab
cp /etc/inittab /etc/inittab.bak 2>/dev/null || true
# Try multiple patterns to catch different inittab formats
# Pattern 1: Standard format "1:2345:respawn:/sbin/getty..."
sed -i -E 's|^1:[0-9]*:respawn:[^ ]*(getty|agetty)[^$]*$|1:2345:respawn:/sbin/agetty --autologin root --noclear tty1 38400 linux|' /etc/inittab
# Pattern 2: With console instead of tty1
sed -i -E 's|^c1:[0-9]*:respawn:[^ ]*(getty|agetty).*console.*$|c1:2345:respawn:/sbin/agetty --autologin root --noclear console 38400 linux|' /etc/inittab
# Pattern 3: Devuan specific "co:2345:respawn:/sbin/getty..."
sed -i -E 's|^co:[0-9]*:respawn:[^ ]*(getty|agetty).*$|co:2345:respawn:/sbin/agetty --autologin root --noclear console 38400 linux|' /etc/inittab
# Pattern 4: LXC console pattern
if ! grep -q 'autologin root' /etc/inittab; then
# If no autologin was set, add a new console entry
if ! grep -qE '^c[o1]:.*autologin' /etc/inittab; then
echo "co:2345:respawn:/sbin/agetty --autologin root --noclear console 38400 linux" >>/etc/inittab
fi
fi
# Force a reload of inittab - try multiple methods
telinit q &>/dev/null || init q &>/dev/null || kill -1 1 &>/dev/null || true
fi
touch /root/.hushlogin
;;
esac