46 lines
1.6 KiB

  1. Refreshed for mksh-r52c, based on tg's patch
  2. From 23712cea8e2a623fd952eb781df0011c501703d0 Mon Sep 17 00:00:00 2001
  3. From: Thorsten Glaser <tg@mirbsd.org>
  4. Date: Thu, 25 Jul 2013 22:07:33 +0200
  5. Subject: [PATCH] Make default mkshrc file suitable for OpenWrt environment:
  6. * Part of the FreeWRT patches:
  7. - no hostname(1)
  8. - ls(1) has no -o option
  9. * OpenWrt and FreeWRT-1.0 fix:
  10. - since this is not ~/.mkshrc make sure subshells find it
  11. ---
  12. Signed-off-by: Alif M. A. <alive4ever at live.com>
  13. --- a/dot.mkshrc
  14. +++ b/dot.mkshrc
  15. @@ -28,8 +28,9 @@
  16. *) return 0 ;;
  17. esac
  18. -PS1='#'; (( USER_ID )) && PS1='$'; \: "${TERM:=vt100}${HOSTNAME:=$(\ulimit -c \
  19. - 0; hostname 2>/dev/null)}${EDITOR:=/bin/ed}${USER:=$(\ulimit -c 0; id -un \
  20. +PS1='#'; (( USER_ID )) && PS1='$'; \: "${HOSTNAME:=$(</proc/sys/kernel/hostname\
  21. + )} = *([ ]|localhost) && HOSTNAME=$(\ulimit -c \
  22. + 0; hostname 2>/dev/null)}${EDITOR:=/bin/vi}${USER:=$(\ulimit -c 0; id -un \
  23. 2>/dev/null || \echo \?)}${MKSH:=$(\builtin whence -p mksh)}"
  24. HOSTNAME=${HOSTNAME%%*([ ]).*}; HOSTNAME=${HOSTNAME##*([ ])}
  25. [[ $HOSTNAME = ?(ip6-)localhost?(6) ]] && HOSTNAME=
  26. @@ -52,7 +53,7 @@
  27. \alias l='ls -F'
  28. \alias la='l -a'
  29. \alias ll='l -l'
  30. -\alias lo='l -alo'
  31. +\alias lo='l -al'
  32. \alias doch='sudo mksh -c "$(\builtin fc -ln -1)"'
  33. \command -v rot13 >/dev/null || \alias rot13='tr \
  34. abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ \
  35. @@ -601,4 +602,8 @@
  36. \unset p
  37. +# we need this in OpenWrt for subshells that are not login shells
  38. +\: ${ENV=/etc/mkshrc}
  39. +[[ -z $ENV ]] || export ENV
  40. +
  41. \: place customisations above this line