From f48bb9b136a8b0f92c2d8121946f709e53a17eec Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Mon, 21 Jul 2025 16:15:34 -0400 Subject: [PATCH] fix(entrypoint.sh): Avoid error if rustup is not installed Only move `/root/.rustup` and `/root/.cargo` directories if they exist. This prevents errors when re-using the script in environments where Rust is not installed (e.g. https://github.com/dockbuild/dockbuild). Previously, `mv` would fail if either directory was missing: ``` mv: cannot stat '/root/.rustup': No such file or directory mv: cannot stat '/root/.cargo': No such file or directory ``` --- imagefiles/entrypoint.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/imagefiles/entrypoint.sh b/imagefiles/entrypoint.sh index e81144b..28c2378 100755 --- a/imagefiles/entrypoint.sh +++ b/imagefiles/entrypoint.sh @@ -33,7 +33,12 @@ if [[ -n $BUILDER_UID ]] && [[ -n $BUILDER_GID ]]; then export HOME=/home/${BUILDER_USER} shopt -s dotglob # Move rustup/cargo directories as they are large, and not needed as root - mv -t $HOME/ /root/.rustup /root/.cargo + if [[ -d /root/.rustup ]]; then + mv -t $HOME/ /root/.rustup + fi + if [[ -d /root/.cargo ]]; then + mv -t $HOME/ /root/.cargo + fi # Copy the rest cp -r /root/* $HOME/ chown -R $BUILDER_UID:$BUILDER_GID $HOME