fixe
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Ehsan.Asadi
2025-12-31 10:41:49 +03:30
parent 846c41111f
commit 1043d9902f
2 changed files with 56 additions and 9 deletions

View File

@@ -4,12 +4,46 @@ set -e
# Validate node_modules permissions before starting
if [ -d /app/peikarband/.web/node_modules/.bin ]; then
echo "Checking node_modules/.bin permissions..."
if [ ! -x /app/peikarband/.web/node_modules/.bin/react-router ]; then
echo "WARNING: react-router is not executable, attempting to fix..."
chmod +x /app/peikarband/.web/node_modules/.bin/* 2>/dev/null || true
echo "Permission fix attempted (may fail if running as non-root)"
REACT_ROUTER_BIN="/app/peikarband/.web/node_modules/.bin/react-router"
# Check if react-router exists
if [ -e "$REACT_ROUTER_BIN" ]; then
# If it's a symlink, check and fix the target
if [ -L "$REACT_ROUTER_BIN" ]; then
TARGET=$(readlink -f "$REACT_ROUTER_BIN")
echo "react-router is a symlink pointing to: $TARGET"
if [ -f "$TARGET" ] && [ ! -x "$TARGET" ]; then
echo "WARNING: Target file is not executable, attempting to fix..."
chmod +x "$TARGET" 2>/dev/null || true
fi
fi
# Fix permissions for react-router itself (file or symlink)
if [ ! -x "$REACT_ROUTER_BIN" ]; then
echo "WARNING: react-router is not executable, attempting to fix..."
chmod +x "$REACT_ROUTER_BIN" 2>/dev/null || true
fi
# Fix all .bin files and their symlink targets
echo "Fixing permissions for all .bin files and symlink targets..."
find /app/peikarband/.web/node_modules/.bin -type f -exec chmod +x {} \; 2>/dev/null || true
find /app/peikarband/.web/node_modules/.bin -type l | while read symlink; do
target=$(readlink -f "$symlink" 2>/dev/null || true)
if [ -n "$target" ] && [ -f "$target" ]; then
chmod +x "$target" 2>/dev/null || true
fi
chmod +x "$symlink" 2>/dev/null || true
done
# Verify react-router is executable
if [ -x "$REACT_ROUTER_BIN" ]; then
echo "✅ react-router is executable"
else
echo "⚠️ WARNING: react-router may still not be executable (running as non-root)"
fi
else
echo " react-router is executable"
echo "⚠️ WARNING: react-router binary not found"
fi
fi