annotate contrib/moz-script @ 355:d1f930be4711

From Jeffrey Morlan: pst_build_id_ptr and pst_build_desc_ptr require that the first child of a BTree page have the same starting ID as itself. This is not required by the spec, and is not true in many real-world PSTs (presumably, the original first child of the page got deleted). Because of this, many emails are not being extracted from these PSTs. It also triggers an infinite loop in lspst (a separate bug, also fixed)
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:12:22 -0700
parents c508ee15dfca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
1 #!/bin/bash
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
2
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
3 # Helper script to convert to Mozilla mail format
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
4 # Author: David Binard <binard@users.sf.net>
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
5
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
6 # Taken from: <http://sourceforge.net/tracker/index.php?func=detail&aid=938792&group_id=18756&atid=318756>
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
7 # Note: this assumes readpst was run with the -r
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
8 # (recursive) option.
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
9
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
10
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
11 if [ "$#" != 1 ]; then
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
12 echo "Usage: `basename $0` <folder>"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
13 exit 1
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
14 fi
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
15
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
16 process_dir() {
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
17 echo Processing directory "$1"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
18 for item in "$1/"*; do
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
19 if [ -d "$item" ]; then
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
20 mv "$item" "$item.sbd"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
21 touch "$item"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
22 process_dir "$item.sbd"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
23 elif [ "`basename \"$item\"`" = mbox ]; then
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
24 mv "$item" "${item%%.sbd/mbox}"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
25 else
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
26 echo ERROR: invalid item "$item"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
27 exit 1
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
28 fi
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
29 done
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
30 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
31
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
32 item="$1"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
33 mv "$item" "$item.sbd"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
34 touch "$item"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
35 process_dir "$item.sbd"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
36