2 # debian/rules for amanda using debhelper. GNU copyright 2008 by Dan Locks,
3 # based on work by Bdale Garbee.
4 # requires automake 1.2d (from experimental tree)
6 # Warning - do *not* use -j on an SMP machine, or the build gets
7 # confused... some sort of race condition in the makefiles?
9 # Uncomment this to turn on verbose mode.
13 # These are variables that the user can override. They get used in various
14 # places during configure, build, and install.
18 AMLIBDIR=$(LIBDIR)/amanda
19 LIBEXECDIR=$(PREFIX)/libexec
20 AMLIBEXECDIR=$(LIBEXECDIR)/amanda
21 MANDIR=$(PREFIX)/share/man
22 DOCDIR=$(PREFIX)/share/doc
25 AMHOMEDIR=$(LOCALSTATEDIR)/lib/amanda
26 LOGDIR=$(LOCALSTATEDIR)/log/amanda
27 # Extract the perl site_lib directory. This is used to install amanda's perl
28 # libs. If configure finds a different install or you specify a different path using
29 # --with-amperldir= make sure you change this variable as well.
30 PERLSITELIB=$(shell perl -V:installsitelib|sed -e"s:installsitelib='/::;s:'\;::")
31 AMANDAUSER=amandabackup
33 WITHOUT_SERVER="False"
34 WITHOUT_CLIENT="False"
36 r=$(shell pwd)/debian/amanda-common
37 server=$(shell pwd)/debian/amanda-backup-server
38 client=$(shell pwd)/debian/amanda-backup-client
40 log=$(shell pwd)/debian/dpkg.log
42 # These are used for cross-compiling and for saving the configure script
43 # from having to guess our platform (since we know it already)
44 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
45 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
48 build-stamp: /sbin/dump /usr/bin/smbclient
52 CFLAGS="-DIGNORE_TAR_ERRORS " \
53 MAILER=/usr/bin/mail \
55 --host=$(DEB_HOST_GNU_TYPE) \
56 --build=$(DEB_BUILD_GNU_TYPE) \
60 --libexecdir=$(LIBEXECDIR) \
62 --sysconfdir=$(SYSCONFDIR) \
63 --localstatedir=$(LOCALSTATEDIR) \
64 --with-amdatadir=$(AMHOMEDIR) \
65 --with-gnutar-listdir=$(AMHOMEDIR)/gnutar-lists \
66 --with-index-server=localhost \
67 --with-tape-server=localhost \
68 --with-user=$(AMANDAUSER) \
69 --with-group=$(AMANDAGROUP) \
72 --with-bsdtcp-security \
73 --with-bsdudp-security \
75 --with-smbclient=$(BINDIR)/smbclient \
76 --with-debugging=$(LOGDIR) \
77 --with-tcpportrange=11000,11040 \
78 --with-udpportrange=700,740 \
79 --with-low-udpportrange=700,710 \
83 --disable-installperms
85 # There's probably a better way to do this. Preinst and postrm are the
86 # same for client and server, but we leave room for differences by just
88 cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-client.preinst
89 cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-server.preinst
90 cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-client.postrm
91 cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-server.postrm
96 dh_testdir >> $(log) 2>&1
97 dh_testroot >> $(log) 2>&1
100 -rm -f build-stamp missing config/config.h common-src/genversion
101 -find . -type d -name .deps -exec rm -rf {} \;
102 -test -r /usr/share/misc/config.sub && \
103 cp -f /usr/share/misc/config.sub config/config.sub
104 -test -r /usr/share/misc/config.guess && \
105 cp -f /usr/share/misc/config.guess config/config.guess
106 dh_clean >> $(log) 2>&1
108 # Build architecture-dependent files here.
110 echo "---->dh_testdir: " >> $(log)
111 dh_testdir >> $(log) 2>&1
112 echo "---->dh_testroot: " >> $(log)
113 dh_testroot >> $(log) 2>&1
114 echo "---->dh_clean: " >> $(log)
115 dh_clean -k >> $(log) 2>&1
116 echo "---->dh_installdirs: " >> $(log)
117 dh_installdirs -v >> $(log) 2>&1
118 make install DESTDIR=$(r)
119 echo "---->dh_installdocs: " >> $(log)
120 dh_installdocs -v >> $(log) 2>&1
121 install -d $(r)/$(DOCDIR)/amanda-common/examples
122 cp -a example/* $(r)/$(DOCDIR)/amanda-common/examples
123 cp ChangeLog $(r)/$(DOCDIR)/amanda-common/changelog
124 echo "---->dh_installmenu: " >> $(log)
125 dh_installmenu -v >> $(log) 2>&1
126 echo "---->dh_installcron: " >> $(log)
127 dh_installcron >> $(log) 2>&1
128 echo "---->dh_installchangelogs: " >> $(log)
129 dh_installchangelogs -v >> $(log) 2>&1
130 echo "---->dh_installdebconf: " >> $(log)
131 dh_installdebconf -v >> $(log) 2>&1
132 # Here's how we get the perl modules installed into sitelib
133 echo $(PERLSITELIB)/* >> debian/amanda-backup-server.install
134 echo "---->dh_install -v --fail-missing: " >> $(log)
135 dh_install -v --sourcedir=debian/amanda-common >> $(log) 2>&1
136 echo "---->dh_strip: " >> $(log)
137 dh_strip >> $(log) 2>&1
138 echo "---->dh_compress: " >> $(log)
139 dh_compress >> $(log) 2>&1
140 echo "---->dh_fixperms: " >> $(log)
141 dh_fixperms -v >> $(log) 2>&1
143 chown -R $(AMANDAUSER):$(AMANDAGROUP) debian/*/var/lib/*
144 #chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
145 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(LOGDIR) $(server)/$(LOGDIR)
146 #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(LOGDIR)
147 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(SYSCONFDIR)/amanda $(server)/$(SYSCONFDIR)/amanda
148 #chmod -R u=rwX,g=rwX,o-rwx $(server)/$(SYSCONFDIR)/amanda
149 chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(AMHOMEDIR)/gnutar-lists $(server)/$(AMHOMEDIR)/gnutar-lists
150 chmod -R u=rwX,g=rwX,o-rwx $(client)/$(AMHOMEDIR)/gnutar-lists $(server)/$(AMHOMEDIR)/gnutar-lists
153 $(client)/$(AMLIBEXECDIR)/application/amgtar \
154 $(client)/$(AMLIBEXECDIR)/application/amstar \
155 $(client)/$(AMLIBEXECDIR)/killpgrp \
156 $(client)/$(AMLIBEXECDIR)/rundump \
157 $(client)/$(AMLIBEXECDIR)/runtar \
158 $(client)/$(AMLIBEXECDIR)/calcsize \
159 $(server)/$(AMLIBEXECDIR)/application/amgtar \
160 $(server)/$(AMLIBEXECDIR)/application/amstar \
161 $(server)/$(AMLIBEXECDIR)/killpgrp \
162 $(server)/$(AMLIBEXECDIR)/rundump \
163 $(server)/$(AMLIBEXECDIR)/runtar \
164 $(server)/$(AMLIBEXECDIR)/calcsize \
165 $(server)/$(AMLIBEXECDIR)/dumper \
166 $(server)/$(AMLIBEXECDIR)/planner \
167 $(server)/usr/sbin/amcheck
168 chmod u=srwx,g=rx,o=r \
169 $(client)/$(AMLIBEXECDIR)/application/amgtar \
170 $(client)/$(AMLIBEXECDIR)/application/amstar \
171 $(client)$(AMLIBEXECDIR)/killpgrp \
172 $(client)$(AMLIBEXECDIR)/rundump \
173 $(client)$(AMLIBEXECDIR)/runtar \
174 $(client)$(AMLIBEXECDIR)/calcsize \
175 $(server)/$(AMLIBEXECDIR)/application/amgtar \
176 $(server)/$(AMLIBEXECDIR)/application/amstar \
177 $(server)$(AMLIBEXECDIR)/killpgrp \
178 $(server)$(AMLIBEXECDIR)/rundump \
179 $(server)$(AMLIBEXECDIR)/runtar \
180 $(server)$(AMLIBEXECDIR)/calcsize \
181 $(server)$(AMLIBEXECDIR)/dumper \
182 $(server)$(AMLIBEXECDIR)/planner \
183 $(server)/usr/sbin/amcheck
184 echo "Amanda version $(AMVER)" > $(server)/$(AMHOMEDIR)/amanda-release
185 echo "Amanda version $(AMVER)" > $(client)/$(AMHOMEDIR)/amanda-release
186 install -o root -g root -m 0644 debian/amanda-backup-client.lintian \
187 $(client)/usr/share/lintian/overrides/amanda-backup-client
188 #install -o root -g root -m 0644 debian/amanda-common.lintian \
189 # $(r)/usr/share/lintian/overrides/amanda-common
190 install -o root -g root -m 0644 debian/amanda-backup-server.lintian \
191 $(server)/usr/share/lintian/overrides/amanda-backup-server
192 dh_makeshlibs >> $(log) 2>&1
193 dh_installdeb >> $(log) 2>&1
194 dh_perl >> $(log) 2>&1
195 dh_shlibdeps -l"debian/$(r)/usr/lib:debian/$(client)/usr/lib:debian/$(server)/usr/lib" >> $(log) 2>&1
196 # strip out the non-versioned amanda-common references, we need
197 # the versioned ones in the control file and dupes are ugly...
198 sed -e 's/amanda-common, //' < debian/amanda-backup-server.substvars > debian/blah
199 mv debian/blah debian/amanda-backup-server.substvars
200 sed -e 's/amanda-common, //' < debian/amanda-backup-client.substvars > debian/blah
201 mv debian/blah debian/amanda-backup-client.substvars
202 dh_gencontrol >> $(log) 2>&1
203 dh_md5sums >> $(log) 2>&1
204 dh_builddeb >> $(log) 2>&1
207 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
210 .PHONY: build clean binary-arch binary