]> git.proxmox.com Git - zfsonlinux.git/blame - zfs-debian-pve/rules
install init.d file for zed
[zfsonlinux.git] / zfs-debian-pve / rules
CommitLineData
8d6c7ec5
DM
1#!/usr/bin/make -f
2
3CHMOD ?= chmod
4INSTALL ?= install
5MAKE ?= make
6
7META_NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
8VERSION := $(shell dpkg-parsechangelog \
9 | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
10REVISION := $(shell dpkg-parsechangelog \
11 | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f2-)
12
13META_DISTDIR := $(CURDIR)/$(META_NAME)-$(VERSION)/
14
15%:
16 dh $@ --with autoreconf,dkms
17
18override_dh_auto_configure:
19 @# Embed the downstream version in the module.
20 @sed \
21 -e 's/^Version:.*/Version: $(VERSION)/' \
22 -e 's/^Release:.*/Release: $(REVISION)/' \
23 -i.orig META
24
25 @# Build the userland, but don't build the kernel modules.
26 dh_auto_configure -- \
27 --bindir=/bin \
28 --sbindir=/sbin \
29 --libdir=/lib \
30 --with-udevdir=/lib/udev \
31 --with-config=user
32
33override_dh_auto_test:
34 # The dh_auto_test rule is disabled because
35 # `make check` cannot run in an unprivileged build environment.
36
37override_dh_auto_install:
38 @# Install the utilities.
39 $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
40
41 @# Get a bare copy of the source code for DKMS.
42 @# This creates the $(META_DISTDIR)/ tree.
43 $(MAKE) distdir
44
45 @# Delete components that are not required to build the kernel modules.
46 @# This prevents several lintian complaints, discourages users from
47 @# running `make install` in /usr/src, and reduces the installation
48 @# size by one third. The printf creates a dummy automake file.
49 umask 0111 && \
50 cd '$(META_DISTDIR)' && \
51 for ii in $$(find cmd dracut etc lib man rpm scripts udev -type f); do \
52 rm "$$ii"; \
53 test "$$ii" != "$${ii%.in}" && printf '%%:\n\t#\n' >"$$ii"; \
54 true; \
55 done
56
57 @# This shunt allows DKMS to copy the Module.symvers and zfs_config.h
58 @# files into the ${dkms_tree} area through the POST_INSTALL directive.
59 printf '#!/bin/sh\ncp "$$@"\n' >'$(META_DISTDIR)/cp'
60 $(CHMOD) 755 '$(META_DISTDIR)/cp'
61
62 @# Install the DKMS source directly, avoiding dh_install.
63 $(INSTALL) -d '$(CURDIR)/debian/zfs-dkms/usr/src/'
64 mv '$(META_DISTDIR)' '$(CURDIR)/debian/zfs-dkms/usr/src/'
65
66override_dh_dkms:
67 dh_dkms -V
68
69override_dh_install:
70 @# Exclude the upstream /usr/lib/udev/rules.d files.
71 dh_install -X/rules.d/
72
73 @# Ensure that /etc/zfs is in the zfsutils package
74 @# because git has difficulty tracking empty directories.
75 $(INSTALL) -d '$(CURDIR)/debian/zfsutils/etc/zfs/'
76
77 @# Resolve lintian errors regarding Debian Policy Manual Section 8.4
78 @# by moving unversioned library links from /lib to /usr/lib in the
79 @# development package. Look at libc6-dev for a packaging example if
80 @# multiarch support ever becomes a concern here.
81 $(INSTALL) -d '$(CURDIR)/debian/libzfs-dev/usr/lib/'
82 cd '$(CURDIR)/debian/libzfs-dev/lib' && \
83 for ii in $$(find -type l); do \
84 ln -s "../../lib/$$(readlink "$$ii")" "../usr/lib/$$(basename "$$ii")" \
85 && rm "$$ii"; \
86 done
87
88override_dh_installdocs:
89 dh_installdocs --link-doc=zfs-doc
90
91override_dh_installinit:
92 @# Install debian/zfsutils.zfs.default as /etc/default/zfs.
93 dh_installinit --name=zfs
94
95 @# Install the /etc/init.d/zfs-mount script.
96 @# Debian runs local mounts at sysv sequences [10..12] [08..09].
97 dh_installinit --name=zfs-mount \
98 --no-restart-on-upgrade --no-start -- defaults 13 07
99
100 @# Debian runs nfs-kernel-server at sysv sequence 17 01,
101 @# iscsitarget at 02 01, and samba at 01 02.
102 dh_installinit --name=zfs-share \
103 --no-restart-on-upgrade --no-start -- defaults 18 00
104
a7c83d2c
DM
105 @# Install the /etc/init.d/zed script.
106 dh_installinit --name=zed
107
8d6c7ec5
DM
108
109override_dh_installudev:
110 dh_installudev --name=zvol --priority=60
111 dh_installudev --name=vdev --priority=69
112
113override_dh_strip:
114 dh_strip -plibnvpair1 --dbg-package=libnvpair1-dbg
115 dh_strip -plibuutil1 --dbg-package=libuutil1-dbg
116 dh_strip -plibzfs2 --dbg-package=libzfs2-dbg
117 dh_strip -plibzpool2 --dbg-package=libzpool2-dbg
118 dh_strip -pzfsutils --dbg-package=zfsutils-dbg