diff options
| author | Hannu Nyman | 2024-12-05 20:28:45 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-07-21 00:47:47 +0000 |
| commit | 26471f32b5b8a3f5d9ccd432083eaf42a0f04cef (patch) | |
| tree | cb87aa8ab1d3354949e7a4fcfbdc6628aece4d51 | |
| parent | b9ad54db42ddf79335f5224a5ad612cb8389028a (diff) | |
busybox: Save shell history into /tmp
Enable the busybox feature to save shell command history.
(.apk size increase 0.5 kB)
To prevent flash wear,
* save history only at the exit from a shell session, and
* set /tmp as the default location for the history file. The history
is kept on ramdisk until a reboot, when the history is then lost.
If the user wants to save history onto flash, he can change the location
definition in /etc/profile.d/busybox-history-file.sh
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/17179
cherry picked from commit e23b37b2d9a2e766b1ad151f59a04eb68b6a3341)
[ fix conflict error ]
Signed-off-by: Andrey Zotikov <andrey.zotikov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23634
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | package/utils/busybox/Config-defaults.in | 4 | ||||
| -rw-r--r-- | package/utils/busybox/Makefile | 4 | ||||
| -rw-r--r-- | package/utils/busybox/files/busybox-history-file.sh | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index f88f395e2c..6103df869d 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -252,10 +252,10 @@ config BUSYBOX_DEFAULT_FEATURE_EDITING_HISTORY default 256 config BUSYBOX_DEFAULT_FEATURE_EDITING_SAVEHISTORY bool - default n + default y config BUSYBOX_DEFAULT_FEATURE_EDITING_SAVE_ON_EXIT bool - default n + default y config BUSYBOX_DEFAULT_FEATURE_REVERSE_SEARCH bool default n diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index e3b9f256e0..9cd06205fc 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.36.1 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -150,6 +150,8 @@ define Package/busybox/install $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/* $(1)/ + $(INSTALL_DIR) $(1)/etc/profile.d + $(INSTALL_BIN) ./files/busybox-history-file.sh $(1)/etc/profile.d ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SYSLOG)$(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SYSLOGD_CFG),) touch $(1)/etc/syslog.conf endif diff --git a/package/utils/busybox/files/busybox-history-file.sh b/package/utils/busybox/files/busybox-history-file.sh new file mode 100644 index 0000000000..f286009627 --- /dev/null +++ b/package/utils/busybox/files/busybox-history-file.sh @@ -0,0 +1,2 @@ +export HISTFILE=/tmp/.busybox_ash_history + |