/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: 2016-03-19 03:51:23 UTC
  • Revision ID: teddy@recompile.se-20160319035123-53w4dbzdyjef29m1
Server: New tmpfiles.d file for persistent state directory

Provide a tmpfiles.d(5) file for systemd to create persistent state
directory on so-called "volatile" systems.

* Makefile (TMPFILES): New.
  (install-server): Also install "tmpfiles.d-mandos.conf" file as
                    "/usr/lib/tmpfiles.d/mandos.conf".
* tmpfiles.d-mandos.conf: New.

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}/plugins-helpers"
 
73
PLUGINHELPERDIR="${MANDOSDIR}/plugin-helpers"
74
74
HOOKDIR="${MANDOSDIR}/network-hooks.d"
75
75
 
76
76
# Make directories
219
219
    if [ -d "$file" ]; then
220
220
        continue
221
221
    fi
222
 
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
223
 
    chown ${mandos_user}:${mandos_group} \
224
 
        "${DESTDIR}${CONFDIR}/`basename \"$file\"`"
 
222
    case "$file" in
 
223
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
224
            : ;;
 
225
        "*") : ;;
 
226
        *)
 
227
            cp --archive --sparse=always "$file" \
 
228
               "${DESTDIR}${CONFDIR}"
 
229
            chown ${mandos_user}:${mandos_group} \
 
230
                  "${DESTDIR}${CONFDIR}/`basename \"$file\"`"
 
231
            ;;
 
232
    esac
225
233
done
 
234
# Use Diffie-Hellman parameters file if available
 
235
if [ -e "${DESTDIR}${CONFDIR}"/dhparams.pem ]; then
 
236
    sed --in-place \
 
237
        --expression="1i--options-for=mandos-client:--dh-params=${CONFDIR}/dhparams.pem" \
 
238
        "${DESTDIR}/${CONFDIR}/plugin-runner.conf"
 
239
fi
226
240
 
227
241
# /lib/mandos/plugin-runner will drop priviliges, but needs access to
228
242
# its plugin directory and its config file.  However, since almost all
252
266
done
253
267
for dir in "${DESTDIR}"/lib* "${DESTDIR}"/usr/lib*; do
254
268
    if [ -d "$dir" ]; then
255
 
        find "$dir" \! -perm -u+rw,g+r -prune -or -print0 \
256
 
            | xargs --null --no-run-if-empty chmod a+rX
 
269
        find "$dir" \! -perm -u+rw,g+r -prune -or \! -type l -print0 \
 
270
            | xargs --null --no-run-if-empty chmod a+rX --
257
271
    fi
258
272
done