summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 7da1f9ff3fbd467a712202e0532afa87010f72a5 (plain)
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
#!/usr/bin/make -f
%:
	dh $@ --with python3 \
		--builddirectory=build

export DEB_BUILD_MAINT_OPTIONS = optimize=-lto

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
CFLAGS += -I/usr/include/samba-4.0

export CK_DEFAULT_TIMEOUT=30
export am_cv_python_pythondir=/usr/lib/python3/dist-packages
export am_cv_python_pyexecdir=/usr/lib/python3/dist-packages
export systemdsystemunitdir=$(shell pkgconf --variable=systemdsystemunitdir systemd | sed s,^/,,)

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

APIDOCDIR = /usr/share/sssd
DISTRIBUTION = $(shell lsb_release -i | sed 's/.*:\t//')
PKGDATE = $(shell dpkg-parsechangelog | \
	awk -F" " '/^Date/ { print $$4 "/" $$3 "/" $$5 }' | \
	sed 's/Jan/01/;s/Feb/02/;s/Mar/03/;s/Apr/04/;s/May/05/;s/Jun/06/;s/Jul/07/;s/Aug/08/;s/Sep/09/;s/Oct/10/;s/Nov/11/;s/Dec/12/;s/\//\\\//g')
CURDATE = $(shell date +%m/%d/%Y | sed 's/\//\\\//g')
export CK_VERBOSITY=verbose

override_dh_auto_configure:
	dh_auto_configure -- --enable-krb5-locator-plugin \
	--datadir=/usr/share/ \
	--with-environment-file=/etc/default/sssd \
	--with-krb5-plugin-path=/usr/lib/$(DEB_HOST_MULTIARCH)/krb5/plugins/libkrb5 \
	--enable-nsslibdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	--enable-pammoddir=/usr/lib/$(DEB_HOST_MULTIARCH)/security \
	--enable-systemtap \
	--disable-static \
	--disable-rpath \
	--with-autofs \
	--with-crypto=libcrypto \
	--with-ssh \
	--with-initscript=systemd \
	--with-systemdunitdir=/$(systemdsystemunitdir) \
	--with-files-provider \
	--with-smb-idmap-interface-version=6 \
	--without-python2-bindings \
	--with-syslog=journald \
	--with-pid-path=/run \
	--with-sssd-user=root \
	--with-sudo \
	--with-subid \
	--with-passkey

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	export CK_TIMEOUT_MULTIPLIER=10
  ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf))
	dh_auto_test -- VERBOSE=yes
  else
	dh_auto_test -- VERBOSE=yes || true
  endif
	unset CK_TIMEOUT_MULTIPLIER
endif

override_dh_auto_install:
	dh_auto_install --max-parallel=1

override_dh_fixperms:
	dh_fixperms -Xkrb5_child -Xldap_child -Xselinux_child

override_dh_install:
	install -D -m755 $(CURDIR)/debian/generate-config \
		$(CURDIR)/debian/tmp/usr/share/sssd/generate-config

	mkdir -p $(CURDIR)/debian/libpam-sss/usr/share/pam-configs
	install -m644 debian/libpam-sss.pam-auth-update \
		$(CURDIR)/debian/libpam-sss/usr/share/pam-configs/sss
	install -m644 debian/libpam-sss-smart-card-optional.pam-auth-update \
		$(CURDIR)/debian/libpam-sss/usr/share/pam-configs/sss-smart-card-optional
	install -m644 debian/libpam-sss-smart-card-required.pam-auth-update \
		$(CURDIR)/debian/libpam-sss/usr/share/pam-configs/sss-smart-card-required
	install -m644 -D $(CURDIR)/debian/apparmor-profile \
		$(CURDIR)/debian/sssd-common/etc/apparmor.d/usr.sbin.sssd

	# remove files we don't want to install
	find $(CURDIR)/debian/tmp/ -name '*.la' -exec rm '{}' ';'
	find $(CURDIR)/debian/tmp/ -name '*.pyc' -exec rm '{}' ';'
	# We need to use '+' instead of ';' due to the way 'find' and
	# 'rm' interact with each other.
	find $(CURDIR)/debian/tmp/ -name '*.egg-info' -exec rm -r '{}' '+'
	rm -f $(CURDIR)/debian/tmp/etc/rc.d/init.d/sssd

	# match nn/nn/nnnn, replace with the date from changelog
	sed -i 's/[0-1][0-9]\/[0-3][0-9]\/[0-9][0-9][0-9][0-9]/${PKGDATE}/g' $(CURDIR)/debian/tmp/usr/share/man/man*/*

	# change the shebang
	sed -i -e 's:/usr/bin/python:/usr/bin/python3:' $(CURDIR)/debian/tmp/usr/sbin/sss_obfuscate

	mkdir -p debian/tmp/etc/krb5.conf.d
	# Enable krb5 idp plugins by default (when sssd-idp package is installed)
	cp debian/tmp/usr/share/sssd/krb5-snippets/sssd_enable_idp \
		debian/tmp/etc/krb5.conf.d/sssd_enable_idp
	# Kerberos KCM credential cache by default
	cp debian/tmp/usr/share/sssd-kcm/kcm_default_ccache \
		debian/tmp/etc/krb5.conf.d/kcm_default_ccache
	# krb5 configuration snippet
	cp debian/tmp/usr/share/sssd/krb5-snippets/enable_sssd_conf_dir \
		debian/tmp/etc/krb5.conf.d/enable_sssd_conf_dir

	dh_install

override_dh_installman:

override_dh_missing:
	dh_missing --fail-missing

override_dh_installinit:
	dh_apparmor -psssd-common --profile-name=usr.sbin.sssd
	dh_installinit --name sssd --error-handler=invoke_failure

override_dh_installdeb:
	dh_installdeb
	for pkg in sssd-common sssd-ipa sssd-krb5-common sssd-proxy; do \
		sed -i 's/@TRIPLET@/${DEB_HOST_MULTIARCH}/' \
		$(CURDIR)/debian/$$pkg/DEBIAN/postinst; \
	done

override_dh_auto_clean:
	dh_auto_clean
	rm -f $(CURDIR)/po/*.gmo
	rm -f $(CURDIR)/src/config/*.pyc
	rm -f $(CURDIR)/po/stamp-po
	rm -f $(CURDIR)/src/sbus/codegen/__pycache__/*.pyc