profile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. [ "$TERM" = "xterm" ] && export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
  14. [ -x /bin/more ] || alias more=less
  15. [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
  16. alias ll='ls -alF --color=auto'
  17. [ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
  18. [ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; }
  19. [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
  20. [ -n "$FAILSAFE" ] || {
  21. for FILE in /etc/profile.d/*.sh; do
  22. [ -e "$FILE" ] && . "$FILE"
  23. done
  24. unset FILE
  25. }
  26. if ( grep -qs '^root::' /etc/shadow && \
  27. [ -z "$FAILSAFE" ] )
  28. then
  29. cat << EOF
  30. === WARNING! =====================================
  31. There is no root password defined on this device!
  32. Use the "passwd" command to set up a new password
  33. in order to prevent unauthorized SSH logins.
  34. --------------------------------------------------
  35. EOF
  36. fi
  37. service() {
  38. [ -f "/etc/init.d/$1" ] || {
  39. echo "service "'"'"$1"'"'" not found, the following services are available:"
  40. ls "/etc/init.d"
  41. return 1
  42. }
  43. /etc/init.d/$@
  44. }