From a28a6e50076483f275210175ee9ff38f655f3d7d Mon Sep 17 00:00:00 2001 From: Stephen Klein Date: Sun, 20 Jul 2025 08:07:52 -0400 Subject: [PATCH] Fix homelab directory detection when running with sudo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running with sudo, $HOME becomes /root instead of the actual user's home. Use $SUDO_USER to get the original user's home directory for HOPS deployment. Fixes: ERROR: Homelab directory not found: /root/hops 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- install | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install b/install index b64f2bb..6885c2e 100755 --- a/install +++ b/install @@ -665,7 +665,13 @@ EOF log "🚀 Starting deployment..." # Ensure we're in the correct directory - local HOMELAB_DIR="$HOME/hops" + # When running with sudo, use the original user's home directory + local HOMELAB_DIR + if [[ -n "$SUDO_USER" ]]; then + HOMELAB_DIR="$(eval echo ~$SUDO_USER)/hops" + else + HOMELAB_DIR="$HOME/hops" + fi if [[ ! -d "$HOMELAB_DIR" ]]; then error_exit_with_rollback "Homelab directory not found: $HOMELAB_DIR" fi