Update install.func

This commit is contained in:
CanbiZ 2025-11-24 13:13:13 +01:00
parent 806bb715a9
commit f32ab7876f

View File

@ -239,6 +239,10 @@ motd_ssh() {
fi fi
} }
# ==============================================================================
# SECTION 5: CONTAINER CUSTOMIZATION
# ==============================================================================
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# customize() # customize()
# #
@ -249,33 +253,21 @@ motd_ssh() {
# - Sets proper permissions on SSH directories and key files # - Sets proper permissions on SSH directories and key files
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
customize() { customize() {
if [[ -z "${PASSWORD:-}" ]]; then if [[ "$PASSWORD" == "" ]]; then
msg_info "Configuring autologin for root" msg_info "Customizing Container"
# Enable root account (remove password lock)
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 \$TERM
EOF EOF
systemctl daemon-reload
# Reload and restart getty service systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
$STD systemctl daemon-reload msg_ok "Customized Container"
$STD systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') || true
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