-
Notifications
You must be signed in to change notification settings - Fork 107
/
rules
executable file
·202 lines (190 loc) · 7.63 KB
/
rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/make -f
# debian/rules for amanda using debhelper. GNU copyright 2008 by Dan Locks,
# based on work by Bdale Garbee.
# Warning - do *not* use -j on an SMP machine, or the build gets
# confused... some sort of race condition in the makefiles?
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
AMVER=`cat FULL_VERSION`
# These are variables that the user can override. They get used in various
# places during configure, build, and install.
PREFIX=/usr
BINDIR=$(PREFIX)/bin
triplet := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
ifeq ($(triplet),x86_64-linux-gnu)
LIBDIR=$(PREFIX)/lib/$(triplet)
else
LIBDIR=$(PREFIX)/lib
endif
AMLIBDIR=$(LIBDIR)/amanda
LIBEXECDIR=$(LIBDIR)
AMLIBEXECDIR=$(LIBEXECDIR)/amanda
MANDIR=$(PREFIX)/share/man
DOCDIR=$(PREFIX)/share/doc
SYSCONFDIR=/etc
LOCALSTATEDIR=/var
AMANDAHOMEDIR=$(LOCALSTATEDIR)/lib/amanda
LOGDIR=$(LOCALSTATEDIR)/log/amanda
# Extract the perl site_lib directory. This is used to install amanda's perl
# libs. If configure finds a different install or you specify a different path using
# --with-amperldir= make sure you change this variable as well.
PERLSITELIB=$(shell perl -V:installsitelib|sed -e"s:installsitelib='/::;s:'\;::")
AMANDAUSER=amandabackup
AMANDAGROUP=disk
WITHOUT_SERVER="False"
WITHOUT_CLIENT="False"
r=$(shell pwd)/debian/tmp
server=$(shell pwd)/debian/amanda-backup-server
client=$(shell pwd)/debian/amanda-backup-client
log=$(shell pwd)/debian/dpkg.log
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)
WD=$(shell pwd)
build: build-stamp
build-stamp: /sbin/dump /usr/bin/smbclient
dh_testdir
./configure \
MAKEFLAGS="-j1 " \
CFLAGS="-pipe " \
MAILER=/usr/bin/mail \
--enable-as-needed \
--quiet \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=$(PREFIX) \
--libdir=$(LIBDIR) \
--bindir=$(BINDIR) \
--mandir=$(MANDIR) \
--libexecdir=$(LIBEXECDIR) \
--enable-shared \
--sysconfdir=$(SYSCONFDIR) \
--localstatedir=$(LOCALSTATEDIR) \
--with-amdatadir=$(AMANDAHOMEDIR) \
--with-gnutar-listdir=$(AMANDAHOMEDIR)/gnutar-lists \
--with-index-server=localhost \
--with-tape-server=localhost \
--with-user=$(AMANDAUSER) \
--with-group=$(AMANDAGROUP) \
--with-fqdn \
--with-bsd-security \
--with-bsdtcp-security \
--with-bsdudp-security \
--with-amandahosts \
--with-smbclient=$(BINDIR)/smbclient \
--with-debugging=$(LOGDIR) \
--with-ssh-security \
--with-assertions \
--enable-s3-device \
--disable-installperms
touch missing
# Preinst is the same for client and server, but we leave room for
# differences by just appending here.
cat $(WD)/debian/preinst >> $(WD)/debian/amanda-backup-client.preinst
cat $(WD)/debian/preinst >> $(WD)/debian/amanda-backup-server.preinst
# Postinst and postrm keep client/server differences to just variables;
# the postinst/postrm logic is otherwise the same.
cat $(WD)/debian/postinst >> $(WD)/debian/amanda-backup-client.postinst
cat $(WD)/debian/postinst >> $(WD)/debian/amanda-backup-server.postinst
cat $(WD)/debian/postrm >> $(WD)/debian/amanda-backup-client.postrm
cat $(WD)/debian/postrm >> $(WD)/debian/amanda-backup-server.postrm
make -s LIBTOOLFLAGS=--silent
touch build-stamp
clean:
dh_testdir >> $(log) 2>&1
dh_testroot >> $(log) 2>&1
-make -s LIBTOOLFLAGS=--silent clean
-make -s LIBTOOLFLAGS=--silent distclean
-rm -f build-stamp missing config/config.h common-src/genversion
-find . -type d -name .deps -exec rm -rf {} \;
-test -r /usr/share/misc/config.sub && \
cp -f /usr/share/misc/config.sub config/config.sub
-test -r /usr/share/misc/config.guess && \
cp -f /usr/share/misc/config.guess config/config.guess
dh_clean >> $(log) 2>&1
# Build architecture-dependent files here.
binary-arch: build
echo "---->dh_testdir: " >> $(log)
dh_testdir >> $(log) 2>&1
echo "---->dh_testroot: " >> $(log)
dh_testroot >> $(log) 2>&1
echo "---->dh_clean: " >> $(log)
dh_clean -k >> $(log) 2>&1
echo "---->dh_installdirs: " >> $(log)
dh_installdirs -v >> $(log) 2>&1
make -s LIBTOOLFLAGS=--silent install DESTDIR=$(r)
echo "---->dh_installdocs: " >> $(log)
dh_installdocs -v >> $(log) 2>&1
install -d $(r)/$(DOCDIR)/amanda-common/examples
cp -a example/* $(r)/$(DOCDIR)/amanda-common/examples
cp ChangeLog $(r)/$(DOCDIR)/amanda-common/changelog
echo "---->dh_installchangelogs: " >> $(log)
dh_installchangelogs -v >> $(log) 2>&1
# Here's how we get the perl modules installed into sitelib
echo $(PERLSITELIB)/* >> debian/amanda-backup-server.install
echo "---->dh_install -v --fail-missing: " >> $(log)
dh_install -v --sourcedir=$(r) >> $(log) 2>&1
echo "---->dh_strip: " >> $(log)
dh_strip >> $(log) 2>&1
echo "---->dh_compress: " >> $(log)
dh_compress >> $(log) 2>&1
echo "---->dh_fixperms: " >> $(log)
dh_fixperms -v >> $(log) 2>&1
# fix perms manually
chown -R $(AMANDAUSER):$(AMANDAGROUP) debian/*/var/lib/*
#chmod -R u=rwX,g=rwX,o-rwx debian/*/var/lib/*
chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(LOGDIR) $(server)/$(LOGDIR)
#chmod -R u=rwX,g=rwX,o-rwx $(server)/$(LOGDIR)
chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(SYSCONFDIR)/amanda $(server)/$(SYSCONFDIR)/amanda
chmod -R u=rwX,g=rwX,o-rwx $(client)/$(SYSCONFDIR)/amanda
chmod -R u=rwX,g=rwX,o-rwx $(server)/$(SYSCONFDIR)/amanda
chown -R $(AMANDAUSER):$(AMANDAGROUP) $(client)/$(AMANDAHOMEDIR)/gnutar-lists $(server)/$(AMANDAHOMEDIR)/gnutar-lists
chmod -R u=rwX,g=rwX,o-rwx $(client)/$(AMANDAHOMEDIR)/gnutar-lists $(server)/$(AMANDAHOMEDIR)/gnutar-lists
# .. setuid
chown root:disk \
$(client)/$(AMLIBEXECDIR)/application/amgtar \
$(client)/$(AMLIBEXECDIR)/application/amstar \
$(client)/$(AMLIBEXECDIR)/killpgrp \
$(client)/$(AMLIBEXECDIR)/rundump \
$(client)/$(AMLIBEXECDIR)/runtar \
$(client)/$(AMLIBEXECDIR)/calcsize \
$(server)/$(AMLIBEXECDIR)/application/amgtar \
$(server)/$(AMLIBEXECDIR)/application/amstar \
$(server)/$(AMLIBEXECDIR)/killpgrp \
$(server)/$(AMLIBEXECDIR)/rundump \
$(server)/$(AMLIBEXECDIR)/runtar \
$(server)/$(AMLIBEXECDIR)/calcsize \
$(server)/$(AMLIBEXECDIR)/ambind
chmod u=srwx,g=rx,o= \
$(client)/$(AMLIBEXECDIR)/application/amgtar \
$(client)/$(AMLIBEXECDIR)/application/amstar \
$(client)/$(AMLIBEXECDIR)/killpgrp \
$(client)/$(AMLIBEXECDIR)/rundump \
$(client)/$(AMLIBEXECDIR)/runtar \
$(client)/$(AMLIBEXECDIR)/calcsize \
$(server)/$(AMLIBEXECDIR)/application/amgtar \
$(server)/$(AMLIBEXECDIR)/application/amstar \
$(server)/$(AMLIBEXECDIR)/killpgrp \
$(server)/$(AMLIBEXECDIR)/rundump \
$(server)/$(AMLIBEXECDIR)/runtar \
$(server)/$(AMLIBEXECDIR)/calcsize \
$(server)/$(AMLIBEXECDIR)/ambind
echo "Amanda version $(AMVER)" > $(server)/$(AMANDAHOMEDIR)/amanda-release
echo "Amanda version $(AMVER)" > $(client)/$(AMANDAHOMEDIR)/amanda-release
install -o root -g root -m 0644 debian/amanda-backup-client.lintian \
$(client)/usr/share/lintian/overrides/amanda-backup-client
install -o root -g root -m 0644 debian/amanda-backup-server.lintian \
$(server)/usr/share/lintian/overrides/amanda-backup-server
dh_makeshlibs >> $(log) 2>&1
dh_perl >> $(log) 2>&1
dh_shlibdeps -l"$(r)$(LIBDIR):$(client)$(LIBDIR):$(server)$(LIBDIR)" >> $(log) 2>&1
dh_installdeb >> $(log) 2>&1
dh_gencontrol >> $(log) 2>&1
dh_md5sums >> $(log) 2>&1
dh_builddeb >> $(log) 2>&1
source diff:
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
binary: binary-arch
.PHONY: build clean binary-arch binary