#!/bin/bash

. locations.include

echo "Устанавливаются права"

DIR='$TREEDIR/$ARCH'
if [ "$#" != "0" ]; then
    DIR=$1
fi
echo $DIR

echo find $DIR ! \( -user root -a -group root \) -exec chown root.root {} \;
find $DIR ! \( -user root -a -group root \) -exec chown root.root {} \;

find $DIR -type d ! \( -perm 755 \) -exec chmod 755 {} \;

find $DIR -type f ! \( -perm 644 -o -perm 755 \) | \
     grep -v scripts | grep -v autorun | xargs --no-run-if-empty chmod 644
