/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: 2008-09-05 07:11:24 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905071124-9dq11jq5rfd6zfxf
* Makefile: Changed to use symbolic instead of octal modes throughout.
  (KEYDIR): New variable for the key directory.
  (install-server): Bug fix: remove "--parents" from install args.
  (install-client): Bug fix: - '' -  Also create key directory.  Do
                    not chmod plugin dir.  Create custom plugin directory
                    if not the same as normal plugin directory.  Add
                    "--dir" option to "mandos-keygen".  Add note about
                    running "mandos-keygen --password".
  (uninstall-server): Do not depend on the installed server binary,
                      since this made it impossible to do a purge
                      after an uninstall.
  (purge-client): Shred seckey.txt.  Use $(KEYDIR).

* README: Improved wording.

* initramfs-tools-hook: Use a loop to find prefix.  Also find keydir.
                        Remove "${DESTDIR}" from "copy_exec".  Do not
                        try to copy literal "*" if no custom plugins
                        are found.  Copy key files from keydir, not
                        config dir.  Only repair mode on directories
                        that actually exist.  Do not run chmod if
                        nothing needs repairing.

* plugin-runner.conf: New file.

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
 
if [ -d /usr/lib/mandos ]; then
33
 
    prefix=/usr
34
 
elif [ -d /usr/local/lib/mandos ]; then
35
 
    prefix=/usr/local
36
 
else
 
32
for d in /usr /usr/local; do
 
33
    if [ -d "$d"/lib/mandos ]; then
 
34
        prefix="$d"
 
35
        break
 
36
    fi
 
37
done
 
38
if [ -z "$prefix" ]; then
37
39
    # Mandos not found
38
40
    exit 1
39
41
fi
40
42
 
 
43
for d in /etc/keys/mandos /usr/local/lib/mandos/keys; do
 
44
    if [ -d "$d" ]; then
 
45
        keydir="$d"
 
46
        break
 
47
    fi
 
48
done
 
49
if [ -z "$keydir" ]; then
 
50
    # Mandos key directory not found
 
51
    exit 1
 
52
fi
 
53
 
41
54
# The Mandos network client uses the network
42
55
auto_add_modules net
43
56
# The Mandos network client uses IPv6
53
66
mkdir --parents "${DESTDIR}${PLUGINDIR}"
54
67
 
55
68
# Copy the Mandos plugin runner
56
 
copy_exec "$prefix"/lib/mandos/plugin-runner "${DESTDIR}${MANDOSDIR}"
 
69
copy_exec "$prefix"/lib/mandos/plugin-runner "${MANDOSDIR}"
57
70
 
58
71
# Copy the plugins
59
72
 
66
79
    fi
67
80
    case "$base" in
68
81
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-new|*.dpkg-divert) : ;;
 
82
        "*") :;;
69
83
        *) copy_exec "$file" "${PLUGINDIR}";;
70
84
    esac
71
85
done
75
89
    base="`basename \"$file\"`"
76
90
    case "$base" in
77
91
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-new|*.dpkg-divert) : ;;
 
92
        "*") :;;
78
93
        *) copy_exec "$file" "${PLUGINDIR}";;
79
94
    esac
80
95
done
85
100
    copy_exec /usr/bin/gpg
86
101
fi
87
102
 
88
 
# Key files and config files
89
 
for file in /etc/mandos/*; do
 
103
# Config files and key files 
 
104
for file in /etc/mandos/* "$keydir"/*; do
90
105
    if [ -d "$file" ]; then
91
106
        continue
92
107
    fi
115
130
# Reset some other things to sane permissions which we have
116
131
# inadvertently affected with our umask setting.
117
132
for dir in / /bin /etc /keyscripts /sbin /scripts /usr /usr/bin; do
118
 
    chmod a+rX "${DESTDIR}$dir"
 
133
    if [ -d "${DESTDIR}$dir" ]; then
 
134
        chmod a+rX "${DESTDIR}$dir"
 
135
    fi
119
136
done
120
137
for dir in /lib /usr/lib; do
121
138
    find "${DESTDIR}$dir" \! -perm /u+rw,g+r -prune -o -print0 \
122
 
        | xargs --null chmod a+rX
 
139
        | xargs --null --no-run-if-empty chmod a+rX
123
140
done