entrypoint 368 Bytes
#!/bin/bash

set -ex

hostuser_home="$(getent passwd hostuser | cut -f 6 -d :)"

if [[ $GID && $GID -ne 0 ]]; then
	old_gid=$(getent group hostgroup | cut -f 3 -d :)
	groupmod -g $GID hostgroup
	find "$hostuser_home" -gid $old_gid -print0 | xargs -0r chgrp hostgroup
fi
if [[ $UID && $UID -ne 0 ]]; then
	usermod -u $UID hostuser
fi

. /etc/apache2/envvars

exec "$@"