aboutsummaryrefslogtreecommitdiff
path: root/bin/gpg-wrapper
blob: 628f618f6833f4f96ba2f9d89bf9b811d486e3a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/zsh
# gpg-wrapper for users who put their .gnupg on a LUKS (encrypted) device
# Copyright (C) 2009  Ryan Kavanagh <ryanakca@kubuntu.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


mount_point='/media/encrypted'
gpg_path='/usr/bin/gpg'
gnupg_dir=${mount_point}/.gnupg/

# Is there a .gnupg dir on $mount_point? If so, we ought to tell gpg to use
# $mount_point/.gnupg, just in case the user didn't setup symlinks from
# $HOME/.gnupg/ pointing to $mount_point/.gnupg
if [ -d ${gnupg_dir} ]
then
    exec $gpg_path --homedir $gnupg_dir $@

else
    gpg-mounter
    if [ -d ${gnupg_dir} ]
    then
        exec $gpg_path --homedir $gnupg_dir $@
    else
        echo 'No .gnupg dir in $mount_point'
        exit 1
    fi
fi

exit 0