2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 by Joey Hess.
5 # This version is for a hypothetical package that builds an
6 # architecture-dependant package, as well as an architecture-independent
9 # Uncomment this to turn on verbose mode.
12 # This is the debhelper compatability version to use.
15 # This has to be exported to make some magic below work.
18 # The AFS sysname is determined by a script
19 KVERS=`awk '{ if (NR==1) v=$$3; else if (NR==2) p=$$3; else if (NR==3) s=$$3; \
20 else if (NR==4) { e=$$3; exit; } } \
21 END { printf("%s.%s.%s%s\n",v,p,s,e); }' $(KSRC)/Makefile`
22 SYS_NAME=$(shell KVERS=$(KVERS) sh debian/sysname)
24 srcpkg = openafs-modules-source
25 modulepkg=$(shell echo openafs-modules-$(KVERS)${INT_SUBARCH})
30 LINTIAN_PACKAGES= openafs-client openafs-fileserver
35 configure: configure-stamp
39 -ln -s $(SYS_NAME) @sys
41 afslogsdir=/var/log/openafs sh configure --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
42 --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib \
43 --localstatedir=/var/lib
44 install -d $(SYS_NAME)/dest/root.client/usr/vice/etc
45 install -d dest/root.server/usr/afs/bin
49 build: configure-stamp build-stamp
54 -rm $(SYS_NAME)/dest/include/crypt.h
60 rm -f build-stamp configure-stamp build-modules-stamp
61 # Add here commands to clean up after the build process.
62 -$(MAKE) -ki distclean
63 -rm -rf obj dest $(SYS_NAME) @sys Makefile debian/openafs-client.init
64 -rm -rf config.status config.cache lib include
73 mkdir -p debian/openafs-dbserver/usr/share/man/man8
74 /usr/bin/docbook-to-man debian/pt_util.sgml >debian/openafs-dbserver/usr/share/man/man8/pt_util.8
75 for foo in $(LINTIAN_PACKAGES) ; do \
76 install -d debian/$$foo/usr/share/lintian/overrides; \
77 cp debian/$$foo.lintian debian/$$foo/usr/share/lintian/overrides/$$foo; \
79 for pkg in openafs-dbserver openafs-fileserver openafs-kpasswd; do \
80 ln -s openafs-client debian/$$pkg/usr/share/doc/$$pkg; \
82 # Add here commands to install the package into debian/tmp.
83 cat debian/filelist |sh debian/movefiles
84 mv debian/openafs-client/usr/bin/pagsh \
85 debian/openafs-client/usr/bin/pagsh.openafs
87 cp debian/CellServDB debian/openafs-client/usr/share/openafs
88 cp dest/root.client/usr/vice/etc/afs.rc debian/openafs-client.init
89 cp dest/root.client/usr/vice/etc/afs.conf debian/openafs-client/etc/openafs/afs.conf
90 install -m 755 -o root -g root debian/afs-rootvol debian/openafs-dbserver/usr/sbin
91 install -g root -o root -m 755 debian/afs-newcell \
92 debian/openafs-dbserver/usr/sbin
93 install -D -m 644 debian/ConfigUtils.pm \
94 debian/openafs-dbserver/usr/lib/perl5/Debian/OpenAFS/ConfigUtils.pm
95 (cd debian&&pod2man --section 8 --center "Debian GNU/Linux" \
96 afs-rootvol ) >debian/openafs-dbserver/usr/share/man/man8/afs-rootvol.8
97 (cd debian&&pod2man --section 8 --center "Debian GNU/Linux" \
98 afs-newcell ) >debian/openafs-dbserver/usr/share/man/man8/afs-newcell.8
99 # No, includes should not have the x bit set
100 find debian/libopenafs-dev/usr/include -type f -print | \
102 # And drop the pam modules
103 rm debian/libopenafs-dev/usr/lib/*pam*
105 # Build architecture-independent files here.
106 # Pass -i to all debhelper commands in this target to reduce clutter.
107 binary-indep: DH_OPTIONS=-i
108 binary-indep: build install binary-source
109 # Need this version of debhelper for DH_OPTIONS to work.
110 dh_testversion 1.1.17
124 dh_installchangelogs ChangeLog
128 # You may want to make some executables suid here.
136 # Build architecture-dependent files here.
137 # Pass -a to all debhelper commands in this target to reduce clutter.
138 binary-arch: DH_OPTIONS=-a
139 binary-arch: build install
140 # Need this version of debhelper for DH_OPTIONS to work.
141 dh_testversion 1.1.17
150 DH_OPTIONS= dh_installinit -popenafs-client -r -- defaults 25 18
151 DH_OPTIONS= dh_installinit -popenafs-fileserver -r
156 dh_installchangelogs ChangeLog
161 # You may want to make some executables suid here.
162 chmod 700 debian/openafs-client/var/cache/openafs
163 chmod 700 debian/openafs-fileserver/etc/openafs/server
164 chmod 700 debian/openafs-dbserver/var/lib/openafs/db
165 chmod 700 debian/openafs-fileserver/var/lib/openafs/cores
175 binary: binary-indep binary-arch
176 .PHONY: build clean binary-indep binary-arch binary install configure
178 ############################Module package support
179 kdist_image: build-modules
180 $(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. binary-modules
181 $(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. clean
184 $(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. KERNEL_DEPENDS=y binary-modules
185 KSRC="$(KSRC)" KMAINT="$(KMAINT)" KEMAIL="$(KEMAIL)" \
186 sh -v debian/genchanges.sh
187 $(MAKE) $(MFLAGS) -f debian/rules MODDIR=$(KSRC)/.. clean
191 kdist_config: configure
195 ############################ source stuff #################################
202 # Setup everything first
203 -rm -rf debian/$(srcpkg) debian/substvars
204 install -d debian/$(srcpkg)
205 # Clean up the sources
206 install -d debian/$(srcpkg)/usr/src/modules/$(package)
207 find . \( -name \*.o -o -path ./debian/$(srcpkg) -o -path \*/CVS -o -path ./src/WINNT \
208 -o -path ./obj -o -path ./$(SYS_NAME) \
209 -o \( -path ./debian/\* -type d \) \
210 -o -path ./debian/\*debhelper \) -prune -o -print | \
211 cpio -admp debian/$(srcpkg)/usr/src/modules/$(package)
212 ( cd debian/$(srcpkg)/usr/src/modules/$(package)&& \
213 $(MAKE) -f debian/rules clean && \
214 rm -rf src/libafs/rx src/libafs/afs src/libafs/afsint; \
215 mv debian/kern-sysname debian/sysname)
216 chown -R root.root debian/$(srcpkg)
217 find debian/$(srcpkg) -type d | xargs chmod 755
218 find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
219 find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
220 cd debian/$(srcpkg)/usr/src && \
221 tar cf $(package).tar modules && \
222 $(RM) -r modules/$(package)
223 gzip -9 debian/$(srcpkg)/usr/src/$(package).tar
224 chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.gz
225 ############################ modules stuff #################################
227 build-modules: build-modules-stamp
230 -ln -s @sys/dest dest
231 -ln -s $(SYS_NAME) @sys
232 sh configure --with-afs-sysname=$(SYS_NAME) --with-linux-kernel-headers=$(KSRC)
233 make dest_only_libafs
234 touch build-modules-stamp
236 binary-modules: build-modules
241 # Setup everything first
242 -rm -rf debian/$(modulepkg) debian/substvars
243 install -d debian/$(modulepkg)
245 # Install the software
246 install -d -g root -o root -m 755 debian/$(modulepkg)/lib/modules/$(KVERS)/fs
247 install -g root -o root -m 755 dest/root.client/usr/vice/etc/modload/*.o \
248 debian/$(modulepkg)/lib/modules/$(KVERS)/fs
250 install -d -o root -g root -m 755 debian/$(modulepkg)/usr/share/doc
251 ln -s openafs-client debian/$(modulepkg)/usr/share/doc/$(modulepkg)
252 rm -rf debian/$(modulepkg)/usr/include
253 ifeq ($(KERNEL_DEPENDS),y)
254 sh debian/prep-modules $(KSRC) debian/control.module > debian/control
256 sh debian/prep-modules $(KSRC) debian/control.module-image > debian/control
259 # Install control files
260 install -d -o root -g root -m 755 debian/$(modulepkg)/DEBIAN
261 install -p -o root -g root -m 755 debian/prerm.mod \
262 debian/$(modulepkg)/DEBIAN/prerm
263 install -p -o root -g root -m 755 debian/postinst.mod \
264 debian/$(modulepkg)/DEBIAN/postinst
266 # And now.. for the final packaging!
267 find debian/$(modulepkg) -type f | grep -v "./DEBIAN" | xargs md5sum | \
268 sed -e 's#debian/$(modulepkg)/##' > debian/$(modulepkg)/DEBIAN/md5sums
270 dpkg-gencontrol -isp \
272 -v`cat debian/VERSION` \
273 -Pdebian/$(modulepkg)
274 chown -R root.root debian/$(modulepkg)
275 chmod -R go=rX debian/$(modulepkg)
276 dpkg --build debian/$(modulepkg) $(MODDIR)