/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: 2008-09-05 18:37:28 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905183728-l0m8v3vqa302uwrw
* mandos (main): Use EAFP with pidfile.

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::::; } | awk -F: '{ print $3 }'`" 
57
 
mandos_group="`{ getent group mandos \
58
 
        || getent group nogroup \
59
 
        || echo ::65534:; } | awk -F: '{ print $3 }'`"
60
 
 
61
54
# The Mandos network client uses the network
62
55
auto_add_modules net
63
56
# The Mandos network client uses IPv6
69
62
PLUGINDIR="${MANDOSDIR}/plugins.d"
70
63
 
71
64
# Make directories
72
 
install --directory --mode=u=rwx,go=rx "${DESTDIR}${CONFDIR}" \
73
 
        "${DESTDIR}${MANDOSDIR}"
74
 
install --owner=${mandos_user} --group=${mandos_group} --directory \
75
 
    --mode=u=rwx "${DESTDIR}${PLUGINDIR}"
 
65
mkdir --parents "${DESTDIR}${CONFDIR}"
 
66
mkdir --parents "${DESTDIR}${PLUGINDIR}"
76
67
 
77
68
# Copy the Mandos plugin runner
78
69
copy_exec "$prefix"/lib/mandos/plugin-runner "${MANDOSDIR}"
109
100
    copy_exec /usr/bin/gpg
110
101
fi
111
102
 
112
 
# Config files
113
 
for file in /etc/mandos/*; do
114
 
    if [ -d "$file" ]; then
115
 
        continue
116
 
    fi
117
 
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
118
 
done
119
 
 
120
 
# Key files 
121
 
for file in  "$keydir"/*; do
122
 
    if [ -d "$file" ]; then
123
 
        continue
124
 
    fi
125
 
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
126
 
    chown ${mandos_user}:${mandos_group} \
127
 
        "${DESTDIR}${CONFDIR}/`basename \"$file\"`"
 
103
# Config files and key files 
 
104
for file in /etc/mandos/* "$keydir"/*; do
 
105
    if [ -d "$file" ]; then
 
106
        continue
 
107
    fi
 
108
    cp --archive --sparse=always "$file" "${DESTDIR}${CONFDIR}"
128
109
done
129
110
 
130
111
# /lib/mandos/plugin-runner will drop priviliges, but needs access to
139
120
# condition.  This umask is set by "initramfs-tools-hook-conf",
140
121
# installed as "/usr/share/initramfs-tools/conf-hooks.d/mandos".)
141
122
142
 
for full in "${MANDOSDIR}" "${CONFDIR}"; do
 
123
for full in "${PLUGINDIR}" "${CONFDIR}"; do
143
124
    while [ "$full" != "/" ]; do
144
125
        chmod a+rX "${DESTDIR}$full"
145
126
        full="`dirname \"$full\"`"
154
135
    fi
155
136
done
156
137
for dir in /lib /usr/lib; do
157
 
    find "${DESTDIR}$dir" \! -perm -u+rw,g+r -prune -o -print0 \
 
138
    find "${DESTDIR}$dir" \! -perm /u+rw,g+r -prune -o -print0 \
158
139
        | xargs --null --no-run-if-empty chmod a+rX
159
140
done