From 70ade45f02df7878cdb0333f25f2fa9b25015b7e Mon Sep 17 00:00:00 2001 From: Klaus Zipfel Date: Mon, 3 Feb 2025 22:43:14 +0100 Subject: [PATCH] user-init: Safeguarded linking directories via the --no-dereference flag to avoid link-loops. Catching linking of .gitignore and .ssh via a warning, so that s6 does does not crash (and with it, the container) --- vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run b/vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run index 6e560fc4c..1c35507cd 100755 --- a/vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run +++ b/vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run @@ -12,14 +12,14 @@ 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}" \ + ln -sn "/${dir}" "${HOME}/${dir}" \ || bashio::log.warning "Failed linking common directory: ${dir}" done # Some links to old locations, to not mess with the user's muscle memory -ln -s "/config" "${HOME}/config" \ +ln -sn "/config" "${HOME}/config" \ || bashio::log.warning "Failed linking common directory: ${HOME}/config" -ln -s "/config" "/homeassistant" \ +ln -sn "/config" "/homeassistant" \ || bashio::log.warning "Failed linking common directory: /homeassistant" # Store SSH settings in add-on data folder @@ -31,7 +31,7 @@ if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then || bashio::exit.nok \ 'Failed setting permissions on persistent .ssh folder' fi -ln -s "${SSH_USER_PATH}" ~/.ssh +ln -sn "${SSH_USER_PATH}" ~/.ssh || bashio::log.warning "Failed linking .ssh" # Sets up ZSH shell touch "${ZSH_HISTORY_PERSISTANT_FILE}" \ @@ -58,7 +58,7 @@ if ! bashio::fs.file_exists "${GIT_USER_PATH}/.gitconfig"; then touch "${GIT_USER_PATH}/.gitconfig" \ || bashio::exit.nok 'Failed to create .gitconfig' fi -ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig +ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig || bashio::log.warning "Failed linking .gitconfig" # Install user configured/requested packages if bashio::config.has_value 'packages'; then