%:
dh $@ --with autoreconf,dkms,python3,systemd --parallel
+override_dh_autoreconf:
+ @# Embed the downstream version in the module.
+ @sed -e 's/^Version:.*/Version: $(DEB_VERSION_UPSTREAM)/' -i.orig META
+
+ dh_autoreconf
+
override_dh_auto_configure:
sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(LINUX_NEXT)~\)/" debian/control.in > debian/control
ifeq ($(BUILD_UDEB), true)
cat debian/control.udeb.in >> debian/control
endif
- @# Embed the downstream version in the module.
- @sed -e 's/^Version:.*/Version: $(DEB_VERSION_UPSTREAM)/' -i.orig META
-
@# Build the userland, but don't build the kernel modules.
dh_auto_configure -- \
--bindir=/usr/bin \
--with-systemdpresetdir=/lib/systemd/system-preset \
--with-config=user
+override_dh_auto_build:
+ @# Get a bare copy of the source code for DKMS.
+ @# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
+ @# contain the userland sources. NB: Remove-userland-dist-rules.patch
+ $(MAKE) distdir
+
+ dh_auto_build
+
override_dh_auto_test:
# The dh_auto_test rule is disabled because
# `make check` cannot run in an unprivileged build environment.
@# Install the utilities.
$(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
-
+ # Use upstream's bash completion
+ install -D -t '$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/' \
+ '$(CURDIR)/contrib/bash_completion.d/zfs'
+
# Move from bin_dir to /usr/sbin
# Remove suffix (.py) as per policy 10.4 - Scripts
# https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts
mv '$(CURDIR)/debian/tmp/usr/bin/dbufstat.py' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat'
@# Zed has dependencies outside of the system root.
- $(INSTALL) -d '$(CURDIR)/debian/tmp/usr/sbin/'
mv '$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
- @# Get a bare copy of the source code for DKMS.
- @# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
- @# contain the userland sources. NB: Remove-userland-dist-rules.patch
- $(MAKE) distdir
-
@# Install the DKMS source.
@# We only want the files needed to build the modules
- mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts'
- cp '$(CURDIR)/scripts/enum-extract.pl' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts'
+ install -D -t '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts' \
+ '$(CURDIR)/scripts/enum-extract.pl' \
+ '$(CURDIR)/scripts/dkms.postbuild'
$(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit 1;)
@# Hellish awk line:
@# * Deletes from configure.ac the parts not needed for building the kernel module
@# * It deletes from inside AC_CONFIG_FILES([]) everything except:
@# (Makefile$|include/|module/|*.release$)
@# * Takes care of spaces and tabs
+ @# * Remove reference to ZFS_AC_PACKAGE
awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
- '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
+ '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' | sed '/ZFS_AC_PACKAGE/d' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
@# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; ./autogen.sh
rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache'
- @# This shunt allows DKMS to install the Module.symvers and zfs_config.h
- @# files to the ${dkms_tree} area through the POST_INSTALL directive.
- printf '#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
- chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
-
mkdir -p $(CURDIR)/debian/tmp/usr/lib
for i in `ls $(CURDIR)/debian/tmp/lib/*.so`; do \
ln -s /lib/`readlink $${i}` $(CURDIR)/debian/tmp/usr/lib/`basename $${i}`; \
rm $${i}; \
done
- chmod a-x $(CURDIR)/debian/tmp/etc/zfs/zfs-functions
- chmod a-x $(CURDIR)/debian/tmp/etc/default/zfs
+ chmod a-x '$(CURDIR)/debian/tmp/etc/zfs/zfs-functions'
+ chmod a-x '$(CURDIR)/debian/tmp/etc/default/zfs'
+ chmod a-x '$(CURDIR)/debian/tmp/usr/share/bash-completion/completions/zfs'
override_dh_dkms:
- dh_dkms -V $(DEB_VERSION_UPSTREAM)
+ '$(CURDIR)/scripts/dkms.mkconf' -n $(NAME) -v $(DEB_VERSION_UPSTREAM) -f '$(CURDIR)/scripts/zfs-dkms.dkms'
+ dh_dkms
+ rm -f '$(CURDIR)/scripts/zfs-dkms.dkms'
override_dh_makeshlibs:
dh_makeshlibs -a -V
dh_installinit -r --no-start --name zfs-import
dh_installinit -r --no-start --name zfs-mount
dh_installinit -r --no-start --name zfs-share
- dh_installinit -r --no-start --name zfs-zed
- ln -sr /dev/null \
- debian/zfsutils-linux/lib/systemd/system/zfs-import.service
+ dh_installinit -R --no-start --name zfs-zed
+ mkdir -p debian/zfsutils-linux/lib/systemd/system
+ ln -sr /dev/null debian/zfsutils-linux/lib/systemd/system/zfs-import.service
# ------------