/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: Björn Påhlsson
  • Date: 2011-10-02 19:18:24 UTC
  • mto: This revision was merged to the branch mainline in revision 505.
  • Revision ID: belorn@fukt.bsnet.se-20111002191824-eweh4pvneeg3qzia
transitional stuff actually working
documented change to D-Bus API

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    exit 1
52
52
fi
53
53
 
54
 
mandos_user="`{ getent passwd mandos \
55
 
                || getent passwd nobody \
56
 
                || echo ::65534::::; } \
57
 
        | awk --field-separator=: '{ print $3 }'`" 
58
 
mandos_group="`{ getent group mandos \
59
 
                || getent group nogroup \
60
 
                || echo ::65534:; } \
61
 
        | awk --field-separator=: '{ print $3 }'`"
 
54
set `{ getent passwd _mandos \
 
55
    || getent passwd nobody \
 
56
    || echo ::65534:65534:::; } \
 
57
    | cut --delimiter=: --fields=3,4 --only-delimited \
 
58
    --output-delimiter=" "`
 
59
mandos_user="$1"
 
60
mandos_group="$2"
62
61
 
63
62
# The Mandos network client uses the network
64
63
auto_add_modules net
89
88
        continue
90
89
    fi
91
90
    case "$base" in
92
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-new|*.dpkg-divert) : ;;
93
 
        "*") :;;
94
 
        *) copy_exec "$file" "${PLUGINDIR}";;
 
91
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
92
            : ;;
 
93
        "*") echo "W: Mandos client plugin directory is empty." >&2 ;;
 
94
        *) copy_exec "$file" "${PLUGINDIR}" ;;
95
95
    esac
96
96
done
97
97
 
99
99
for file in /etc/mandos/plugins.d/*; do
100
100
    base="`basename \"$file\"`"
101
101
    case "$base" in
102
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-new|*.dpkg-divert) : ;;
103
 
        "*") :;;
104
 
        *) copy_exec "$file" "${PLUGINDIR}";;
 
102
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
103
            : ;;
 
104
        "*") : ;;
 
105
        *) copy_exec "$file" "${PLUGINDIR}" ;;
105
106
    esac
106
107
done
107
108
 
113
114
fi
114
115
 
115
116
# Config files
116
 
for file in /etc/mandos/*; do
 
117
for file in /etc/mandos/plugin-runner.conf; do
117
118
    if [ -d "$file" ]; then
118
119
        continue
119
120
    fi
120
121
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
121
122
done
122
123
 
 
124
if [ ${mandos_user} != 65534 ]; then
 
125
    sed --in-place --expression="1i--userid=${mandos_user}" \
 
126
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
127
fi
 
128
 
 
129
if [ ${mandos_group} != 65534 ]; then
 
130
    sed --in-place --expression="1i--groupid=${mandos_group}" \
 
131
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
 
132
fi
 
133
 
123
134
# Key files 
124
 
for file in  "$keydir"/*; do
 
135
for file in "$keydir"/*; do
125
136
    if [ -d "$file" ]; then
126
137
        continue
127
138
    fi
156
167
        chmod a+rX "${DESTDIR}$dir"
157
168
    fi
158
169
done
159
 
for dir in /lib /usr/lib; do
160
 
    find "${DESTDIR}$dir" \! -perm -u+rw,g+r -prune -or -print0 \
161
 
        | xargs --null --no-run-if-empty chmod a+rX
 
170
for dir in "${DESTDIR}"/lib* "${DESTDIR}"/usr/lib*; do
 
171
    if [ -d "$dir" ]; then
 
172
        find "$dir" \! -perm -u+rw,g+r -prune -or -print0 \
 
173
            | xargs --null --no-run-if-empty chmod a+rX
 
174
    fi
162
175
done