docker-laravel-stack/scripts/fix-perms.sh
2025-10-31 11:29:14 -04:00

31 lines
824 B
Bash
Executable file

#!/bin/bash
# ==============================================
# 🔧 Fix file permissions for Laravel Docker
# ==============================================
current_user=$(whoami)
echo "Setting ACLs for user: $current_user"
# Ensure user exists
if ! id -u "$current_user" > /dev/null 2>&1; then
echo "Error: user '$current_user' does not exist. Exiting."
exit 1
fi
# Apply ACL to ./app
sudo setfacl -R -m u:"$current_user":rwx ./app || echo "⚠️ ACL failed, you may need sudo"
# Fix ownership for all files inside app
sudo chown -R $(id -u):$(id -g) ./app
# Optional: fix storage & cache permissions
if [ -d ./app/workopia/storage ]; then
chmod -R 775 ./app/workopia/storage
fi
if [ -d ./app/workopia/bootstrap/cache ]; then
chmod -R 775 ./app/workopia/bootstrap/cache
fi
echo "✅ Permissions fixed."