Changeset 3b38709 in freewrt


Ignore:
Timestamp:
Jul 4, 2006, 3:09:40 AM (19 years ago)
Author:
Thorsten Glaser <tg@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
8d193bb
Parents:
8641ba2
Message:
  • 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

Location:
package/mksh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • package/mksh/Makefile

    r8641ba2 r3b38709  
    55PKG_NAME=               mksh
    66PKG_VERSION=            27.4
    7 PKG_RELEASE=            1
     7PKG_RELEASE=            2
    88PKG_SOURCE=             ${PKG_NAME}-R27e.cpio.gz
    99PKG_MD5SUM=             2eeb5c5fab32cc7a20ca3c7c2c6fda46
  • package/mksh/ipkg/mksh.postinst

    r8641ba2 r3b38709  
    88if ! grep KSH_VERSION ${IPKG_INSTROOT}/etc/profile >/dev/null 2>&1; then
    99        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:-noFQDN}:"'\''$(' >>${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
     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
    2119        echo '                  else' >>${IPKG_INSTROOT}/etc/profile
    22         echo '                          dots=...' >>${IPKG_INSTROOT}/etc/profile
    23         echo '                          path="${path#?????}"' >>${IPKG_INSTROOT}/etc/profile
     20        echo '                          pfx=...' >>${IPKG_INSTROOT}/etc/profile
     21        echo '                          wd="${wd#?????}"' >>${IPKG_INSTROOT}/etc/profile
    2422        echo '                  fi' >>${IPKG_INSTROOT}/etc/profile
    2523        echo '          done' >>${IPKG_INSTROOT}/etc/profile
    26         echo '          print -nr -- "$dots$path")'\''" $(if (( $(id -u) )); then' >>${IPKG_INSTROOT}/etc/profile
     24        echo '          print -r -- "$pfx$wd")'\''" $(if (( $(id -u) )); then' >>${IPKG_INSTROOT}/etc/profile
    2725        echo '                  print -n \$; else print -n \#; fi) "' >>${IPKG_INSTROOT}/etc/profile
     26        echo '  export HOSTNAME PS1 USER' >>${IPKG_INSTROOT}/etc/profile
    2827        echo 'fi' >>${IPKG_INSTROOT}/etc/profile
    2928fi
Note: See TracChangeset for help on using the changeset viewer.