freewrt_1_0
freewrt_2_0
| Line | |
|---|
| 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 ' : ${HOSTNAME:=$(</proc/sys/kernel/hostname)}' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 11 | echo ' PS1='\''$(((rv=$?)) && print $rv\|)${USER:=$(id -un)}@${HOSTNAME:=nil}:$(' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 12 | echo ' local pfx=~ wd=${PWD:-$(pwd)}' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 13 | echo ' [[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx}' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 14 | echo ' pfx=; let n="( (n = ${COLUMNS:-80} / 3) < 7 ? 7 : n)"' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 15 | echo ' while (( (${#pfx} + ${#wd}) > n )); do' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 16 | echo ' if [[ $wd = */* ]]; then' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 17 | echo ' pfx=.../' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 18 | echo ' wd="${wd#*/}"' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 19 | echo ' else' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 20 | echo ' pfx=...' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 21 | echo ' wd="${wd#?????}"' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 22 | echo ' fi' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 23 | echo ' done' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 24 | echo ' print -r -- "$pfx$wd")'\''" $(if (( $(id -u) )); then' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 25 | echo ' print \$; else print \#; fi) "' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 26 | echo ' export HOSTNAME PS1 USER' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 27 | echo 'fi' >>${IPKG_INSTROOT}/etc/profile
|
|---|
| 28 | fi
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.