source: freewrt/package/mksh/ipkg/mksh.postinst@ 8641ba2

freewrt_1_0 freewrt_2_0
Last change on this file since 8641ba2 was 8641ba2, checked in by Thorsten Glaser <tg@…>, 19 years ago

mksh R26e, and sync with MirOS src/etc/profile,v 1.23
and ports/shells/mksh/pkg/DESCR,v 1.2 (for $PS1) thus
saving a few bytes

git-svn-id: svn://www.freewrt.org/trunk/freewrt@167 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[f6a55cb]1#!/bin/sh
2# $FreeWRT$
3
4if ! grep /bin/mksh ${IPKG_INSTROOT}/etc/shells >/dev/null 2>&1; then
5 echo /bin/mksh >>${IPKG_INSTROOT}/etc/shells
6fi
7
8if ! grep KSH_VERSION ${IPKG_INSTROOT}/etc/profile >/dev/null 2>&1; then
9 echo 'if test -n "$KSH_VERSION"; then' >>${IPKG_INSTROOT}/etc/profile
[fc58502]10 echo ' [[ -z $HOSTNAME ]] && export HOSTNAME=$(</proc/sys/kernel/hostname)' >>${IPKG_INSTROOT}/etc/profile
[8641ba2]11 echo ' export PS1='\''$(((rv=$?)) && print $rv\|)'\''"\$USER@${HOSTNAME:-noFQDN}:"'\''$(' >>${IPKG_INSTROOT}/etc/profile
[fc58502]12 echo ' typeset tilde=~ path=${1:-${PWD:-$(pwd)}}' >>${IPKG_INSTROOT}/etc/profile
13 echo ' typeset dots= path2=${path#$tilde}' >>${IPKG_INSTROOT}/etc/profile
[8641ba2]14 echo ' [[ $path2 = $path || -z $tilde || $tilde = / ]] || path=\~$path2' >>${IPKG_INSTROOT}/etc/profile
[126f068]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
[8641ba2]26 echo ' print -nr -- "$dots$path")'\''" $(if (( $(id -u) )); then' >>${IPKG_INSTROOT}/etc/profile
27 echo ' print -n \$; else print -n \#; fi) "' >>${IPKG_INSTROOT}/etc/profile
[f6a55cb]28 echo 'fi' >>${IPKG_INSTROOT}/etc/profile
29fi
Note: See TracBrowser for help on using the repository browser.