blob: 2d63a8744c8e8a8e20d1c0079afc591c78b41e9d (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/sh
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2009 Fedora Project
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# Anna Bernathova <anicka@novell.com> 2006
# Pavel Nemec <pnemec@novell.com> 2006
# Rex Dieter <rdieter@fedoraproject.org> 2009
#
# use proper binary (pinentry-qt, pinentry-gtk-2 or pinentry-curses)
if [ -z "$PINENTRY_BINARY" ]; then
kde_running=
if [ -n "$KDE_FULL_SESSION" ]; then
kde_running=1
elif [ -n "$DISPLAY" ]; then
xprop -root | grep "^KDE_FULL_SESSION" >/dev/null 2>/dev/null
if test $? -eq 0; then
kde_running=1
fi
else
arg=
display=
for opt in "$@"; do
if [ "$opt" = "--display" ]; then
arg=1
elif [ -n "$arg" ]; then
display="$opt"
else
arg=
fi
done
if [ -n "$display" ]; then
DISPLAY="$display" xprop -root | grep "^KDE_FULL_SESSION" >/dev/null 2>/dev/null
if test $? -eq 0; then
kde_running=1
fi
fi
fi
# if KDE is detected and pinentry-qt exists, use pinentry-qt
if [ -n "$kde_running" -a -x /usr/bin/pinentry-qt4 ]
then
export PINENTRY_BINARY="/usr/bin/pinentry-qt4"
# otherwise test if pinentry-gtk-2 is installed
elif [ -x /usr/bin/pinentry-gtk-2 ]
then
export PINENTRY_BINARY="/usr/bin/pinentry-gtk-2"
# otherwise test if pinentry-qt4 is installed
elif [ -x /usr/bin/pinentry-qt ]
then
export PINENTRY_BINARY="/usr/bin/pinentry-qt"
# otherwise test if pinentry-qt exists although KDE is not detected
elif [ -x /usr/bin/pinentry-qt4 ]
then
export PINENTRY_BINARY="/usr/bin/pinentry-qt4"
# pinentry-curses is installed by default
else
export PINENTRY_BINARY="/usr/bin/pinentry-curses"
fi
fi
exec $PINENTRY_BINARY "$@"
|