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.
This commit is contained in:
+6
-1
@@ -482,7 +482,12 @@ if [[ -d "$INSTALL_DIR/.git" ]]; then
|
|||||||
git -C "$INSTALL_DIR" pull --ff-only
|
git -C "$INSTALL_DIR" pull --ff-only
|
||||||
else
|
else
|
||||||
info "Cloning repository into $INSTALL_DIR..."
|
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
|
fi
|
||||||
success "NixPanel source ready at $INSTALL_DIR"
|
success "NixPanel source ready at $INSTALL_DIR"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user