#!/usr/bin/env bash

# Ensure /.composer exists and is writable
if [ ! -d /.composer ]; then
    mkdir /.composer
fi
chmod -R ugo+rw /.composer

# Run a command or supervisord
if [ $# -gt 0 ];then
    # If we passed a command, run it as current user
    exec gosu $WWWUSER "$@"
else
    # Otherwise start supervisord
    /usr/bin/supervisord
fi
