commit 8f6c54042e14001138a8dfbc8afbc0891be308fa
parent 85e0d21c7904bcb353295d891e884e67f7e74990
Author: Jaromil <jaromil@dyne.org>
Date: Wed, 26 Sep 2012 18:19:39 +0200
fix to find on OSX
Diffstat:
7 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/build/build-osx.sh b/build/build-osx.sh
@@ -69,6 +69,7 @@ copydeps() {
done # 1st
cp $1 build/osx/`basename $1`.bin
+ strip build/osx/`basename $1`.bin
for d in `cat $tmp | sort | uniq`; do
if ! [ -r build/osx/dylib/`basename $d` ]; then
cp $d build/osx/dylib/
@@ -199,6 +200,7 @@ fi
cp -v src/dotlock build/osx/
copydeps ${root}/src/mutt-1.5.21/mutt-jaro
copydeps ${root}/src/mutt-1.5.21/pgpewrap
+ copydeps /opt/local/bin/gfind
copydeps /opt/local/bin/msmtp
copydeps /opt/local/bin/pinentry
copydeps /opt/local/bin/abook
diff --git a/src/jaro b/src/jaro
@@ -222,12 +222,12 @@ cleanexit() {
}
# first delete dirs
- for d in `find -O3 $TMPDIR/ -maxdepth 1 -type d`; do
+ for d in `${=find} $TMPDIR/ -maxdepth 1 -type d`; do
{ test "$d" = "$TMPDIR/" } || { ${=rm} -r ${d} }
done
# then locks, with a warning
- for l in `find -O3 $TMPDIR/ -maxdepth 1 -type f -name '*.lock'`; do
+ for l in `${=find} $TMPDIR/ -maxdepth 1 -type f -name '*.lock'`; do
lname=`basename ${(s:.lock:)l}`
func "cleaning lock for $lname"
@@ -277,6 +277,13 @@ check_bin() {
}
done
+ # which find command to use
+ case $OS in
+ GNU) find="find -O3" ;;
+ MAC) find="gfind -O3" ;;
+ *) find="find"
+ esac
+
# which wipe command to use
if command -v wipe > /dev/null; then
rm="wipe -f -s -q -R /dev/urandom"
diff --git a/src/zlibs/accounts b/src/zlibs/accounts
@@ -38,7 +38,7 @@ EOF
}
list_accounts() {
- for a in `find $WORKDIR/Accounts -type f | grep -v README | sed 's/.txt//'`; do
+ for a in `${=find} $WORKDIR/Accounts -type f | grep -v README | sed 's/.txt//'`; do
act -n "`basename $a`\t :: "
awk '
/^name/ { for(i=2;i<=NF;i++) printf "%s ", $i }
@@ -73,7 +73,7 @@ read_account() {
# find the file
func "read_account looking for ${type} ${account}"
- for a in `find $WORKDIR/Accounts -name "$type.$account*"`; do
+ for a in `${=find} $WORKDIR/Accounts -name "$type.$account*"`; do
func "found account: $a"
all+=($a)
done
diff --git a/src/zlibs/email b/src/zlibs/email
@@ -72,7 +72,7 @@ queue() {
fetchall() {
notice "Fetching all accounts in $MAILDIRS"
res=0
- for i in `find $WORKDIR/Accounts -type f | grep -v README`; do
+ for i in `${=find} $WORKDIR/Accounts -type f | grep -v README`; do
account=`basename $i`
account_type=`print $account | cut -d. -f1`
account=`print $account | cut -d. -f2`
@@ -252,7 +252,7 @@ password ${password}
EOF
unset password
- for mail in `find $MAILDIRS/outbox -name "*.mail"`; do
+ for mail in `${=find} $MAILDIRS/outbox -name "*.mail"`; do
smtp=`print ${mail} | sed -e 's/mail/msmtp/'`
lock ${smtp}
recipients="`cat ${smtp}`"
diff --git a/src/zlibs/filters b/src/zlibs/filters
@@ -357,7 +357,7 @@ EOF
if header :contains "To" [
EOF
typeset -alU recv
- for f in `find $WORKDIR/Accounts/ -type f | grep -v 'smtp'`; do
+ for f in `${=find} $WORKDIR/Accounts/ -type f | grep -v 'smtp'`; do
for addr in `cat $f | awk '
/^email/ { print $2 }
/^alias/ { print $2 }
diff --git a/src/zlibs/maildirs b/src/zlibs/maildirs
@@ -60,7 +60,7 @@ maildirmake() {
# fills up all maildirs array
list_maildirs() {
maildirs=()
- for m in `find -O3 $MAILDIRS/* -maxdepth 1 -type d | awk '
+ for m in `${=find} $MAILDIRS/* -maxdepth 1 -type d | awk '
/cur$/ {next}
/tmp$/ {next}
/new$/ {next}
@@ -69,7 +69,7 @@ list_maildirs() {
{ maildircheck $m } && {
# is a maildir
- { test "`find -O3 $m -type f`" != "" } && {
+ { test "`${=find} $m -type f`" != "" } && {
# and is not empty
maildirs+=(`basename $m`)
}
@@ -125,7 +125,7 @@ rmdupes() {
c=0
notice "Checking for duplicates in folder: `basename $folder`"
msgs=()
- for m in `find ${folder} -type f`; do
+ for m in `${=find} ${folder} -type f`; do
msgs+=($m)
done
act "${#msgs} messages to check"
@@ -163,21 +163,21 @@ merge() {
notice "Merging maildir ${src} into ${dst}"
c=0
- for i in `find ${src}/cur -type f`; do
+ for i in `${=find} ${src}/cur -type f`; do
mv $i ${dst}/cur/; c=$(($c + 1))
{ test $? = 0 } || {
error "error moving file: $i"
error "merge aborted."
return 1 }
done
- for i in `find ${src}/new -type f`; do
+ for i in `${=find} ${src}/new -type f`; do
mv $i ${dst}/new/; c=$(($c + 1))
{ test $? = 0 } || {
error "error moving file: $i"
error "merge aborted."
return 1 }
done
- for i in `find ${src}/tmp -type f`; do
+ for i in `${=find} ${src}/tmp -type f`; do
mv $i ${dst}/tmp/; c=$(($c + 1))
{ test $? = 0 } || {
error "error moving file: $i"
@@ -226,7 +226,7 @@ filter() {
notice "Filtering folder $folder"
# first index current state
- for m in `find $folder -type f`; do fall+=($m); done
+ for m in `${=find} $folder -type f`; do fall+=($m); done
done
{ test ${#fall} = 0 } && {
diff --git a/src/zlibs/stats b/src/zlibs/stats
@@ -47,7 +47,7 @@ stats() {
fold+=($pfx)
# how big?
- tot+=("`find $MAILDIRS/$pfx* -type f | wc -l`")
+ tot+=("`${=find} $MAILDIRS/$pfx* -type f | wc -l`")
grandtot="$(( $grandtot + ${tot[${#tot}]} ))"
done
# calculate screen size and bigger tot
@@ -100,7 +100,7 @@ EOF
func " ${m}"
rm -rf $TMPDIR/weekstats.db.mdir
cp -r $MAILDIRS/${m} $TMPDIR/weekstats.db.mdir
- for f in `find $TMPDIR/weekstats.db.mdir -type f`; do
+ for f in `${=find} $TMPDIR/weekstats.db.mdir -type f`; do
timestamp=`fetchdate "%Y-%U" ${f}`
mdir=`print $m|cut -d. -f1`
cat <<EOF | ${SQL} -batch $db > $sql
@@ -199,7 +199,7 @@ EOF
return 1 }
for m in ${maildirs}; do
- for f in `find $MAILDIRS/${m} -type f`; do
+ for f in `${=find} $MAILDIRS/${m} -type f`; do
timestamp=`fetchdate "%Y-%m-%d" ${f}`
cat <<EOF | ${SQL} -batch $TMPDIR/timecloud.db.$id > $TMPDIR/timecloud.select.$id
SELECT * FROM stats