procd: Add wrapper for uci_validate_section()
[openwrt/openwrt.git] / package / base-files / files / etc / profile
1 #!/bin/sh
2 [ -e /tmp/.failsafe ] && export FAILSAFE=1
3
4 [ -f /etc/banner ] && cat /etc/banner
5 [ -n "$FAILSAFE" ] && cat /etc/banner.failsafe
6
7 fgrep -sq '/ overlay ro,' /proc/mounts && {
8 echo 'Your JFFS2-partition seems full and overlayfs is mounted read-only.'
9 echo 'Please try to remove files from /overlay/upper/... and reboot!'
10 }
11
12 export PATH="%PATH%"
13 export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
14 export HOME=${HOME:-/root}
15 export PS1='\u@\h:\w\$ '
16
17 case "$TERM" in
18 xterm*|rxvt*)
19 export PS1='\[\e]0;\u@\h: \w\a\]'$PS1
20 ;;
21 esac
22
23 [ -x /bin/more ] || alias more=less
24 [ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi
25
26 alias ll='ls -alF --color=auto'
27
28 [ -z "$KSH_VERSION" -o \! -s /etc/mkshrc ] || . /etc/mkshrc
29
30 [ -x /usr/bin/arp -o -x /sbin/arp ] || arp() { cat /proc/net/arp; }
31 [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
32
33 [ -n "$FAILSAFE" ] || {
34 for FILE in /etc/profile.d/*.sh; do
35 [ -e "$FILE" ] && . "$FILE"
36 done
37 unset FILE
38 }
39
40 if ( grep -qs '^root::' /etc/shadow && \
41 [ -z "$FAILSAFE" ] )
42 then
43 cat << EOF
44 === WARNING! =====================================
45 There is no root password defined on this device!
46 Use the "passwd" command to set up a new password
47 in order to prevent unauthorized SSH logins.
48 --------------------------------------------------
49 EOF
50 fi
51
52 service() {
53 [ -f "/etc/init.d/$1" ] || {
54 echo "service "'"'"$1"'"'" not found, the following services are available:"
55 ls "/etc/init.d"
56 return 1
57 }
58 /etc/init.d/$@
59 }