3
# mewest: Updating indexes of Hyper Estraier
5
# Author: Mitsuo Kuroishi <kuroishi@iij.ad.jp>
6
# Author: Kazu Yamamoto <Kazu@Mew.org>
7
# Created: Jul 20, 2006
8
# Revised: Jul 25, 2006
16
OUTPUT=${OUTPUT:-/dev/null}
17
LOCK=${BASEDIR}/.mewest.lock
22
USAGE: ${PROG} [directory]
34
cleanup_lock_exit () {
39
while getopts "hv" OPTION
53
shift $(($OPTIND - 1))
54
TGTDIR=${1:-${HOME}/Mail}
56
trap cleanup_lock 1 2 3 9 15
58
# create and check lock
59
if ! ${MKDIR} ${LOCK} > /dev/null 2>&1 ; then
65
if [ ! -d ${TGTDIR} ]; then
66
cleanup_lock_exit "${TGTDIR} not found"
69
if [ -d ${BASEDIR}/${INDEXDIR} ]; then
70
echo "Purging old messages..."
71
${ESTCMD} purge ${BASEDIR}/${INDEXDIR} ${TGTDIR} > ${OUTPUT} ||\
72
cleanup_lock_exit "Purging old messages...failed"
73
echo "Purging old messages...done"
76
echo "Indexing new messages..."
77
# "find"'s regular expression is NOT portable, sigh...
78
# "[0-9]*" matches both "123" and "234.mew".
81
-type d -name "trash" -prune -o \
82
-type d -name ${INDEXDIR} -prune -o \
83
-type f \( -name "[0-9]" -o -name "[0-9]*[0-9]" -o -name "*.mew" \) -print |\
84
${ESTCMD} gather -cl -fm -cm -sd -xh ${BASEDIR}/${INDEXDIR} - > ${OUTPUT} ||\
85
cleanup_lock_exit "Indexing new messages...failed"
87
echo "Indexing new messages...done"
94
# Copyright (C) 2006 Mew developing team.
95
# All rights reserved.
97
# Redistribution and use in source and binary forms, with or without
98
# modification, are permitted provided that the following conditions
101
# 1. Redistributions of source code must retain the above copyright
102
# notice, this list of conditions and the following disclaimer.
103
# 2. Redistributions in binary form must reproduce the above copyright
104
# notice, this list of conditions and the following disclaimer in the
105
# documentation and/or other materials provided with the distribution.
106
# 3. Neither the name of the team nor the names of its contributors
107
# may be used to endorse or promote products derived from this software
108
# without specific prior written permission.
110
# THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
111
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
112
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
113
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
114
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
115
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
116
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
117
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
118
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
119
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
120
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.