/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: 2009-04-17 08:26:17 UTC
  • Revision ID: teddy@fukt.bsnet.se-20090417082617-eltetak5lzjyz55o
* initramfs-tools-hook: Bug fix: Add "--userid" and "--groupid" to
                        start of "plugin-runner.conf" file instead of
                        appending, to allow any preexisting options to
                        override.
* plugin-runner.conf: Improved wording.

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 mandos \
56
 
                || getent passwd nobody \
57
 
                || echo ::65534::::; } \
58
 
        | awk --field-separator=: '{ print $3 }'`" 
59
 
mandos_group="`{ getent group _mandos \
60
 
                || getent group mandos \
61
 
                || getent group nogroup \
62
 
                || echo ::65534:; } \
63
 
        | 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"
64
61
 
65
62
# The Mandos network client uses the network
66
63
auto_add_modules net
91
88
        continue
92
89
    fi
93
90
    case "$base" in
94
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
95
 
        "*") :;;
96
 
        *) copy_exec "$file" "${PLUGINDIR}";;
 
91
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
92
            : ;;
 
93
        */"*")
 
94
            echo "W: Mandos client plugin directory is empty." >&2 ;;
 
95
        *) copy_exec "$file" "${PLUGINDIR}" ;;
97
96
    esac
98
97
done
99
98
 
101
100
for file in /etc/mandos/plugins.d/*; do
102
101
    base="`basename \"$file\"`"
103
102
    case "$base" in
104
 
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert) : ;;
105
 
        "*") :;;
106
 
        *) copy_exec "$file" "${PLUGINDIR}";;
 
103
        *~|.*|\#*\#|*.dpkg-old|*.dpkg-bak|*.dpkg-new|*.dpkg-divert)
 
104
            : ;;
 
105
        */"*") : ;;
 
106
        *) copy_exec "$file" "${PLUGINDIR}" ;;
107
107
    esac
108
108
done
109
109
 
123
123
done
124
124
 
125
125
if [ ${mandos_user} != 65534 ]; then
126
 
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
127
 
    echo "--userid=${mandos_user}" >> "$PLUGINRUNNERCONF"
 
126
    sed --in-place --expression="1i--userid=${mandos_user}" \
 
127
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
128
128
fi
129
129
 
130
130
if [ ${mandos_group} != 65534 ]; then
131
 
    PLUGINRUNNERCONF="${DESTDIR}${CONFDIR}/plugin-runner.conf"
132
 
    echo "--groupid=${mandos_group}" >> "$PLUGINRUNNERCONF"
 
131
    sed --in-place --expression="1i--groupid=${mandos_group}" \
 
132
        "${DESTDIR}${CONFDIR}/plugin-runner.conf"
133
133
fi
134
134
 
135
135
# Key files 
136
 
for file in  "$keydir"/*; do
 
136
for file in "$keydir"/*; do
137
137
    if [ -d "$file" ]; then
138
138
        continue
139
139
    fi
168
168
        chmod a+rX "${DESTDIR}$dir"
169
169
    fi
170
170
done
171
 
for dir in /lib /usr/lib; do
172
 
    find "${DESTDIR}$dir" \! -perm -u+rw,g+r -prune -or -print0 \
173
 
        | xargs --null --no-run-if-empty chmod a+rX
 
171
for dir in "${DESTDIR}"/lib* "${DESTDIR}"/usr/lib*; do
 
172
    if [ -d "$dir" ]; then
 
173
        find "$dir" \! -perm -u+rw,g+r -prune -or -print0 \
 
174
            | xargs --null --no-run-if-empty chmod a+rX
 
175
    fi
174
176
done