3
# ecryptfs-find - use inode numbers to match encrypted/decrypted filenames
4
# Copyright (C) 2011 Dustin Kirkland
5
# Copyright (C) 2011 Sergio Mena de la Cruz
7
# Authors: Dustin Kirkland <kirkland@ubuntu.com>
8
# Sergio Mena de la Cruz
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation, version 2 of the License.
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
22
if [ ! -e "$1" ]; then
23
echo "ERROR: [$1] not found" 1>&2
27
# Use one utility for both directions; same method is used
29
*ECRYPTFS_FNEK_ENCRYPTED.*)
37
# Grab the target inode number
38
inum=$(ls -aid "$1" | awk '{print $1}')
41
# Process /proc/mounts
42
while read lower upper fstype opts dump pass; do
43
[ "$fstype" = "ecryptfs" ] || continue
44
if [ "$direction" = "encrypt" ]; then
49
# Match against filesystem or mountpoint, build list of
51
if [ -r "$find" ] && [ -x "$find" ]; then
52
mounts="$mounts $find"
58
find "$m/" -inum "$inum"