After managed package is installed, post install script is executed under some virtual system user with God permissions. But there are some issues with this type of user when it comes to querying directly permission tables etc.
So we need a way to identify somehow in our business logic that it is this special package user executing logic from post install script context to react appropriately.
I've dumped UserInfo properties from post install script:
DEBUG: [email protected]
DEBUG: fetch user from db by id - users.size=0
Based on this it seems that the most reliable way would be to check if user with such id exists in User table - if no, than it's package user. Any better ideas? Is there more accurate way (prefereably without issuing separate query)?