From 58ead426f46f6ff5271e69f52c8827776eb243bd Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Thu, 20 Jun 2019 13:42:07 +0200 Subject: [PATCH] Migrate to dh from cdbs --- debian/compat | 1 - debian/control | 3 +- debian/{useradd.default => default/useradd} | 0 debian/login.install | 1 + debian/passwd.install | 2 + debian/rules | 59 ++++++++------------- debian/{shadowconfig.sh => shadowconfig} | 0 7 files changed, 27 insertions(+), 39 deletions(-) delete mode 100644 debian/compat rename debian/{useradd.default => default/useradd} (100%) rename debian/{shadowconfig.sh => shadowconfig} (100%) diff --git a/debian/compat b/debian/compat deleted file mode 100644 index f599e28b..00000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/control b/debian/control index b8d8ac36..2d08a2ac 100644 --- a/debian/control +++ b/debian/control @@ -8,13 +8,12 @@ Priority: required Build-Depends: dh-autoreconf, gettext, libpam0g-dev, - debhelper (>= 10~), + debhelper-compat (= 12), quilt, xsltproc, docbook-xsl, docbook-xml, libxml2-utils, - cdbs, libselinux1-dev [linux-any], libsemanage1-dev [linux-any], gnome-doc-utils, diff --git a/debian/useradd.default b/debian/default/useradd similarity index 100% rename from debian/useradd.default rename to debian/default/useradd diff --git a/debian/login.install b/debian/login.install index 71b494bc..23fa7c82 100644 --- a/debian/login.install +++ b/debian/login.install @@ -1,3 +1,4 @@ +debian/login.defs etc usr/share/locale/*/LC_MESSAGES/shadow.mo usr/share/man/*/man1/login.1 usr/share/man/*/man1/newgrp.1 diff --git a/debian/passwd.install b/debian/passwd.install index c443627c..3e68feb3 100644 --- a/debian/passwd.install +++ b/debian/passwd.install @@ -1,3 +1,5 @@ +debian/default/useradd etc/default +debian/shadowconfig sbin usr/bin/chage usr/bin/chfn usr/bin/chsh diff --git a/debian/rules b/debian/rules index c61e6234..121a22b0 100755 --- a/debian/rules +++ b/debian/rules @@ -1,16 +1,13 @@ #!/usr/bin/make -f # -*- mode: makefile; coding: utf-8 -*- -DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) - # Enable PIE, BINDNOW, and possible future flags. export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk -# Call autoreconf since we need to regenerate all the autofoo files -include /usr/share/cdbs/1/rules/autoreconf.mk -include /usr/share/cdbs/1/rules/debhelper.mk + +# TODO test if this can be dropped: # Specify where dh_install will find the files that it needs to move: DEB_DH_INSTALL_SOURCEDIR=debian/tmp # Specify the destination of shadow's "make install" @@ -18,8 +15,6 @@ DEB_DH_INSTALL_SOURCEDIR=debian/tmp # the other arch, DEB_DESTDIR already points to debian/tmp) DEB_DESTDIR=$(CURDIR)/debian/tmp -include /usr/share/cdbs/1/class/autotools.mk - # Adds extra options when calling the configure script: DEB_CONFIGURE_EXTRA_FLAGS := --disable-shared \ --without-libcrack \ @@ -33,55 +28,45 @@ DEB_CONFIGURE_EXTRA_FLAGS := --disable-shared \ --without-attr \ --without-tcb \ SHELL=/bin/sh -ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) - DEB_CONFIGURE_EXTRA_FLAGS += --host=$(DEB_HOST_GNU_TYPE) -endif # Set the default editor for vipw/vigr -CFLAGS += -DDEFAULT_EDITOR=\\\"sensible-editor\\\" +CFLAGS += -DDEFAULT_EDITOR="\"sensible-editor\"" -# Add extras to the install process: -binary-install/login:: +%: + dh $@ + +override_dh_auto_configure: + dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) + +override_dh_install-arch: +ifneq ($(DEB_HOST_ARCH_OS),linux) + sed -i 's/session optional pam_keyinit.so/# Linux only # session optional pam_keyinit.so/' debian/login.pam +endif + dh_install -a ifeq ($(DEB_HOST_ARCH_OS),hurd) # /bin/login is provided by the hurd package. rm -f debian/login/bin/login endif -ifneq ($(DEB_HOST_ARCH_OS),linux) - sed -i 's/session optional pam_keyinit.so/# Linux only # session optional pam_keyinit.so/' debian/login.pam -endif - dh_installpam -p login - install -c -m 444 debian/login.defs debian/login/etc/login.defs - dh_lintian -p login -binary-install/passwd:: - install -c -m 444 man/shadowconfig.8 debian/passwd/usr/share/man/man8 - install -c -m 444 man/ja/shadowconfig.8 debian/passwd/usr/share/man/ja/man8 - install -c -m 444 man/pl/shadowconfig.8 debian/passwd/usr/share/man/pl/man8 - install -c -m 444 man/fr/shadowconfig.8 debian/passwd/usr/share/man/fr/man8 +override_dh_installpam: # Distribute the pam.d files; unless for the commands with disabled PAM # support + dh_installpam -p login dh_installpam -p passwd --name=passwd dh_installpam -p passwd --name=chfn dh_installpam -p passwd --name=chsh dh_installpam -p passwd --name=chpasswd dh_installpam -p passwd --name=newusers - install -c -m 644 debian/useradd.default debian/passwd/etc/default/useradd - install -d debian/passwd/sbin - install -c -m 555 debian/shadowconfig.sh debian/passwd/sbin/shadowconfig - install -c -m 444 debian/cpgr.8 debian/passwd/usr/share/man/man8 - install -c -m 444 debian/cppw.8 debian/passwd/usr/share/man/man8 - dh_lintian -p passwd -binary-predeb/uidmap:: +override_dh_builddeb-arch: + # uidmap chmod u+s debian/uidmap/usr/bin/newuidmap chmod u+s debian/uidmap/usr/bin/newgidmap - -binary-predeb/login:: + # login # No real need for login to be setuid root # chmod u+s debian/login/bin/login chmod u+s debian/login/usr/bin/newgrp - -binary-predeb/passwd:: + # passwd chmod u+s debian/passwd/usr/bin/chfn chmod u+s debian/passwd/usr/bin/chsh chmod u+s debian/passwd/usr/bin/gpasswd @@ -90,6 +75,8 @@ binary-predeb/passwd:: chgrp shadow debian/passwd/usr/bin/expiry chmod g+s debian/passwd/usr/bin/chage chmod g+s debian/passwd/usr/bin/expiry + dh_builddeb -a -clean:: +override_dh_auto_clean: sed -i 's/# Linux only # //' debian/login.pam + dh_auto_clean diff --git a/debian/shadowconfig.sh b/debian/shadowconfig similarity index 100% rename from debian/shadowconfig.sh rename to debian/shadowconfig