Admin/website/build/set_perm.bash
author haftmann
Tue, 04 Oct 2005 14:37:06 +0200
changeset 17751 2cc8429943f2
parent 17743 f546af04142a
child 17752 a92cda068ad8
permissions -rwxr-xr-x
better error handling
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17743
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     1
#!/usr/bin/env bash
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     2
# $Id$
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     3
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     4
# set permissions for local files
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     5
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     6
# parameters
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     7
FIND="$1"
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     8
LOCAL_UMASK_FILE="$2"
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
     9
LOCAL_UMASK_DIR="$3"
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    10
LOCAL_GROUP="$4"
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    11
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    12
for file in $("$FIND" .)
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    13
do
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    14
    if [ -O "$file" ]
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    15
    then
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    16
        echo "$file..."
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    17
        if [ -d "$file" ]
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    18
        then
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    19
            chmod "$LOCAL_UMASK_DIR" "$file"
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    20
        else
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    21
            if [ -x "$file" ]
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    22
            then
17751
2cc8429943f2 better error handling
haftmann
parents: 17743
diff changeset
    23
                chmod "$LOCAL_UMASK_FILE",u+x,g+x "$file"
17743
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    24
            else
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    25
                chmod "$LOCAL_UMASK_FILE" "$file"
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    26
            fi
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    27
        fi
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    28
    fi
f546af04142a support for setting local permissions
haftmann
parents:
diff changeset
    29
done