bugfixing
This commit is contained in:
parent
f0ffadfa27
commit
0b05db1beb
@ -37,7 +37,6 @@ usage () {
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ "${#}" -ne 1 ]; then
|
||||
echo "Please provide exactly one parameter!"
|
||||
echo
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
@ -48,7 +47,6 @@ fi
|
||||
#-------------------------------------------------------------------------------
|
||||
if ! file "${1}" | grep -F "EWF" > /dev/null ; then
|
||||
echo "Please provide EWF image!"
|
||||
echo
|
||||
usage
|
||||
exit 3
|
||||
fi
|
||||
@ -58,6 +56,9 @@ readonly IMG="${1}"
|
||||
#-------------------------------------------------------------------------------
|
||||
# Find and set home directory:
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Searching for /home... please wait..."
|
||||
|
||||
PRE="./recovered"
|
||||
offsets="$( mmls -aM "${IMG}" \
|
||||
| awk '/^[[:digit:]]{3}:/ { print $3; }' \
|
||||
| sed 's/0*//' )"
|
||||
@ -67,7 +68,7 @@ for offset in ${offsets} ; do
|
||||
then
|
||||
home=""
|
||||
readonly S_PRE=""
|
||||
readonly T_PRE="./recovered/home"
|
||||
readonly T_PRE="${PRE}/home"
|
||||
readonly OFS="${offset}"
|
||||
elif fsstat -o "${offset}" "${IMG}" \
|
||||
| grep -E "^Last mounted on: /$" > /dev/null
|
||||
@ -75,7 +76,7 @@ for offset in ${offsets} ; do
|
||||
home="$( ifind -o "${offset}" -n "/home" "${IMG}" )"
|
||||
if [ "${home}" != "File not found" ] ; then
|
||||
readonly S_PRE="/home"
|
||||
readonly T_PRE="./recovered"
|
||||
readonly T_PRE="${PRE}"
|
||||
readonly OFS="${offset}"
|
||||
fi
|
||||
else
|
||||
@ -110,6 +111,8 @@ readonly DIRS="${DIRS} ${S_PRE}/${user}/${CACHE}/"
|
||||
#-------------------------------------------------------------------------------
|
||||
# ... magic ...
|
||||
#-------------------------------------------------------------------------------
|
||||
echo "Extracting folders and files... please wait..."
|
||||
|
||||
for DIR in ${DIRS} ; do
|
||||
#-----------------------------------------------------------------------------
|
||||
# Store inode of DIR as start:
|
||||
@ -128,18 +131,20 @@ for DIR in ${DIRS} ; do
|
||||
#-----------------------------------------------------------------------------
|
||||
# Create target folder structure recursively:
|
||||
#-----------------------------------------------------------------------------
|
||||
IFS=$'\n'
|
||||
for dir in ${dirs} ; do
|
||||
path="$( echo "${dir}" | cut -d "|" -f 2 )"
|
||||
|
||||
# the subfolder between "cur" and the mail kill the RFC
|
||||
if ! echo ${path} \
|
||||
| grep -E ".*/\.cache/evolution/mail/.*/folders/.*/cur/.*" > /dev/null
|
||||
if ! echo "${path}" \
|
||||
| grep -E ".*/(cur|new|tmp)/.*" > /dev/null
|
||||
then
|
||||
if ! [ -d "${path}" ] ; then
|
||||
if ! [ -d "${T_PRE}${path}" ] ; then
|
||||
mkdir -p "${T_PRE}${path}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Store file names recursively under start pipe separated as files:
|
||||
@ -149,40 +154,41 @@ for DIR in ${DIRS} ; do
|
||||
#-----------------------------------------------------------------------------
|
||||
# Extract files recursively into target folder(s):
|
||||
#-----------------------------------------------------------------------------
|
||||
IFS=$'\n'
|
||||
for file in ${files} ; do
|
||||
inode="$( echo "${file}" | cut -d "|" -f 3 )"
|
||||
name="$( echo "${file}" | cut -d "|" -f 2 )"
|
||||
|
||||
if ! echo ${name} \
|
||||
| grep -E ".*/\.cache/evolution/mail/.*/folders/.*/cur/.*/.*" > /dev/null
|
||||
if ! echo "${name}" \
|
||||
| grep -E ".*/(cur|new|tmp)/.*/.*" > /dev/null
|
||||
then
|
||||
icat -o "${OFS}" "${IMG}" "${inode}" > "${T_PRE}${name}"
|
||||
# Maildir format incl. colons is not possible with ntfs!
|
||||
icat -o "${OFS}" "${IMG}" "${inode}" > "${T_PRE}${name/:/..}"
|
||||
else
|
||||
left="$( echo "${name}" | sed -E 's#(/cur|new|tmp)/.*#\1#' )"
|
||||
right="$( echo "${name}" | sed -E 's#.*/(cur|new|tmp)/##' )"
|
||||
# replace the last slash with a hyphen
|
||||
icat -o "${OFS}" "${IMG}" "${inode}" > "${T_PRE}${name%/*}-${name##*/}"
|
||||
icat -o "${OFS}" "${IMG}" "${inode}" > "${T_PRE}${left}/${right//\//-}"
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Index the local mail storage:
|
||||
# Index the local and external mail storage:
|
||||
#-------------------------------------------------------------------------------
|
||||
if [ -d "${T_PRE}${S_PRE}/${user}/${LOCAL}" ] ; then
|
||||
mu index --quiet --muhome=./mu --maildir="${T_PRE}${S_PRE}/${user}/${LOCAL}"
|
||||
fi
|
||||
echo "Indexing mails... please wait..."
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Index the external mail storage(s):
|
||||
#-------------------------------------------------------------------------------
|
||||
accounts="$( find -E "${T_PRE}${S_PRE}/${user}/${CACHE}" -type d -depth 1 \
|
||||
-iregex ".*/[[:xdigit:]]{40}" -exec basename '{}' \; )"
|
||||
for account in ${accounts} ; do
|
||||
folders="$( find -E "${T_PRE}${S_PRE}/${user}/${CACHE}/${account}/folders" \
|
||||
-type d -depth 1 -exec basename '{}' \; )"
|
||||
for folder in ${folders} ; do
|
||||
mu index --quiet --muhome=./mu \
|
||||
--maildir="${T_PRE}${S_PRE}/${user}/${CACHE}/${account}/folders/${folder}"
|
||||
done
|
||||
mailboxes="$( find "${T_PRE}${S_PRE}/${user}" \
|
||||
-type d -regex ".*\(cur\|new\|tmp\)" -exec dirname '{}' \; )"
|
||||
|
||||
IFS=$'\n'
|
||||
for mailbox in ${mailboxes} ; do
|
||||
# \""${mailbox}\"" because: spaces are more evil as expected
|
||||
mu index --quiet --muhome="${PRE}/mu" --maildir=\""${mailbox}\""
|
||||
done
|
||||
unset IFS
|
||||
|
||||
echo "Done."
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user