Changeset 56bb70d in freewrt
- Timestamp:
- Oct 15, 2007, 11:45:13 AM (18 years ago)
- Branches:
- freewrt_1_0, freewrt_2_0
- Children:
- 3667e10
- Parents:
- 1255a41
- Location:
- package/mksh
- Files:
-
- 1 deleted
- 2 edited
-
Makefile (modified) (3 diffs)
-
patches/patch-Build_sh (deleted)
-
patches/patch-dot_mkshrc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
package/mksh/Makefile
r1255a41 r56bb70d 8 8 9 9 PKG_NAME= mksh 10 PKG_VERSION= 31. 311 PKG_RELEASE= 210 PKG_VERSION= 31.4 11 PKG_RELEASE= 1 12 12 PKG_SOURCE= ${PKG_NAME}-R31c.cpio.gz 13 PKG_MD5SUM= 08b6354ad94b9c5d5bfc301e3314e41213 PKG_MD5SUM= a7c77428bd2b887c1583095a00c84aac 14 14 15 15 PKG_SOURCE_URL= http://www.mirbsd.org/MirOS/dist/mir/mksh/ … … 20 20 $(eval $(call PKG_template,MKSH,mksh,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) 21 21 22 $ (WRKBUILD)/.configured:22 ${WRKBUILD}/.configured: 23 23 @touch $@ 24 24 25 CPPFLAGS_TO_PASS:= -I$ (STAGING_DIR)/usr/include -I$(STAGING_DIR)/include25 CPPFLAGS_TO_PASS:= -I${STAGING_DIR}/usr/include -I${STAGING_DIR}/include 26 26 CPPFLAGS_TO_PASS+= -DMKSH_NOPWNAM=1 27 27 … … 30 30 endif 31 31 32 $ (WRKBUILD)/.built:32 ${WRKBUILD}/.built: 33 33 (cd ${WRKBUILD}; \ 34 34 CC='${TARGET_CC}' \ 35 35 CFLAGS='${TARGET_CFLAGS}' \ 36 36 CPPFLAGS='${CPPFLAGS_TO_PASS}' \ 37 LDFLAGS='-L$ (STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib' \37 LDFLAGS='-L${STAGING_DIR}/usr/lib -L${STAGING_DIR}/lib' \ 38 38 TARGET_OS=Linux \ 39 39 HAVE_ARC4RANDOM=0 HAVE_MKNOD=0 HAVE_SETLOCALE_CTYPE=0 \ 40 40 HAVE_PERSISTENT_HISTORY=0 \ 41 41 ${BASH} Build.sh -Q -r) 42 rm -rf $ (WRKINST)43 mkdir -p $ (WRKINST)/{bin,etc}42 rm -rf ${WRKINST} 43 mkdir -p ${WRKINST}/{bin,etc} 44 44 install -c -m 755 ${WRKBUILD}/mksh ${WRKINST}/bin/mksh 45 install -c -m 444 ${WRKSRC}/dot.mkshrc ${WRKINST}/etc/mkshrc45 install -c -m 644 ${WRKSRC}/dot.mkshrc ${WRKINST}/etc/mkshrc 46 46 @touch $@ 47 47 48 $(IPKG_MKSH): 49 install -d -m 0755 $(IDIR_MKSH)/bin 50 install -d -m 0755 $(IDIR_MKSH)/etc 51 $(CP) $(WRKINST)/bin/mksh $(IDIR_MKSH)/bin/ 52 $(RSTRIP) $(IDIR_MKSH) 53 $(CP) $(WRKINST)/etc/mkshrc $(IDIR_MKSH)/etc/ 48 ${IPKG_MKSH}: 49 cd ${WRKINST} && pax -rw -pe bin/mksh etc/mkshrc ${IDIR_MKSH}/ 50 ${RSTRIP} ${IDIR_MKSH} 54 51 ifeq (${FWRT_PACKAGE_MKSH_AS_BINSH},y) 55 cd $ (IDIR_MKSH)/bin/; ln -sf mksh sh52 cd ${IDIR_MKSH}/bin; ln -sf mksh sh 56 53 endif 57 54 ifeq (${FWRT_PACKAGE_MKSH_AS_BINASH},y) 58 cd $ (IDIR_MKSH)/bin/; ln -sf mksh ash55 cd ${IDIR_MKSH}/bin; ln -sf mksh ash 59 56 endif 60 $ (IPKG_BUILD) $(IDIR_MKSH) $(PACKAGE_DIR)57 ${IPKG_BUILD} ${IDIR_MKSH} ${PACKAGE_DIR} -
package/mksh/patches/patch-dot_mkshrc
r1255a41 r56bb70d 1 1 $FreeWRT$ 2 2 3 • bring mksh to the level of 2007/09/264 3 • FreeWRT patches: 5 4 – no hostname(1) … … 7 6 – yofuh doesn’t like $? in $PS1 8 7 9 --- mksh.orig/dot.mkshrc 2007-09-03 09:25:28.000000000 +0000 10 +++ mksh/dot.mkshrc 2007-09-26 17:52:20.000000000 +0000 11 @@ -1,8 +1,41 @@ 8 --- mksh.orig/dot.mkshrc Tue Oct 2 01:03:12 2007 9 +++ mksh/dot.mkshrc Mon Oct 15 09:32:00 2007 10 @@ -24,13 +24,15 @@ 11 #- 12 # sample mksh initialisation file for interactive shells 13 12 14 -: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(ulimit -c 0;hostname -s 2>&-)} 13 +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.22 2007/09/25 22:36:36 tg Stab $14 +#-15 +# Copyright (c) 200716 +# Thorsten Glaser <tg@mirbsd.de>17 +#18 +# Provided that these terms and disclaimer and all copyright notices19 +# are retained or reproduced in an accompanying document, permission20 +# is granted to deal in this work without restriction, including un-21 +# limited rights to use, publicly perform, distribute, sell, modify,22 +# merge, give away, or sublicence.23 +#24 +# Advertising materials mentioning features or use of this work must25 +# display the following acknowledgement:26 +# This product includes material provided by Thorsten Glaser.27 +#28 +# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to29 +# the utmost extent permitted by applicable law, neither express nor30 +# implied; without malicious intent or gross negligence. In no event31 +# may a licensor, author or contributor be held liable for indirect,32 +# direct, other damage, loss, or other issues arising in any way out33 +# of dealing in the work, even if advised of the possibility of such34 +# damage or existence of a defect, except proven that it results out35 +# of said person's immediate fault when using the work as intended.36 +#-37 +# sample mksh initialisation file for interactive shells38 +39 15 +: ${EDITOR:=/bin/ed} ${TERM:=vt100} ${HOSTNAME:=$(</proc/sys/kernel/hostname)} 40 16 [[ $HOSTNAME = @(localhost|*([ ])) ]] && HOSTNAME=$(ulimit -c 0;hostname 2>&-) 41 17 : ${HOSTNAME:=nil}; PS1='#'; [[ "$(ulimit -c 0; id -u 2>&-)" -eq 0 ]] || PS1='$' 42 -PS1='$(((e = $?)) && print $e\|)${USER:=$(ulimit -c 0; id -un 2>&- || \ 43 - print nobody)}@${HOSTNAME%%.*}:$(typeset pfx=~ wd=${PWD:-?} 44 +function precmd { 45 + typeset -i10 e=$? 46 + 18 function precmd { 19 typeset -i10 e=$? 20 21 - (( e )) && print -n -- "$e|" 47 22 +# enable this back if you want the errorlevel in your prompt 48 23 +# this is default in upstream mksh 49 24 +# (( e )) && print -n -- "$e|" 50 +} 51 +PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$( 52 + typeset pfx=~ wd=${PWD:-?} 53 typeset -i n=${COLUMNS:-80}/3; let n="n < 7 ? 7 : n" 54 [[ ${wd#$pfx} = $wd || $pfx = ?(/) ]] || wd=\~${wd#$pfx} 55 pfx=; while (( (${#pfx} + ${#wd}) > n )); do 56 @@ -18,7 +51,7 @@ export EDITOR HOSTNAME LESSHISTFILE=- MK 25 } 26 PS1='$(precmd)${USER:=$(ulimit -c 0;id -un 2>&- || print \?)}@${HOSTNAME%%.*}:$( 27 typeset pfx=~ wd=${PWD:-?} 28 @@ -50,7 +52,7 @@ export EDITOR HOSTNAME LESSHISTFILE=- MK 57 29 alias l='/bin/ls -F' 58 30 alias la='l -a' … … 63 35 whence -p rot13 >&- || alias rot13='tr [A-Za-z] [N-ZA-Mn-za-m]' 64 36 whence -p hd >&- || function hd { 65 @@ -26,6 +59,162 @@ whence -p hd >&- || function hd {66 -e '" |" "%_p"' -e '"|\n"' "$@"67 }68 69 +# Berkeley C shell compatible dirs, popd, and pushd functions70 +# Z shell compatible chpwd() hook, used to update DIRSTACK[0]71 +DIRSTACKBASE=$(readlink -nf ~/. 2>&- || print -nr -- "$HOME")72 +typeset -r DIRSTACKBASE73 +set -A DIRSTACK74 +function chpwd {75 + DIRSTACK[0]=$(readlink -nf . 2>&- || print -nr -- "$PWD")76 + [[ ${DIRSTACK[0]#$DIRSTACKBASE} = ${DIRSTACK[0]} ]] || \77 + DIRSTACK[0]=\~${DIRSTACK[0]#$DIRSTACKBASE}78 + :79 +}80 +chpwd .81 +function cd {82 + builtin cd "$@"83 + chpwd "$@"84 +}85 +function cd_csh {86 + typeset d t=$187 +88 + [[ $t = ~* ]] && t=$DIRSTACKBASE${t#~}89 + if ! d=$(builtin cd "$t" 2>&1); then90 + print -u2 "${1}: ${d##*$t - }."91 + return 192 + fi93 + cd "$t"94 +}95 +function dirs {96 + typeset d97 + typeset -i isnoglob=0 fl=0 fv=0 fn=0 cpos=098 +99 + [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1100 + set -o noglob101 + while getopts ":lvn" d; do102 + case $d {103 + (l) fl=1 ;;104 + (v) fv=1 ;;105 + (n) fn=1 ;;106 + (*) print -u2 'Usage: dirs [-lvn].'107 + return 1 ;;108 + }109 + done110 + shift $((OPTIND - 1))111 + if (( $# > 0 )); then112 + print -u2 'Usage: dirs [-lvn].'113 + return 1114 + fi115 + if (( fv )); then116 + fv=0117 + while (( fv < ${#DIRSTACK[*]} )); do118 + d=${DIRSTACK[fv]}119 + [[ $fl$d = 1~* ]] && d=$DIRSTACKBASE${d#~}120 + print -r -- "$fv $d"121 + let fv++122 + done123 + else124 + fv=0125 + while (( fv < ${#DIRSTACK[*]} )); do126 + d=${DIRSTACK[fv]}127 + [[ $fl$d = 1~* ]] && d=$DIRSTACKBASE${d#~}128 + if (( fn && (cpos+=${#d}+1) >= 79 && ${#d} < 80 )); then129 + print130 + (( cpos = ${#d} + 1 ))131 + fi132 + print -nr -- "$d "133 + let fv++134 + done135 + print136 + fi137 + (( isnoglob )) || set +o noglob138 + return 0139 +}140 +function popd {141 + typeset d fa142 + typeset -i isnoglob=0 n=1143 +144 + [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1145 + set -o noglob146 + while getopts ":0123456789lvn" d; do147 + case $d {148 + (l|v|n) fa="$fa -$d" ;;149 + (+*) n=2150 + break ;;151 + (*) print -u2 'Usage: popd [-lvn] [+<n>].'152 + return 1 ;;153 + }154 + done155 + shift $((OPTIND - n))156 + n=0157 + if (( $# > 1 )); then158 + print -u2 popd: Too many arguments.159 + return 1160 + elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then161 + if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then162 + print -u2 popd: Directory stack not that deep.163 + return 1164 + fi165 + elif [[ -n $1 ]]; then166 + print -u2 popd: Bad directory.167 + return 1168 + fi169 + if (( ${#DIRSTACK[*]} < 2 )); then170 + print -u2 popd: Directory stack empty.171 + return 1172 + fi173 + unset DIRSTACK[n]174 + set -A DIRSTACK -- "${DIRSTACK[@]}"175 + cd_csh "${DIRSTACK[0]}" || return 1176 + (( isnoglob )) || set +o noglob177 + dirs $fa178 +}179 +function pushd {180 + typeset d fa181 + typeset -i isnoglob=0 n=1182 +183 + [[ $(set +o) == *-o\ noglob* ]] && isnoglob=1184 + set -o noglob185 + while getopts ":0123456789lvn" d; do186 + case $d {187 + (l|v|n) fa="$fa -$d" ;;188 + (+*) n=2189 + break ;;190 + (*) print -u2 'Usage: pushd [-lvn] [<dir>|+<n>].'191 + return 1 ;;192 + }193 + done194 + shift $((OPTIND - n))195 + if (( $# == 0 )); then196 + if (( ${#DIRSTACK[*]} < 2 )); then197 + print -u2 pushd: No other directory.198 + return 1199 + fi200 + d=${DIRSTACK[1]}201 + DIRSTACK[1]=${DIRSTACK[0]}202 + cd_csh "$d" || return 1203 + elif (( $# > 1 )); then204 + print -u2 pushd: Too many arguments.205 + return 1206 + elif [[ $1 = ++([0-9]) && $1 != +0 ]]; then207 + if (( (n = ${1#+}) >= ${#DIRSTACK[*]} )); then208 + print -u2 pushd: Directory stack not that deep.209 + return 1210 + fi211 + while (( n-- )); do212 + d=${DIRSTACK[0]}213 + unset DIRSTACK[0]214 + set -A DIRSTACK -- "${DIRSTACK[@]}" "$d"215 + done216 + cd_csh "${DIRSTACK[0]}" || return 1217 + else218 + set -A DIRSTACK -- placeholder "${DIRSTACK[@]}"219 + cd_csh "$1" || return 1220 + fi221 + (( isnoglob )) || set +o noglob222 + dirs $fa223 +}224 +225 # strip comments (and leading/trailing whitespace if IFS is set) from226 # any file(s) given as argument, or stdin if none, and spew to stdout227 function Lstripcom {228 @@ -35,6 +224,4 @@ function Lstripcom {229 done; }230 }231 232 -# place customisations between this line and the “: RCSID” line below233 -234 -: $MirOS: src/bin/mksh/dot.mkshrc,v 1.19 2007/09/03 09:25:05 tg Rel $235 +: place customsations above this line!
Note:
See TracChangeset
for help on using the changeset viewer.
