Update install.func

This commit is contained in:
CanbiZ 2025-11-24 11:19:40 +01:00
parent 645b532e17
commit 1f6034a15b

View File

@ -268,19 +268,39 @@ motd_ssh() {
customize() { customize() {
if [[ -z "${PASSWORD:-}" ]]; then if [[ -z "${PASSWORD:-}" ]]; then
msg_info "Configuring autologin for root" msg_info "Configuring autologin for root"
# Enable root account (remove password lock)
passwd -d root >/dev/null 2>&1 || true passwd -d root >/dev/null 2>&1 || true
# Create getty override for container-getty@1.service
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
mkdir -p "$(dirname "$GETTY_OVERRIDE")" mkdir -p "$(dirname "$GETTY_OVERRIDE")"
cat <<EOF >"$GETTY_OVERRIDE" cat <<'EOF' >"$GETTY_OVERRIDE"
[Service] [Service]
ExecStart= ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 linux
EOF EOF
$STD systemctl daemon-reload || true
msg_ok "Customized Container" # Create getty override for console-getty.service
CONSOLE_OVERRIDE="/etc/systemd/system/console-getty.service.d/override.conf"
mkdir -p "$(dirname "$CONSOLE_OVERRIDE")"
cat <<'EOF' >"$CONSOLE_OVERRIDE"
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud console 115200,38400,9600 linux
EOF
# Reload systemd daemon
$STD systemctl daemon-reload
msg_ok "Autologin configured"
fi fi
msg_ok "Customized Container"
echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update
chmod +x /usr/bin/update chmod +x /usr/bin/update
if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then
mkdir -p /root/.ssh mkdir -p /root/.ssh
echo "${SSH_AUTHORIZED_KEY}" >/root/.ssh/authorized_keys echo "${SSH_AUTHORIZED_KEY}" >/root/.ssh/authorized_keys