|
| 1 | +unset FAILSAFE |
1 | 2 | [ -e /tmp/.failsafe ] && export FAILSAFE=1 |
2 | 3 |
|
3 | 4 | [ -f /etc/banner ] && cat /etc/banner |
4 | | -[ -n "$FAILSAFE" ] && cat /etc/banner.failsafe |
| 5 | +[ -n "$FAILSAFE" ] && [ -f /etc/banner.failsafe ] && cat /etc/banner.failsafe |
5 | 6 |
|
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 | | -} |
| 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 |
10 | 19 |
|
11 | 20 | export PATH="%PATH%" |
12 | | -export HOME=$(grep -e "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) |
13 | | -export HOME=${HOME:-/root} |
| 21 | +HOME=$(grep -E "^${USER:-root}:" /etc/passwd | cut -d ":" -f 6) |
| 22 | +HOME=${HOME:-/root} |
| 23 | +export HOME |
14 | 24 | export PS1='\u@\h:\w\$ ' |
15 | 25 | export ENV=/etc/shinit |
16 | 26 |
|
17 | 27 | case "$TERM" in |
18 | 28 | xterm*|rxvt*) |
19 | | - export PS1='\[\e]0;\u@\h: \w\a\]'$PS1 |
20 | | - ;; |
| 29 | + export PS1='\[\e]0;\u@\h: \w\a\]'"$PS1" |
| 30 | + ;; |
21 | 31 | esac |
22 | 32 |
|
23 | | -[ -n "$FAILSAFE" ] || { |
24 | | - for FILE in /etc/profile.d/*.sh; do |
25 | | - [ -e "$FILE" ] && . "$FILE" |
| 33 | +if [ -z "$FAILSAFE" ] ; then |
| 34 | + for FILE in /etc/profile.d/*.sh ; do |
| 35 | + [ -f "$FILE" ] && . "$FILE" |
26 | 36 | done |
27 | 37 | 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 |
41 | | - |
42 | | -if [ -x /usr/bin/apk ]; then |
43 | | -cat << EOF |
44 | | -
|
45 | | - OpenWrt recently switched to the "apk" package manager! |
46 | | -
|
47 | | - OPKG Command APK Equivalent Description |
48 | | - ------------------------------------------------------------------ |
49 | | - opkg install <pkg> apk add <pkg> Install a package |
50 | | - opkg remove <pkg> apk del <pkg> Remove a package |
51 | | - opkg upgrade apk upgrade Upgrade all packages |
52 | | - opkg files <pkg> apk info -L <pkg> List package contents |
53 | | - opkg list-installed apk info List installed packages |
54 | | - opkg update apk update Update package lists |
55 | | - opkg search <pkg> apk search <pkg> Search for packages |
56 | | - ------------------------------------------------------------------ |
57 | | -
|
58 | | -For more https://openwrt.org/docs/guide-user/additional-software/opkg-to-apk-cheatsheet |
59 | | -
|
60 | | -EOF |
61 | 38 | fi |
0 commit comments