base-files: fix telnet login on musl
[openwrt/openwrt.git] / package / base-files / files / bin / login.sh
1 #!/bin/sh
2 # Copyright (C) 2006-2011 OpenWrt.org
3
4 if ( ! grep -qsE '^root:[!x]?:' /etc/shadow || \
5 ! grep -qsE '^root:[!x]?:' /etc/passwd ) && \
6 [ -z "$FAILSAFE" ]
7 then
8 echo "Login failed."
9 exit 0
10 else
11 cat << EOF
12 === IMPORTANT ============================
13 Use 'passwd' to set your login password
14 this will disable telnet and enable SSH
15 ------------------------------------------
16 EOF
17 fi
18
19 exec /bin/ash --login