summaryrefslogtreecommitdiffstats
path: root/tools/build/unlock-directory.in
blob: c63ceff88135380cc22da0d71892bbe1a90dea53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!@KSH@
#
# $Id$
#
# Unlock a directory processed by lock_directory
#

# is a particular command available on this machine?
#
cmd_avail()
{
    set -- `type $1 2>&1`
    if [ "$2" = "not" -a "$3" = "found" ] || [ "$3" = "not" -a "$4" = "found" ]
    then
        return 1
    else
        return 0
    fi
}

unlock_directory() {
    ul_dir=$1/.  		# get any symlink out of the way using '.'
    if [ -d $ul_dir ]
    then
        find $ul_dir -type d ! -perm -0222 -print | $XARGS -t chmod +w
    fi
}

# Use gnu xargs if available; faster, more reliable in general
XARGS=xargs
cmd_avail gxargs && XARGS=gxargs

for dir
do
    unlock_directory $dir
done

# Local Variables: ***
# mode:ksh ***
# End: ***