From 3eb4c16a691aea1921a7e6a8924ae066a17ee627 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 19 Apr 2019 19:35:10 +0200 Subject: [PATCH] :sparkles: Persist user's ZSH history across restarts --- vscode/rootfs/etc/cont-init.d/user.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vscode/rootfs/etc/cont-init.d/user.sh b/vscode/rootfs/etc/cont-init.d/user.sh index b30edaa..5faf30c 100644 --- a/vscode/rootfs/etc/cont-init.d/user.sh +++ b/vscode/rootfs/etc/cont-init.d/user.sh @@ -5,6 +5,8 @@ # ============================================================================== readonly GIT_USER_PATH=/data/git readonly SSH_USER_PATH=/data/.ssh +readonly ZSH_HISTORY_FILE=/root/.zsh_history +readonly ZSH_HISTORY_PERSISTANT_FILE=/data/.zsh_history # Store SSH settings in add-on data folder if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then @@ -17,6 +19,17 @@ if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then fi ln -s "${SSH_USER_PATH}" ~/.ssh +# Sets up ZSH shell +touch "${ZSH_HISTORY_PERSISTANT_FILE}" \ + || bashio::exit.nok 'Failed creating a persistent ZSH history file' + +chmod 600 "$ZSH_HISTORY_PERSISTANT_FILE" \ + || bashio::exit.nok \ + 'Failed setting the correct permissions to the ZSH history file' + +ln -s -f "$ZSH_HISTORY_PERSISTANT_FILE" "$ZSH_HISTORY_FILE" \ + || bashio::exit.nok 'Failed linking the persistant ZSH history file' + # Store user GIT settings in add-on data folder if ! bashio::fs.directory_exists "${GIT_USER_PATH}"; then mkdir -p "${GIT_USER_PATH}" \