summaryrefslogtreecommitdiffstats
path: root/maildir/sharedindexinstall.in
blob: 35544bfe7693fb621d842f1f0c085f30d513095e (plain)
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
#! @SHELL@
#
# Copyright 2004 Double Precision, Inc.
# See COPYING for distribution information.
#
# Sample script to safely update shared folder index files.

prefix="@prefix@"
sysconfdir="@sysconfdir@"

shareddir="$sysconfdir/shared"  # Where the shared index files are kept

newshareddir="$sysconfdir/shared.tmp" # Updated shared index

if test `ls "$newshareddir" | wc -l` = 0
then
	echo "$newshareddir is empty!"
	exit 1   # Sanity check
fi

if test ! -d "$shareddir"
then
	echo "$shareddir does not exist!"
	exit 1
fi

# First, remove obsoleted files

ls "$shareddir" | while read F
do
	test -f "$newshareddir/$F" || rm -f "$shareddir/$F"
done

mv -f "$newshareddir"/* "$shareddir"