/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: 2013-10-27 00:59:22 UTC
  • Revision ID: teddy@recompile.se-20131027005922-3q2161l63mtxii9u
Add systemd service support for Mandos server.

* Makefile (SYSTEMD): New; systemd system unit directory.
  (install-server): Install mandos.service.
  (purge-server): Remove mandos.service.
* debian/control (Build-Depends): Added "systemd".
* init.d-mandos (Description): Updated.
* mandos.service: New.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# This script will be run by 'mkinitramfs' when it creates the image.
4
4
# Its job is to decide which files to install, then install them into
5
5
# the staging area, where the initramfs is being created.  This
6
 
# happens when a new 'linux-image' package is installed, or when the
 
6
# happens when a new 'linux-image' package is installed, or when an
7
7
# administrator runs 'update-initramfs' by hand to update an initramfs
8
8
# image.
9
9
 
68
68
CONFDIR="/conf/conf.d/mandos"
69
69
MANDOSDIR="/lib/mandos"
70
70
PLUGINDIR="${MANDOSDIR}/plugins.d"
 
71
HOOKDIR="${MANDOSDIR}/network-hooks.d"
71
72
 
72
73
# Make directories
73
74
install --directory --mode=u=rwx,go=rx "${DESTDIR}${CONFDIR}" \
74
 
        "${DESTDIR}${MANDOSDIR}"
 
75
        "${DESTDIR}${MANDOSDIR}" "${DESTDIR}${HOOKDIR}"
75
76
install --owner=${mandos_user} --group=${mandos_group} --directory \
76
77
    --mode=u=rwx "${DESTDIR}${PLUGINDIR}"
77
78
 
106
107
    esac
107
108
done
108
109
 
109
 
# GPGME needs /usr/bin/gpg
110
 
if [ ! -e "${DESTDIR}/usr/bin/gpg" \
111
 
    -a -n "`ls \"${DESTDIR}\"/usr/lib/libgpgme.so* \
112
 
                2>/dev/null`" ]; then
113
 
    copy_exec /usr/bin/gpg
114
 
fi
 
110
# Get DEVICE from initramfs.conf and other files
 
111
. /etc/initramfs-tools/initramfs.conf
 
112
for conf in /etc/initramfs-tools/conf.d/*; do
 
113
    if [ -n `basename \"$conf\" | grep '^[[:alnum:]][[:alnum:]\._-]*$' \
 
114
        | grep -v '\.dpkg-.*$'` ]; then
 
115
        [ -f ${conf} ] && . ${conf}
 
116
    fi
 
117
done
 
118
export DEVICE
 
119
 
 
120
# Copy network hooks
 
121
for hook in /etc/mandos/network-hooks.d/*; do
 
122
    case "`basename \"$hook\"`" in
 
123
        "*") continue ;;
 
124
        *[!A-Za-z0-9_.-]*) continue ;;
 
125
        *) test -d "$hook" || copy_exec "$hook" "${HOOKDIR}" ;;
 
126
    esac
 
127
    if [ -x "$hook" ]; then
 
128
        # Copy any files needed by the network hook
 
129
        MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=files \
 
130
            VERBOSITY=0 "$hook" files | while read file target; do
 
131
            if [ ! -e "${file}" ]; then
 
132
                echo "WARNING: file ${file} not found, requested by Mandos network hook '${hook##*/}'" >&2
 
133
            fi
 
134
            if [ -z "${target}" ]; then
 
135
                copy_exec "$file"
 
136
            else
 
137
                copy_exec "$file" "$target"
 
138
            fi
 
139
        done
 
140
        # Copy and load any modules needed by the network hook
 
141
        MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=modules \
 
142
            VERBOSITY=0 "$hook" modules | while read module; do
 
143
            if [ -z "${target}" ]; then
 
144
                force_load "$module"
 
145
            fi
 
146
        done
 
147
    fi
 
148
done
 
149
 
 
150
# GPGME needs GnuPG
 
151
libgpgme11_version="`dpkg-query --showformat='${Version}' --show libgpgme11`"
 
152
if dpkg --compare-versions "$libgpgme11_version" ge 1.4.1-0.1; then
 
153
    gpg=/usr/bin/gpg2
 
154
else
 
155
    gpg=/usr/bin/gpg
 
156
fi
 
157
if [ ! -e "${DESTDIR}$gpg" ]; then
 
158
    copy_exec "$gpg"
 
159
fi
 
160
unset gpg
 
161
unset libgpgme11_version
115
162
 
116
163
# Config files
117
164
for file in /etc/mandos/plugin-runner.conf; do
131
178
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
132
179
fi
133
180
 
134
 
# Key files 
 
181
# Key files
135
182
for file in "$keydir"/*; do
136
183
    if [ -d "$file" ]; then
137
184
        continue