#!/bin/bash
echo "Fixing filesystem permissions..."

if [ -z "$1" ]; then
  bin/clinotty find var vendor pub/static pub/media app/etc \( -type f -or -type d \) -exec chmod u+w {} +;
  bin/clinotty chmod u+x bin/magento
else
  bin/clinotty find "$1" \( -type f -or -type d \) -exec chmod u+w {} +;
fi

echo "Filesystem permissions fixed."