/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 Makefile

  • Committer: Teddy Hogeborn
  • Date: 2008-09-05 08:38:30 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080905083830-6y9v2rb2us0m45kn
* Makefile (PIDDIR, USER, GROUP): New variables.
  (install-server): Create $(PIDDIR).  Copy "init.d-mandos" and
                    "default-mandos" into place.  Install init script
                    using "update-rc.d".
  (uninstall-server): Remove links to init script using "update-rc.d".
  (purge-server): Remove /etc/init.d/mandos and /etc/default/mandos.

* default-mandos: New file.  Will install as "/etc/default/mandos".
* init.d-mandos:            - '' -           "/etc/init.d/mandos".

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
KEYDIR=$(DESTDIR)/etc/keys/mandos
22
22
# MANDIR=/usr/local/man
23
23
MANDIR=$(DESTDIR)/usr/share/man
 
24
PIDDIR=/var/run/mandos
 
25
USER=nobody
 
26
GROUP=nogroup
24
27
 
25
28
GNUTLS_CFLAGS=$(shell libgnutls-config --cflags)
26
29
GNUTLS_LIBS=$(shell libgnutls-config --libs)
47
50
# DocBook-to-man post-processing to fix a \n escape bug
48
51
MANPOST=sed --in-place --expression='s,\\\\en,\\en,g;s,\\n,\\en,g'
49
52
 
50
 
PLUGINS=plugins.d/password-prompt plugins.d/mandos-client
 
53
PLUGINS=plugins.d/password-prompt plugins.d/password-request
51
54
PROGS=plugin-runner $(PLUGINS)
52
55
DOCS=mandos.8 plugin-runner.8mandos mandos-keygen.8 \
53
 
        plugins.d/mandos-client.8mandos \
 
56
        plugins.d/password-request.8mandos \
54
57
        plugins.d/password-prompt.8mandos mandos.conf.5 \
55
58
        mandos-clients.conf.5
56
59
 
81
84
plugin-runner.8mandos: plugin-runner.xml overview.xml legalnotice.xml
82
85
        $(DOCBOOKTOMAN)
83
86
 
84
 
plugins.d/mandos-client.8mandos: plugins.d/mandos-client.xml \
 
87
plugins.d/password-request.8mandos: plugins.d/password-request.xml \
85
88
                                        mandos-options.xml \
86
89
                                        overview.xml legalnotice.xml
87
90
        $(DOCBOOKTOMAN)
88
91
 
89
 
plugins.d/mandos-client: plugins.d/mandos-client.o
 
92
plugins.d/password-request: plugins.d/password-request.o
90
93
        $(LINK.o) $(GNUTLS_LIBS) $(AVAHI_LIBS) $(GPGME_LIBS) \
91
94
                $(COMMON) $^ $(LOADLIBES) $(LDLIBS) -o $@
92
95
 
109
112
run-client: all keydir/seckey.txt keydir/pubkey.txt
110
113
        ./plugin-runner --plugin-dir=plugins.d \
111
114
                --config-file=plugin-runner.conf \
112
 
                --options-for=mandos-client:--seckey=keydir/seckey.txt,--pubkey=keydir/pubkey.txt
 
115
                --options-for=password-request:--seckey=keydir/seckey.txt,--pubkey=keydir/pubkey.txt
113
116
 
114
117
# Used by run-client
115
118
keydir/seckey.txt keydir/pubkey.txt: mandos-keygen
126
129
        install --mode=u=rw,go=r $^ $@
127
130
confdir/clients.conf: clients.conf keydir/seckey.txt
128
131
        install --directory confdir
129
 
        install --mode=u=rw $< $@
 
132
        install --mode=u=rw,g=r $< $@
130
133
# Add a client password
131
134
        ./mandos-keygen --dir keydir --password >> $@
132
135
 
135
138
install-server: doc
136
139
        install --directory $(CONFDIR) $(MANDIR)/man5 \
137
140
                $(MANDIR)/man8
 
141
        install --mode=u=rwx,go=rx --owner=$(USER) --group=$(GROUP) \
 
142
                --directory $(PIDDIR)
138
143
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
139
144
        install --mode=u=rw,go=r --target-directory=$(CONFDIR) \
140
145
                mandos.conf
141
 
        install --mode=u=rw --target-directory=$(CONFDIR) \
 
146
        install --mode=u=rw,g=r --target-directory=$(CONFDIR) \
142
147
                clients.conf
143
148
        install --mode=u=rwx,go=rx init.d-mandos /etc/init.d/mandos
144
149
        install --mode=u=rw,go=r default-mandos /etc/default/mandos
156
161
        install --directory --mode=u=rwx $(KEYDIR)
157
162
        install --directory --mode=u=rwx \
158
163
                $(PREFIX)/lib/mandos/plugins.d
159
 
        if [ "$(CONFDIR)" != "$(PREFIX)/lib/mandos" ]; then \
160
 
                install --mode=u=rwx \
161
 
                        --directory "$(CONFDIR)/plugins.d"; \
162
 
                install --mode=u=rw,go=r etc-plugins.d-README \
163
 
                        $(CONFDIR)/plugins.d/README ; \
164
 
        fi
 
164
        if [ "$(CONFDIR)/plugins.d" \
 
165
                        != "$(PREFIX)/lib/mandos/plugins.d" ]; then \
 
166
                        install --directory "$(CONFDIR)/plugins.d"; \
 
167
                fi
165
168
        install --mode=u=rwx,go=rx \
166
169
                --target-directory=$(PREFIX)/lib/mandos plugin-runner
167
170
        install --mode=u=rwx,go=rx --target-directory=$(PREFIX)/sbin \
171
174
                plugins.d/password-prompt
172
175
        install --mode=u=rwxs,go=rx \
173
176
                --target-directory=$(PREFIX)/lib/mandos/plugins.d \
174
 
                plugins.d/mandos-client
 
177
                plugins.d/password-request
175
178
        install --mode=u=rwx,go=rx \
176
179
                --target-directory=$(PREFIX)/lib/mandos/plugins.d \
177
180
                plugins.d/usplash
188
191
                > $(MANDIR)/man8/plugin-runner.8mandos.gz
189
192
        gzip --best --to-stdout plugins.d/password-prompt.8mandos \
190
193
                > $(MANDIR)/man8/password-prompt.8mandos.gz
191
 
        gzip --best --to-stdout plugins.d/mandos-client.8mandos \
192
 
                > $(MANDIR)/man8/mandos-client.8mandos.gz
193
 
# Post-installation stuff
 
194
        gzip --best --to-stdout plugins.d/password-request.8mandos \
 
195
                > $(MANDIR)/man8/password-request.8mandos.gz
194
196
        -$(PREFIX)/sbin/mandos-keygen --dir "$(KEYDIR)"
195
197
        update-initramfs -k all -u
196
198
        echo "Now run mandos-keygen --password --dir $(KEYDIR)"
203
205
                $(MANDIR)/man5/mandos.conf.5.gz \
204
206
                $(MANDIR)/man5/mandos-clients.conf.5.gz
205
207
        update-rc.d -f mandos remove
206
 
        -rmdir $(CONFDIR)
 
208
        -rmdir $(CONFDIR) $(PIDDIR)
207
209
 
208
210
uninstall-client:
209
211
# Refuse to uninstall client if /etc/crypttab is explicitly configured
213
215
        -rm --force $(PREFIX)/sbin/mandos-keygen \
214
216
                $(PREFIX)/lib/mandos/plugin-runner \
215
217
                $(PREFIX)/lib/mandos/plugins.d/password-prompt \
216
 
                $(PREFIX)/lib/mandos/plugins.d/mandos-client \
217
 
                $(PREFIX)/lib/mandos/plugins.d/usplash \
 
218
                $(PREFIX)/lib/mandos/plugins.d/password-request \
218
219
                /usr/share/initramfs-tools/hooks/mandos \
219
220
                /usr/share/initramfs-tools/conf-hooks.d/mandos \
220
 
                /usr/share/initramfs-tools/scripts/local-top/mandos \
221
221
                $(MANDIR)/man8/plugin-runner.8mandos.gz \
222
222
                $(MANDIR)/man8/mandos-keygen.8.gz \
223
223
                $(MANDIR)/man8/password-prompt.8mandos.gz \
224
 
                $(MANDIR)/man8/mandos-client.8mandos.gz
225
 
        if [ "$(CONFDIR)" != "$(PREFIX)/lib/mandos" ]; then \
226
 
                rm --force $(CONFDIR)/plugins.d/README; \
227
 
        fi
 
224
                $(MANDIR)/man8/password-request.8mandos.gz
228
225
        -rmdir $(PREFIX)/lib/mandos/plugins.d $(CONFDIR)/plugins.d \
229
 
                 $(PREFIX)/lib/mandos $(CONFDIR) $(KEYDIR)
 
226
                 $(PREFIX)/lib/mandos $(CONFDIR)
230
227
        update-initramfs -k all -u
231
228
 
232
229
purge: purge-server purge-client
233
230
 
234
231
purge-server: uninstall-server
235
232
        -rm --force $(CONFDIR)/mandos.conf $(CONFDIR)/clients.conf \
236
 
                /etc/default/mandos /etc/init.d/mandos \
237
 
                /var/run/mandos.pid
 
233
                /etc/default/mandos /etc/init.d/mandos
238
234
        -rmdir $(CONFDIR)
239
235
 
240
236
purge-client: uninstall-client