Reimplement createDirectoryIfMissingVerbose to use sensible file permissions
Hopefully should fix ghc ticket #4982. The problem was permissions on directories: previously we used ordinary createDirectory and on unix this creates dirs using the current user's umask. If the root user has a silly umask then someone doing sudo install will end up with dirs that are not readable by non-root users. So the solution is to do the same as we do with files: override the umask and explicitly set the file permissions based on the kind of file: ordinary file, executable file and now also directory. Sadly we also had to re-implement createDirectoryIfMissing to use our new createDirectory wrapper function.