packages/utils/mksh/patches/100-dot_mkshrc
Alif M. Ahmad 369ff9d1c9 mksh: bump to R55 and use PKG_HASH
Upgrade the package to R55. Patches refreshed.

Added `-DMKSHRC_PATH=\"/etc/mkshrc\"` to `CPPFLAGS` to set the default
startup file during both login and nonlogin sessions, so that there is
no need to source `/etc/mkshrc` file manually.

In addition to the package upgrade, use PKG_HASH instead of
PKG_MD5SUM.

Reviewed-by: Thorsten Glaser <tg@mirbsd.org>
Signed-off-by: Alif M. Ahmad <alive4ever@live.com>
2017-07-20 22:07:20 +07:00

42 lines
1.6 KiB
Text

From 23712cea8e2a623fd952eb781df0011c501703d0 Mon Sep 17 00:00:00 2001
From: Thorsten Glaser <tg@mirbsd.org>
Date: Thu, 25 Jul 2013 22:07:33 +0200
Subject: [PATCH] Make default mkshrc file suitable for OpenWrt environment:
* Part of the FreeWRT patches:
- no hostname(1)
- ls(1) has no -o option
* OpenWrt and FreeWRT-1.0 fix:
- since this is not ~/.mkshrc make sure subshells find it
From: Alif M. A. <alive4ever@live.com>
Date: Thu, 20 Jul 2017 14:52:39 +0000
Subject: [PATCH] Refresh 100-dot_mkshrc for mksh-R55
Additional changes of the patch as of mksh-R55
* Use content of `/proc/sys/kernel/hostname` to set `$HOSTNAME`, since
`hostname` applet isn't compiled into `busybox`.
* Use `/bin/vi` as fallback `$EDITOR`.
* Use `/etc/mkshrc` as default startup file, so there is no need to
manually source it during interactive session.
---
Reviewed-by: Thorsten Glaser <tg at mirbsd.org>
Signed-off-by: Alif M. A. <alive4ever at live.com>
--- a/dot.mkshrc
+++ b/dot.mkshrc
@@ -56,10 +56,9 @@
done
)
-\\builtin alias ls=ls l='ls -F' la='l -a' ll='l -l' lo='l -alo'
-\: "${HOSTNAME:=$(\\builtin ulimit -c 0; \\builtin print -r -- $(hostname \
- 2>/dev/null))}${EDITOR:=/bin/ed}${TERM:=vt100}${USER:=$(\\builtin ulimit \
- -c 0; id -un 2>/dev/null)}${USER:=?}"
+\\builtin alias ls=ls l='ls -F' la='l -a' ll='l -l' lo='l -al'
+\: "${HOSTNAME:=$(</proc/sys/kernel/hostname)}${EDITOR:=/bin/vi}${TERM:=vt100}\
+ ${USER:=$(\\builtin ulimit -c 0; id -un 2>/dev/null)}${USER:=?}"
[[ $HOSTNAME = ?(?(ip6-)localhost?(6)) ]] && HOSTNAME=nil; \\builtin unalias ls
\\builtin export EDITOR HOSTNAME TERM USER