#!/usr/bin/env bash

if [ "$UID" != "0" ]; then
  echo "error: must run this as root. hint: sudo"
  exit 1
fi

# make dirs writable for all users, also for lighttpd cgi server
find /media/ZYD82805_24TB/cas/ -type d -print0 | xargs -0 chmod a+w

# make files writable for nobody = read only
# note: /media/ZYD82805_24TB/cas/todo/ also contains tempfiles
# these must keep writable
find /media/ZYD82805_24TB/cas/btih/ -type f -print0 | xargs -0 chmod a-w