From a9323fe97084a6890bd10a7e51949c68bf332e6a Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Tue, 23 Mar 2021 09:10:11 -0400 Subject: [PATCH] Common directories in /root like SSH add-on (#197) --- vscode/DOCS.md | 4 +++- vscode/rootfs/etc/cont-init.d/user.sh | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/vscode/DOCS.md b/vscode/DOCS.md index 4479224..2fbe7c3 100644 --- a/vscode/DOCS.md +++ b/vscode/DOCS.md @@ -62,7 +62,9 @@ you are troubleshooting. This option allows you to override the default path the add-on will open when accessing the web interface. For example, use a different -configuration directory like `/share/myconfig` instead of `/config`. +configuration directory like `/share/myconfig` instead of `/config`. If set +to `/root` then all the common folders of HA such as `/config`, `/ssl`, +`/share`, etc. will appear as subfolders for each access. When not configured, the addon will automatically use the default: `/config` diff --git a/vscode/rootfs/etc/cont-init.d/user.sh b/vscode/rootfs/etc/cont-init.d/user.sh index aca6c2e..8123e6a 100644 --- a/vscode/rootfs/etc/cont-init.d/user.sh +++ b/vscode/rootfs/etc/cont-init.d/user.sh @@ -3,11 +3,18 @@ # Home Assistant Community Add-on: Visual Studio Code # Persists user settings and installs custom user packages. # ============================================================================== +readonly -a DIRECTORIES=(addons backup config media share ssl) 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 +# Links some common directories to the user's home folder for convenience +for dir in "${DIRECTORIES[@]}"; do + ln -s "/${dir}" "${HOME}/${dir}" \ + || bashio::log.warning "Failed linking common directory: ${dir}" +done + # Store SSH settings in add-on data folder if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then mkdir -p "${SSH_USER_PATH}" \