/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: 2021-02-04 17:59:45 UTC
  • Revision ID: teddy@recompile.se-20210204175945-8druo6d88ipc1z58
Fix issue with french translation

Initial white space was missing in both msgid and msgstr of the french
translation, leading to checking tools reporing an incomplete
translation.  The string is a raw key id, and therefore did not need
translation, so this was never a user-visible issue.

* debian/po/fr.po: Add missing whitespace to the id and translation
  for msgid " ${key_id}".

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
CONFDIR="/conf/conf.d/mandos"
71
71
MANDOSDIR="/lib/mandos"
72
72
PLUGINDIR="${MANDOSDIR}/plugins.d"
 
73
PLUGINHELPERDIR="${MANDOSDIR}/plugin-helpers"
73
74
HOOKDIR="${MANDOSDIR}/network-hooks.d"
74
75
 
75
76
# Make directories
76
77
install --directory --mode=u=rwx,go=rx "${DESTDIR}${CONFDIR}" \
77
78
        "${DESTDIR}${MANDOSDIR}" "${DESTDIR}${HOOKDIR}"
78
79
install --owner=${mandos_user} --group=${mandos_group} --directory \
79
 
    --mode=u=rwx "${DESTDIR}${PLUGINDIR}"
 
80
        --mode=u=rwx "${DESTDIR}${PLUGINDIR}" \
 
81
        "${DESTDIR}${PLUGINHELPERDIR}"
 
82
 
 
83
copy_exec "$libdir"/mandos/mandos-to-cryptroot-unlock "${MANDOSDIR}"
80
84
 
81
85
# Copy the Mandos plugin runner
82
86
copy_exec "$libdir"/mandos/plugin-runner "${MANDOSDIR}"
98
102
    esac
99
103
done
100
104
 
 
105
# Copy the packaged plugin helpers
 
106
for file in "$libdir"/mandos/plugin-helpers/*; do
 
107
    base="`basename \"$file\"`"
 
108
    # Is this plugin overridden?
 
109
    if [ -e "/etc/mandos/plugin-helpers/$base" ]; then
 
110
        continue
 
111
    fi
 
112
    case "$base" in
 
113
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
114
            : ;;
 
115
        "*") : ;;
 
116
        *) copy_exec "$file" "${PLUGINHELPERDIR}" ;;
 
117
    esac
 
118
done
 
119
 
101
120
# Copy any user-supplied plugins
102
121
for file in /etc/mandos/plugins.d/*; do
103
122
    base="`basename \"$file\"`"
109
128
    esac
110
129
done
111
130
 
 
131
# Copy any user-supplied plugin helpers
 
132
for file in /etc/mandos/plugin-helpers/*; do
 
133
    base="`basename \"$file\"`"
 
134
    case "$base" in
 
135
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
136
            : ;;
 
137
        "*") : ;;
 
138
        *) copy_exec "$file" "${PLUGINHELPERDIR}" ;;
 
139
    esac
 
140
done
 
141
 
112
142
# Get DEVICE from initramfs.conf and other files
113
143
. /etc/initramfs-tools/initramfs.conf
114
144
for conf in /etc/initramfs-tools/conf.d/*; do
115
 
    if [ -n `basename \"$conf\" | grep '^[[:alnum:]][[:alnum:]\._-]*$' \
116
 
        | grep -v '\.dpkg-.*$'` ]; then
117
 
        [ -f ${conf} ] && . ${conf}
 
145
    if [ -n "`basename \"$conf\" \
 
146
        | grep '^[[:alnum:]][[:alnum:]\._-]*$' \
 
147
        | grep -v '\.dpkg-.*$'`" ]; then
 
148
        [ -f "${conf}" ] && . "${conf}"
118
149
    fi
119
150
done
120
151
export DEVICE
129
160
    if [ -x "$hook" ]; then
130
161
        # Copy any files needed by the network hook
131
162
        MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=files \
132
 
            VERBOSITY=0 "$hook" files | while read file target; do
 
163
            VERBOSITY=0 "$hook" files | while read -r file target; do
133
164
            if [ ! -e "${file}" ]; then
134
165
                echo "WARNING: file ${file} not found, requested by Mandos network hook '${hook##*/}'" >&2
135
166
            fi
141
172
        done
142
173
        # Copy and load any modules needed by the network hook
143
174
        MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=modules \
144
 
            VERBOSITY=0 "$hook" modules | while read module; do
145
 
            if [ -z "${target}" ]; then
146
 
                force_load "$module"
147
 
            fi
 
175
            VERBOSITY=0 "$hook" modules | while read -r module; do
 
176
            force_load "$module"
148
177
        done
149
178
    fi
150
179
done
158
187
            copy_exec /usr/bin/gpgconf
159
188
        fi
160
189
        gpg="`/usr/bin/gpgconf|sed --quiet --expression='s/^gpg:[^:]*://p'`"
 
190
        gpgagent="`/usr/bin/gpgconf|sed --quiet --expression='s/^gpg-agent:[^:]*://p'`"
 
191
        # Newer versions of GnuPG 2 requires the gpg-agent binary
 
192
        if [ -e "$gpgagent" ] && [ ! -e "${DESTDIR}$gpgagent" ]; then
 
193
            copy_exec "$gpgagent"
 
194
        fi
161
195
    fi
162
196
elif dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
163
197
    gpg=/usr/bin/gpg2
191
225
    if [ -d "$file" ]; then
192
226
        continue
193
227
    fi
194
 
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
195
 
    chown ${mandos_user}:${mandos_group} \
196
 
        "${DESTDIR}${CONFDIR}/`basename \"$file\"`"
 
228
    case "$file" in
 
229
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
230
            : ;;
 
231
        "*") : ;;
 
232
        *)
 
233
            cp --archive --sparse=always "$file" \
 
234
               "${DESTDIR}${CONFDIR}"
 
235
            chown ${mandos_user}:${mandos_group} \
 
236
                  "${DESTDIR}${CONFDIR}/`basename \"$file\"`"
 
237
            ;;
 
238
    esac
197
239
done
 
240
# Use Diffie-Hellman parameters file if available
 
241
if [ -e "${DESTDIR}${CONFDIR}"/dhparams.pem ]; then
 
242
    sed --in-place \
 
243
        --expression="1i--options-for=mandos-client:--dh-params=${CONFDIR}/dhparams.pem" \
 
244
        "${DESTDIR}/${CONFDIR}/plugin-runner.conf"
 
245
fi
198
246
 
199
247
# /lib/mandos/plugin-runner will drop priviliges, but needs access to
200
248
# its plugin directory and its config file.  However, since almost all
205
253
# initrd; it is intended to affect the initrd.img file itself, since
206
254
# it now contains secret key files.  There is, however, no other way
207
255
# to set the permission of the initrd.img file without a race
208
 
# condition.  This umask is set by "initramfs-tools-hook-conf",
209
 
# installed as "/usr/share/initramfs-tools/conf-hooks.d/mandos".)
 
256
# condition.  This umask is set by "initramfs-tools-conf", installed
 
257
# as "/usr/share/initramfs-tools/conf.d/mandos-conf".)
210
258
211
259
for full in "${MANDOSDIR}" "${CONFDIR}"; do
212
260
    while [ "$full" != "/" ]; do
224
272
done
225
273
for dir in "${DESTDIR}"/lib* "${DESTDIR}"/usr/lib*; do
226
274
    if [ -d "$dir" ]; then
227
 
        find "$dir" \! -perm -u+rw,g+r -prune -or -print0 \
228
 
            | xargs --null --no-run-if-empty chmod a+rX
 
275
        find "$dir" \! -perm -u+rw,g+r -prune -or \! -type l -print0 \
 
276
            | xargs --null --no-run-if-empty chmod a+rX --
229
277
    fi
230
278
done