#!/bin/bash

# Script to set correct permissions for Hoops Scorebook app
# Place this script in your application directory on the server
# Run it after extracting the deployment package

echo "Setting permissions for Hoops Scorebook application..."

# Set directory permissions to 755 (rwxr-xr-x)
echo "Setting directory permissions to 755..."
find . -type d -exec chmod 755 {} \;

# Set file permissions to 644 (rw-r--r--)
echo "Setting file permissions to 644..."
find . -type f -exec chmod 644 {} \;

# Make server.js executable (755)
echo "Making server.js executable..."
chmod 755 server.js

# Make any shell scripts executable
echo "Making shell scripts executable..."
find . -name "*.sh" -exec chmod 755 {} \;

echo "Permissions have been set successfully!"
echo "You can now restart your Node.js application." 