profile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/sh
  2. [ -e /tmp/.failsafe ] && export FAILSAFE=1
  3. [ -f /etc/banner ] && cat /etc/banner
  4. [ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
  5. fgrep -sq '/ overlay ro,' /proc/mounts && {
  6. echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
  7. echo 'Please try to remove files from /overlay/upper/... and reboot!'
  8. }
  9. export PATH="%PATH%"
  10. export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
  11. export HOME=${HOME:-/root}
  12. export PS1='\u@\h:\w\$ '
  13. case "$TERM" in
  14. xterm*|rxvt*)
  15. export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
  16. ;;
  17. esac
  18. [ -x /bin/more ] || alias more=less
  19. [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
  20. alias ll='ls -alF --color=auto'
  21. [ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
  22. [ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; }
  23. [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
  24. [ -n "$FAILSAFE" ] || {
  25. for FILE in /etc/profile.d/*.sh; do
  26. [ -e "$FILE" ] && . "$FILE"
  27. done
  28. unset FILE
  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
  41. service() {
  42. [ -f "/etc/init.d/$1" ] || {
  43. echo "service "'"'"$1"'"'" not found, the following services are available:"
  44. ls "/etc/init.d"
  45. return 1
  46. }
  47. /etc/init.d/$@
  48. }