Skip to content

Commit 854a97f

Browse files
committed
at750: add an updated profile
1 parent af0459f commit 854a97f

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

  • configs/glinet_gl-ar750/files/etc
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
unset FAILSAFE
2+
[ -e /tmp/.failsafe ] && export FAILSAFE=1
3+
4+
[ -f /etc/banner ] && cat /etc/banner
5+
[ -n "$FAILSAFE" ] && [ -f /etc/banner.failsafe ] && cat /etc/banner.failsafe
6+
7+
if grep -Fsq '/ overlay ro,' /proc/mounts ; then
8+
cat << EOF
9+
10+
=== WARNING! ======================================
11+
Your JFFS2-partition seems full and overlayfs is
12+
mounted as READ-ONLY!
13+
Please try to remove files from /overlay/upper/...
14+
and reboot!
15+
---------------------------------------------------
16+
17+
EOF
18+
fi
19+
20+
# sysinfo
21+
device=$(sed -n 's/.*"name": "\(.*\)"$/\1/p' /etc/board.json)
22+
target=$(sed -n "s/.*DISTRIB_TARGET='\(.*\)'$/\1/p" /etc/openwrt_release)
23+
kernel=$(uname -mrsvo)
24+
echo " device : $device ($target)"
25+
echo " kernel : $kernel"
26+
echo " uptime :$(uptime)"
27+
echo
28+
29+
export PATH="/usr/sbin:/usr/bin:/sbin:/bin"
30+
HOME=$(grep -E "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6)
31+
HOME=${HOME:-/root}
32+
export HOME
33+
export PS1="\[\e[0;1m\]\H \[\e[38;5;9m\]\w \[\e[0;1m\]\\$ \[\e[0m\]"
34+
export ENV=/etc/shinit
35+
36+
case "$TERM" in
37+
xterm*|rxvt*)
38+
export PS1='\[\e]0;\u@\h: \w\a\]'"$PS1"
39+
;;
40+
esac
41+
42+
if [ -z "$FAILSAFE" ] ; then
43+
for FILE in /etc/profile.d/*.sh ; do
44+
[ -f "${FILE%.sh}.hush" ] && continue
45+
[ -f "$FILE" ] && . "$FILE"
46+
done
47+
unset FILE
48+
fi
49+
50+
# aliases
51+
[ -x /bin/more ] || alias more=less
52+
[ -x /usr/bin/vim ] && alias vi=vim
53+
alias ls='ls --color=auto'
54+
alias ll='ls -alF' # all, long, classify; pretty verbose
55+
56+
# safeguard
57+
alias rm='rm -i'
58+
alias mv='mv -i'
59+
alias cp='cp -i'
60+
61+
# show status of network ports
62+
alias ports='swconfig dev switch0 show | grep "link:" | sed "s/^[\t]*link: port:/port /"'
63+
64+
# list ip addresses more readably
65+
ipaddr() {
66+
ip addr | sed -n \
67+
-e "s/^[0-9]\+: \(.*\): <.*>/\n$(printf '\033[1m\\1\033[0m'): +/;s/+ .* master \([^ ]\+\)/[\1] +/;s/+\( .*\)\? state \([^ ]\+\) .*/\2/p" \
68+
-e "s/link\/\(\w\+ [0-9a-f:]\+\).*/\1/p" \
69+
-e "s/inet \([^ ]\+\).*/ipv4 \1/p" \
70+
-e "s/inet6 \([^ ]\+\).*/ipv6 \1/p";
71+
echo;
72+
}

0 commit comments

Comments
 (0)