Common directories in /root like SSH add-on (#197)

This commit is contained in:
Mike Degatano 2021-03-23 09:10:11 -04:00 committed by GitHub
parent 09203fde74
commit a9323fe970
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -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`

View file

@ -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}" \