Newer
Older
set -eu
[ "$(id -u)" = "0" ] || { echo "Not running as root, continuing as the current user."; eval exec "$@"; }
command -v stat > /dev/null || { echo "Can't find stat, exiting."; exit 1; }
command -v gosu > /dev/null || { echo "Can't find gosu, exiting."; exit 1; }
uid="$(stat Podcasts -c '%u')"
gid="$(stat Podcasts -c '%g')"
eval exec gosu "$uid:$gid" "$@"