| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | [ -e /tmp/.failsafe ] && export FAILSAFE=1 |
| 2 | |
| 3 | [ -f /etc/banner ] && cat /etc/banner |
| 4 | [ -n "$FAILSAFE" ] && cat /etc/banner.failsafe |
| 5 | |
| 6 | grep -Fsq '/ overlay ro,' /proc/mounts && { |
| 7 | echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.' |
| 8 | echo 'Please try to remove files from /overlay/upper/... and reboot!' |
| 9 | } |
| 10 | |
| 11 | export PATH="%PATH%" |
| 12 | export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) |
| 13 | export HOME=${HOME:-/root} |
| 14 | export PS1='\u@\h:\w\$ ' |
| 15 | export ENV=/etc/shinit |
| 16 | |
| 17 | case "$TERM" in |
| 18 | xterm*|rxvt*) |
| 19 | export PS1='\[\e]0;\u@\h: \w\a\]'$PS1 |
| 20 | ;; |
| 21 | esac |
| 22 | |
| 23 | [ -n "$FAILSAFE" ] || { |
| 24 | for FILE in /etc/profile.d/*.sh; do |
| 25 | [ -e "$FILE" ] && . "$FILE" |
| 26 | done |
| 27 | unset FILE |
| 28 | } |
| 29 | |
| 30 | if ( grep -qs '^root::' /etc/shadow && \ |
| 31 | [ -z "$FAILSAFE" ] ) |
| 32 | then |
| 33 | cat << EOF |
| 34 | === WARNING! ===================================== |
| 35 | There is no root password defined on this device! |
| 36 | Use the "passwd" command to set up a new password |
| 37 | in order to prevent unauthorized SSH logins. |
| 38 | -------------------------------------------------- |
| 39 | EOF |
| 40 | fi |