#!/bin/bash
#                       /usr/local/bin/permissions.crystalfaeries.bluehost
# https://crystalfaeries.net/posix/bin/permissions.crystalfaeries.bluehost
# celeste:crystalfaery PERMISSIONS.CRYSTALFAERIES.BLUEHOST 2020-08-22 18:41:31+00:00
# force cannonical permissions on crystalfaeries.net at bluehost.com
umask 2

cd	"${HOME}"/crystalfaeries.net/	|| exit $?
find .		-type d \! -perm 2775 -print	-exec chmod 2775 {} \;	# dirs
chmod o-rwx	{celeste,linkdoc,src}/			# unpublish
find .		-type f \! -perm  664 -print	-exec chmod  664 {} \;	# files
find .		-type f				-exec chmod go+r {} \;	# publish

cd	 posix/bin		|| exit $?
find . -type f									\
\! -name '*.txt'								\
\! -name '.*.txt'								\
			\! -perm 775		-print -exec	chmod 775 {}	\;
find . -name '.*.txt'	\! -perm 664		-print -exec	chmod 664 {}	\;
find . -name '*.txt'	\! -perm 664		-print -exec	chmod 664 {}	\;
								chmod 775 readme.txt	# faery joke: executable readme
exit $?

