Docker: update-permissions - alaways check path exists
Docker: update-permissions - alaways check path exists

Add a function `check_if_exists` that ensure that the path you're trying to chown actually exists, just to be sure. We previously had only the registry's data directory checked, as this would not exist unless you had items in the registry. This adds a method for checking _all_ paths, in the off chance the don't exist due to role separation or other means.

The function was added to keep with Don't Repeat Yourself. While it adds a small complexity to the overall script, it cleans up having a ton of individual `[ -e /path]` calls all over the place, and was designed to be a drop-in replacement to the direct call of `chown`.

Also changes the secondary group checks to use `id -g` instead of `id -u`, in case someone had modified the container to a point where the user might not exist, but the group does. While such a case would be confusing and outside support, this removes the assumption that if the user exists, then the group does.

gitlabhq/omnibus-gitlab,gitlabhq/omnibus-gitlab,gitlabhq/omnibus-gitlab,gitlabhq/omnibus-gitlab