Skip to content

Commit a1754df

Browse files
authored
Feature: Autologin for Alpine (#4344)
1 parent 4827a17 commit a1754df

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

misc/alpine-install.func

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,29 @@ validate_tz() {
190190
customize() {
191191
if [[ "$PASSWORD" == "" ]]; then
192192
msg_info "Customizing Container"
193-
bash -c "passwd -d root" >/dev/null 2>&1
193+
passwd -d root >/dev/null 2>&1
194+
195+
# Ensure agetty is available
196+
apk add --no-cache --force-broken-world util-linux >/dev/null 2>&1
197+
198+
# Create persistent autologin boot script
199+
mkdir -p /etc/local.d
200+
cat <<'EOF' >/etc/local.d/autologin.start
201+
#!/bin/sh
202+
sed -i 's|^tty1::respawn:.*|tty1::respawn:/sbin/agetty --autologin root --noclear tty1 38400 linux|' /etc/inittab
203+
kill -HUP 1
204+
EOF
205+
touch /root/.hushlogin
206+
207+
chmod +x /etc/local.d/autologin.start
208+
rc-update add local >/dev/null 2>&1
209+
210+
# Apply autologin immediately for current session
211+
/etc/local.d/autologin.start
212+
194213
msg_ok "Customized Container"
195214
fi
196215

197-
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update
216+
echo "bash -c \"\$(curl -fsSL https://github.com/community-scripts/ProxmoxVE/raw/main/ct/${app}.sh)\"" >/usr/bin/update
198217
chmod +x /usr/bin/update
199218
}

0 commit comments

Comments
 (0)