Update COPS for DSM5, includes 926

This PR contains additional changes for COPS to work on DSM5, includes PR926.
Should work on DSM4 and DSM5.
Note: I know the permissions part looks ridiculous ;) This is the minimum amount of permissions needed for DSM5 to work. Book directories in the Calibre dir are not affected.

Comments welcome.