#!/bin/sh
# permfix.sh 0.1
# Copyright (C) 2004-2005 John Eriksson
#
# Description:
# Fixes the permissions in the ogg archive.

# Set the base directory
BASEDIR=/home/dasboot/ogg

# Main loop
for firstdir in "$BASEDIR"/*; do
  if [ -d "$firstdir" ]; then
    chown kohn.users "$firstdir"
    chmod 755 "$firstdir"
    for seconddir in "$firstdir"/*; do
      if [ -d "$seconddir" ]; then
        chown kohn.users "$seconddir"
        chmod 755 "$seconddir"
        for thirddir in "$seconddir"/*; do
          if [ -d "$thirddir" ]; then
            chown kohn.users "$thirddir"
            chmod 755 "$thirddir"
            for songfile in "$thirddir"/*; do
              if [ -f "$songfile" ]; then
                chown kohn.users "$songfile"
                chmod 644 "$songfile"
              fi
            done
          fi
        done
      fi
    done
  fi
done

# EOF

