#!/bin/env bash

PUID="${PUID:-1000}"
PGID="${PGID:-1000}"

setperms(){
    echo "Setting permissions to UID:${PUID} and GID:${PGID}"
    usermod -u ${PUID} minecraft > /dev/null 2>&1
    groupmod -g ${PGID} minecraft > /dev/null 2>&1
    chown -R ${PUID}:${PGID} /data > /dev/null 2>&1
    sleep 2
}

setperms

su -c "mc" minecraft