diff --git a/misc/install.func b/misc/install.func index 5b13bab62..e9e319576 100644 --- a/misc/install.func +++ b/misc/install.func @@ -239,6 +239,10 @@ motd_ssh() { fi } +# ============================================================================== +# SECTION 5: CONTAINER CUSTOMIZATION +# ============================================================================== + # ------------------------------------------------------------------------------ # customize() # @@ -249,33 +253,21 @@ motd_ssh() { # - Sets proper permissions on SSH directories and key files # ------------------------------------------------------------------------------ customize() { - if [[ -z "${PASSWORD:-}" ]]; then - msg_info "Configuring autologin for root" - - # Enable root account (remove password lock) - passwd -d root >/dev/null 2>&1 || true - - # Create getty override for container-getty@1.service + if [[ "$PASSWORD" == "" ]]; then + msg_info "Customizing Container" GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf" mkdir -p $(dirname $GETTY_OVERRIDE) cat <$GETTY_OVERRIDE -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM + [Service] + ExecStart= + ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM EOF - - # Reload and restart getty service - $STD systemctl daemon-reload - $STD systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') || true - - msg_ok "Autologin configured" + systemctl daemon-reload + systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//') + msg_ok "Customized Container" fi - - msg_ok "Customized Container" - echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVED/raw/main/ct/${app}.sh)\"" >/usr/bin/update chmod +x /usr/bin/update - if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then mkdir -p /root/.ssh echo "${SSH_AUTHORIZED_KEY}" >/root/.ssh/authorized_keys