From 6e59552e4f838a8938a19f58c33de829acbc581f Mon Sep 17 00:00:00 2001 From: NixReaper Date: Sat, 11 Apr 2026 08:31:42 -0500 Subject: [PATCH] fix(install): handle pre-existing install dir during git clone The 'Creating directory structure' step runs mkdir -p on INSTALL_DIR before the clone step, so git clone fails if the directory is non-empty. Clone to a temp directory and copy contents into place to preserve any existing data/ and logs/ subdirectories. --- scripts/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 7c2744a..62e7503 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -482,7 +482,12 @@ if [[ -d "$INSTALL_DIR/.git" ]]; then git -C "$INSTALL_DIR" pull --ff-only else info "Cloning repository into $INSTALL_DIR..." - git clone https://github.com/NixReaper/nixpanel-server.git "$INSTALL_DIR" + # The directory may already exist (created by the mkdir step above). + # Clone to a temp dir then copy contents in so data/ and logs/ are preserved. + TMP_CLONE=$(mktemp -d) + git clone https://github.com/NixReaper/nixpanel-server.git "$TMP_CLONE" + cp -a "$TMP_CLONE/." "$INSTALL_DIR/" + rm -rf "$TMP_CLONE" fi success "NixPanel source ready at $INSTALL_DIR"