/mandos/release

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

« back to all changes in this revision

Viewing changes to initramfs-tools-hook

* network-hooks.d: New directory.
* network-hooks.d/bridge: New example hook.
* network-hooks.d/bridge.conf: Config file for bridge example hook.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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}" \
90
91
    case "$base" in
91
92
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
92
93
            : ;;
93
 
        */"*")
94
 
            echo "W: Mandos client plugin directory is empty." >&2 ;;
 
94
        "*") echo "W: Mandos client plugin directory is empty." >&2 ;;
95
95
        *) copy_exec "$file" "${PLUGINDIR}" ;;
96
96
    esac
97
97
done
102
102
    case "$base" in
103
103
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
104
104
            : ;;
105
 
        */"*") : ;;
 
105
        "*") : ;;
106
106
        *) copy_exec "$file" "${PLUGINDIR}" ;;
107
107
    esac
108
108
done
109
109
 
 
110
# Copy network hooks
 
111
for hook in /etc/mandos/network-hooks.d/*; do
 
112
    case "`basename \"$hook\"`" in
 
113
        "*") continue ;;
 
114
        *[!A-Za-z0-9_-]*) continue ;;
 
115
        *) test -d "$hook" || copy_exec "$hook" "${HOOKDIR}" ;;
 
116
    esac
 
117
    # Copy any files needed by the network hook
 
118
    MANDOSNETHOOKDIR=/etc/mandos/network-hooks.d MODE=files \
 
119
        "$hook" files | while read file target; do
 
120
        if [ -z "${target}" ]; then
 
121
            copy_exec "$file"
 
122
        else
 
123
            copy_exec "$file" "$target"
 
124
        fi
 
125
    done
 
126
done
 
127
 
110
128
# GPGME needs /usr/bin/gpg
111
129
if [ ! -e "${DESTDIR}/usr/bin/gpg" \
112
130
    -a -n "`ls \"${DESTDIR}\"/usr/lib/libgpgme.so* \
115
133
fi
116
134
 
117
135
# Config files
118
 
for file in /etc/mandos/*; do
 
136
for file in /etc/mandos/plugin-runner.conf; do
119
137
    if [ -d "$file" ]; then
120
138
        continue
121
139
    fi
123
141
done
124
142
 
125
143
if [ ${mandos_user} != 65534 ]; then
126
 
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
127
 
    cat <<-EOF >> "$PLUGINRUNNERCONF"
128
 
        
129
 
        --userid=${mandos_user}
130
 
EOF
 
144
    sed --in-place --expression="1i--userid=${mandos_user}" \
 
145
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
131
146
fi
132
147
 
133
148
if [ ${mandos_group} != 65534 ]; then
134
 
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
135
 
    cat <<-EOF >> "$PLUGINRUNNERCONF"
136
 
        
137
 
        --groupid=${mandos_group}
138
 
EOF
 
149
    sed --in-place --expression="1i--groupid=${mandos_group}" \
 
150
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
139
151
fi
140
152
 
141
 
# Key files 
 
153
# Key files
142
154
for file in "$keydir"/*; do
143
155
    if [ -d "$file" ]; then
144
156
        continue