| 1 | #!/bin/sh
|
|---|
| 2 | # $FreeWRT$
|
|---|
| 3 |
|
|---|
| 4 | if ! grep /bin/mksh ${IPKG_INSTROOT}/etc/shells >/dev/null 2>&1; then
|
|---|
| 5 | echo /bin/mksh >>${IPKG_INSTROOT}/etc/shells
|
|---|
| 6 | fi
|
|---|
| 7 |
|
|---|
| 8 | if ! grep KSH_VERSION ${IPKG_INSTROOT}/etc/profile >/dev/null 2>&1; then
|
|---|
| 9 | echo 'if test -n "$KSH_VERSION"; then' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 10 | echo ' [[ -z $HOSTNAME ]] && export HOSTNAME=$(</proc/sys/kernel/hostname)' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 11 | echo ' export PS1='\''$(((rv=$?)) && print "$rv|")'\''"\${USER}@$HOSTNAME:"'\''$(' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 12 | echo ' typeset tilde=~ path=${1:-${PWD:-$(pwd)}}' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 13 | echo ' typeset dots= path2=${path#$tilde}' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 14 | echo ' [[ $path2 = $path || -z $tilde || $tilde = / ]] || path='~'$path2' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 15 | echo ' let cmax="${COLUMNS:-80} / 3"' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 16 | echo ' (( cmax < 7 )) && let cmax=7' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 17 | echo ' while (( (${#dots} + ${#path}) > cmax )); do' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 18 | echo ' if [[ $path = *@(/)* ]]; then' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 19 | echo ' dots=.../' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 20 | echo ' path="${path#*/}"' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 21 | echo ' else' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 22 | echo ' dots=...' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 23 | echo ' path="${path#?????}"' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 24 | echo ' fi' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 25 | echo ' done' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 26 | echo ' print -nr -- "$dots$path")'\''" $(if [[ $(id -u) -eq 0 ]]; then' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 27 | echo ' echo -n '\''#'\''; else echo -n '\''$'\''; fi) "' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 28 | echo 'fi' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 29 | fi
|
|---|