/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to initramfs-tools-hook

  • Committer: Teddy Hogeborn
  • Date: 2014-08-09 13:12:55 UTC
  • Revision ID: teddy@recompile.se-20140809131255-lp31j98u2pl0xpe6
mandos: Stop using str() and remove unnecessary unicode() calls.

* mandos (if_nametoindex): Use "bytes" literal instead of str().
  (initlogger): Use a unicode string for log device.
  (AvahiError.__unicode__): Removed.
  (DBusPropertyException.__unicode__): - '' -
  (ClientDBus.Secret_dbus_property): Use bytes() instead of str().
  (IPv6_TCPServer.server_bind): Use .encode() instead of str().
  (string_to_delta): Removed unnecessary unicode() call.
  (main): Use "isinstance(x, bytes)" instead of "type(x) is str", use
          .decode() instead of unicode(), and use .encode() instead of
          str().

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
. /usr/share/initramfs-tools/hook-functions
31
31
 
32
 
for d in /usr /usr/local; do
33
 
    if [ -d "$d"/lib/mandos ]; then
34
 
        prefix="$d"
 
32
for d in /usr/lib \
 
33
    "/usr/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null`" \
 
34
    "`rpm --eval='%{_libdir}' 2>/dev/null`" /usr/local/lib; do
 
35
    if [ -d "$d"/mandos ]; then
 
36
        libdir="$d"
35
37
        break
36
38
    fi
37
39
done
38
 
if [ -z "$prefix" ]; then
 
40
if [ -z "$libdir" ]; then
39
41
    # Mandos not found
40
42
    exit 1
41
43
fi
77
79
    --mode=u=rwx "${DESTDIR}${PLUGINDIR}"
78
80
 
79
81
# Copy the Mandos plugin runner
80
 
copy_exec "$prefix"/lib/mandos/plugin-runner "${MANDOSDIR}"
 
82
copy_exec "$libdir"/mandos/plugin-runner "${MANDOSDIR}"
81
83
 
82
84
# Copy the plugins
83
85
 
84
86
# Copy the packaged plugins
85
 
for file in "$prefix"/lib/mandos/plugins.d/*; do
 
87
for file in "$libdir"/mandos/plugins.d/*; do
86
88
    base="`basename \"$file\"`"
87
89
    # Is this plugin overridden?
88
90
    if [ -e "/etc/mandos/plugins.d/$base" ]; then
148
150
done
149
151
 
150
152
# GPGME needs GnuPG
 
153
gpg=/usr/bin/gpg
151
154
libgpgme11_version="`dpkg-query --showformat='${Version}' --show libgpgme11`"
152
 
if dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
 
155
if dpkg --compare-versions "$libgpgme11_version" ge 1.5.0-0.1; then
 
156
    if [ -e /usr/bin/gpgconf ]; then
 
157
        if [ ! -e "${DESTDIR}/usr/bin/gpgconf" ]; then
 
158
            copy_exec /usr/bin/gpgconf
 
159
        fi
 
160
        gpg="`/usr/bin/gpgconf|sed --quiet --expression='s/^gpg:[^:]*://p'`"
 
161
    fi
 
162
elif dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
153
163
    gpg=/usr/bin/gpg2
154
 
else
155
 
    gpg=/usr/bin/gpg
156
164
fi
157
165
if [ ! -e "${DESTDIR}$gpg" ]; then
158
166
    copy_exec "$gpg"