fix: git-sync для detached HEAD, shop-root требует .git

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
shop
2026-05-17 13:24:06 +03:00
parent b7c8d2ed80
commit da77b1f8da
5 changed files with 94 additions and 28 deletions
+11 -5
View File
@@ -1,17 +1,23 @@
#!/bin/bash
# Обновление на сервере: git pull, npm, restart shop
# Запуск из любого места:
# bash /opt/shop/shop10/scripts/server-update.sh
# cd /opt/shop/shop10 && bash scripts/server-update.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=shop-root.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/shop-root.sh"
source "$SCRIPT_DIR/shop-root.sh"
echo "=== Shop update: $SHOP_ROOT ==="
git config --global --add safe.directory "$SHOP_ROOT" 2>/dev/null || true
git pull
if [ ! -d .git ]; then
echo "Ошибка: $SHOP_ROOT не git-репозиторий (нет .git)."
echo "Если код только в /opt/shop/shop10 без git — переустановите:"
echo " mv /opt/shop/shop10 /opt/shop/shop10.bak"
echo " git clone https://git.evilfox.cc/test/shop10.git /opt/shop/shop10"
exit 1
fi
bash "$SCRIPT_DIR/git-sync.sh"
npm install --omit=dev