base-files: Allow to disable failsafe mode
[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  ------------------------------------------
15 EOF
16 fi
17
18 exec /bin/ash --login