summaryrefslogtreecommitdiffstats
path: root/maildir/sharedindexinstall.in
diff options
context:
space:
mode:
authorSam Varshavchik2013-08-19 16:39:41 -0400
committerSam Varshavchik2013-08-25 14:43:51 -0400
commit9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch)
tree7a81a04cb51efb078ee350859a64be2ebc6b8813 /maildir/sharedindexinstall.in
parenta9520698b770168d1f33d6301463bb70a19655ec (diff)
downloadcourier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2
Initial checkin
Imported from subversion report, converted to git. Updated all paths in scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'maildir/sharedindexinstall.in')
-rw-r--r--maildir/sharedindexinstall.in34
1 files changed, 34 insertions, 0 deletions
diff --git a/maildir/sharedindexinstall.in b/maildir/sharedindexinstall.in
new file mode 100644
index 0000000..35544bf
--- /dev/null
+++ b/maildir/sharedindexinstall.in
@@ -0,0 +1,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"