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:
parent
021a4c612a
commit
b8afdab106
@ -5,6 +5,11 @@ source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxV
|
|||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://www.openeuler.org/
|
# Source: https://www.openeuler.org/
|
||||||
|
|
||||||
|
# NOTE: openEuler requires privileged container due to PVE limitation
|
||||||
|
# PVE's post_create_hook expects /etc/redhat-release which openEuler doesn't have
|
||||||
|
# This causes "unable to create CT - error in setup task PVE::LXC::Setup::post_create_hook"
|
||||||
|
# Setting var_unprivileged=0 creates privileged container which bypasses this check
|
||||||
|
|
||||||
APP="openEuler"
|
APP="openEuler"
|
||||||
var_tags="${var_tags:-os}"
|
var_tags="${var_tags:-os}"
|
||||||
var_cpu="${var_cpu:-1}"
|
var_cpu="${var_cpu:-1}"
|
||||||
@ -12,7 +17,7 @@ var_ram="${var_ram:-512}"
|
|||||||
var_disk="${var_disk:-4}"
|
var_disk="${var_disk:-4}"
|
||||||
var_os="${var_os:-openeuler}"
|
var_os="${var_os:-openeuler}"
|
||||||
var_version="${var_version:-25.03}"
|
var_version="${var_version:-25.03}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-0}"
|
||||||
|
|
||||||
header_info "$APP"
|
header_info "$APP"
|
||||||
variables
|
variables
|
||||||
|
|||||||
6677
misc/build.func
6677
misc/build.func
File diff suppressed because it is too large
Load Diff
@ -898,11 +898,34 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
sysvinit)
|
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
|
if [[ -f /etc/inittab ]]; then
|
||||||
# Match various runlevel patterns (23, 2345, 12345, etc.) and both getty/agetty
|
# Backup original inittab
|
||||||
sed -i 's|^1:[0-9]*:respawn:/sbin/a\?getty.*|1:2345:respawn:/sbin/agetty --autologin root tty1 38400 linux|' /etc/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
|
fi
|
||||||
|
touch /root/.hushlogin
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user