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 <noreply@anthropic.com>
This commit is contained in:
14
deploy.sh
14
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}
|
||||
|
||||
Reference in New Issue
Block a user