Skip to content

Commit 8a84bb3

Browse files
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) (#922)
1 parent a6ba844 commit 8a84bb3

File tree

1 file changed

+5
-5
lines changed
  • vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user

1 file changed

+5
-5
lines changed

vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ readonly ZSH_HISTORY_PERSISTANT_FILE=/data/.zsh_history
1212

1313
# Links some common directories to the user's home folder for convenience
1414
for dir in "${DIRECTORIES[@]}"; do
15-
ln -s "/${dir}" "${HOME}/${dir}" \
15+
ln -sn "/${dir}" "${HOME}/${dir}" \
1616
|| bashio::log.warning "Failed linking common directory: ${dir}"
1717
done
1818

1919
# Some links to old locations, to not mess with the user's muscle memory
20-
ln -s "/config" "${HOME}/config" \
20+
ln -sn "/config" "${HOME}/config" \
2121
|| bashio::log.warning "Failed linking common directory: ${HOME}/config"
22-
ln -s "/config" "/homeassistant" \
22+
ln -sn "/config" "/homeassistant" \
2323
|| bashio::log.warning "Failed linking common directory: /homeassistant"
2424

2525
# Store SSH settings in add-on data folder
@@ -31,7 +31,7 @@ if ! bashio::fs.directory_exists "${SSH_USER_PATH}"; then
3131
|| bashio::exit.nok \
3232
'Failed setting permissions on persistent .ssh folder'
3333
fi
34-
ln -s "${SSH_USER_PATH}" ~/.ssh
34+
ln -sn "${SSH_USER_PATH}" ~/.ssh || bashio::log.warning "Failed linking .ssh"
3535

3636
# Sets up ZSH shell
3737
touch "${ZSH_HISTORY_PERSISTANT_FILE}" \
@@ -58,7 +58,7 @@ if ! bashio::fs.file_exists "${GIT_USER_PATH}/.gitconfig"; then
5858
touch "${GIT_USER_PATH}/.gitconfig" \
5959
|| bashio::exit.nok 'Failed to create .gitconfig'
6060
fi
61-
ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig
61+
ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig || bashio::log.warning "Failed linking .gitconfig"
6262

6363
# Install user configured/requested packages
6464
if bashio::config.has_value 'packages'; then

0 commit comments

Comments
 (0)