From 6344171c62038d42e431756113d35c15a0e2c556 Mon Sep 17 00:00:00 2001 From: Michael Simard Date: Thu, 22 Jan 2026 09:44:36 -0600 Subject: [PATCH] Fix deploy.sh for existing non-git directory Handle case where remote directory exists but is not a git repository. Backs up config.js, removes directory, clones fresh, restores config.js. Co-Authored-By: Claude Opus 4.5 --- deploy.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/deploy.sh b/deploy.sh index 72c962f..af94b3b 100755 --- a/deploy.sh +++ b/deploy.sh @@ -31,6 +31,20 @@ if [ -d "${REMOTE_PATH}/.git" ]; then echo "Repository exists, pulling latest changes..." cd ${REMOTE_PATH} git pull +elif [ -d "${REMOTE_PATH}" ]; then + echo "Directory exists but is not a git repo, converting..." + # Backup config.js if it exists + if [ -f "${REMOTE_PATH}/config.js" ]; then + cp "${REMOTE_PATH}/config.js" /tmp/unraid-dash-config.js.bak + fi + rm -rf ${REMOTE_PATH} + git clone ${GIT_REPO} ${REMOTE_PATH} + cd ${REMOTE_PATH} + # Restore config.js if backed up + if [ -f /tmp/unraid-dash-config.js.bak ]; then + mv /tmp/unraid-dash-config.js.bak ${REMOTE_PATH}/config.js + echo "Restored config.js" + fi else echo "Cloning repository..." git clone ${GIT_REPO} ${REMOTE_PATH}