~ubuntu-branches/debian/sid/ecryptfs-utils/sid

« back to all changes in this revision

Viewing changes to src/utils/ecryptfs-dot-private

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-04-25 09:49:00 UTC
  • mto: (1.4.1 upstream) (13.1.3 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20090425094900-29zmexzvikuoapgc
Tags: upstream-74
ImportĀ upstreamĀ versionĀ 74

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
#
 
3
#    ecryptfs-dot-private
 
4
#    Copyright (C) 2009 Canonical Ltd.
 
5
#
 
6
#    Authors: Dustin Kirkland <kirkland@canonical.com>
 
7
#
 
8
#    This program is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU General Public License as published by
 
10
#    the Free Software Foundation, version 2 of the License.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU General Public License
 
18
 
 
19
if echo "$0" | grep -qs "ecryptfs"; then
 
20
        echo "ERROR: This file must be sourced, rather than executed:"
 
21
        echo
 
22
        echo "  . $0"
 
23
        echo
 
24
        exit 1
 
25
fi
 
26
 
 
27
# Hacky, umount.ecryptfs_private should be taught to exit 1 on
 
28
# unsuccessful unmount, must check who else depends on this exit code.
 
29
if /sbin/umount.ecryptfs_private | grep -v "Sessions still open"; then
 
30
        cd "$HOME"/.Private
 
31
else
 
32
        echo "ERROR: Unable to access .Private, please close some sessions"
 
33
fi
 
34
/sbin/mount.ecryptfs_private