freewrt_1_0
freewrt_2_0
|
Last change
on this file since 3b38709 was 3b38709, checked in by Thorsten Glaser <tg@…>, 19 years ago |
- save a few bytes in /etc/profile and the environment
- we use USER, so define it if unset
- export HOSTNAME and USER if defined by us
- bump patchlevel
git-svn-id: svn://www.freewrt.org/trunk/freewrt@168 afb5a338-a214-0410-bd46-81f09a774fd1
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| 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:=$(hostname -s </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 ' typeset 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 -n \$; else print -n \#; 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.