Author: johannes
Date: 2007-05-29 09:01:41 -0500 (Tue, 29 May 2007)
New Revision: 9640
Modified:
trunk/gnue-common/packaging/osx/create-build
Log:
Safer way of iterating over all files
Modified: trunk/gnue-common/packaging/osx/create-build
===================================================================
--- trunk/gnue-common/packaging/osx/create-build 2007-05-29 13:56:25 UTC (rev 9639)
+++ trunk/gnue-common/packaging/osx/create-build 2007-05-29 14:01:41 UTC (rev 9640)
@@ -65,44 +65,40 @@
# Apply the proper permissions to all files of the package
# ---------------------------------------------------------------------------
cd "$destdir"
-out="$curdir/out.log"
-
echo "Applying permissions ..."
-for i in `find . -print`
+find . -print | while read filename
do
- real="/$i"
- echo "$i" >> $out
- if [ -e $real ];
+ real="/$filename"
+ if [ -e "$real" ];
then
- data=`stat -f "%u %g %p" $real`
+ data=`stat -f "%u %g %p" "$real"`
+
uid=`echo $data | cut -f1 -d" "`
gid=`echo $data | cut -f2 -d" "`
mod=`echo $data | cut -f3 -d" "`
- chmod $mod $i
- chgrp $gid $i
- chown $uid $i
+ chmod $mod "$filename"
+ chgrp $gid "$filename"
+ chown $uid "$filename"
else
- chown root $i
- chgrp admin $i
+ chown root "$filename"
+ chgrp admin "$filename"
- if [ -d $i ];
+ if [ -d "$filename" ];
then
- chmod 775 $i
- fi
-
- if [ -f $i ];
- then
- if [ -x $i ]; then
- chmod 775 $i
+ chmod 775 "$filename"
+ else
+ if [ -x "$filename" ]; then
+ chmod 775 "$filename"
else
- chmod 664 $i
+ chmod 664 "$filename"
fi
fi
fi
done
+
cd $curdir
# ---------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.