1################################################################################
2#
3# sudo
4#
5################################################################################
6
7SUDO_VERSION_MAJOR = 1.9.15
8SUDO_VERSION_MINOR = p5
9SUDO_VERSION = $(SUDO_VERSION_MAJOR)$(SUDO_VERSION_MINOR)
10SUDO_SITE = https://www.sudo.ws/sudo/dist
11SUDO_LICENSE = ISC, BSD-3-Clause
12SUDO_LICENSE_FILES = LICENSE.md
13SUDO_CPE_ID_VERSION = $(SUDO_VERSION_MAJOR)
14SUDO_CPE_ID_UPDATE = $(SUDO_VERSION_MINOR)
15SUDO_SELINUX_MODULES = sudo
16# This is to avoid sudo's make install from chown()ing files which fails
17SUDO_INSTALL_TARGET_OPTS = INSTALL_OWNER="" DESTDIR="$(TARGET_DIR)" install
18SUDO_CONF_OPTS = \
19	--with-tzdir=$(if $(BR2_PACKAGE_TZDATA),/usr/share/zoneinfo,no) \
20	--enable-tmpfiles.d=$(if $(BR2_PACKAGE_SYSTEMD),/usr/lib/tmpfiles.d,no) \
21	--without-lecture \
22	--without-sendmail \
23	--without-umask \
24	--with-logging=syslog \
25	--without-interfaces \
26	--with-env-editor
27
28ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
29define SUDO_INSTALL_PAM_CONF
30	$(INSTALL) -D -m 0644 package/sudo/sudo.pam $(TARGET_DIR)/etc/pam.d/sudo
31endef
32
33SUDO_DEPENDENCIES += linux-pam
34SUDO_CONF_OPTS += --with-pam
35SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_INSTALL_PAM_CONF
36else
37SUDO_CONF_OPTS += --without-pam
38endif
39
40ifeq ($(BR2_PACKAGE_ZLIB),y)
41SUDO_CONF_OPTS += --enable-zlib
42SUDO_DEPENDENCIES += zlib
43else
44SUDO_CONF_OPTS += --disable-zlib
45endif
46
47ifeq ($(BR2_PACKAGE_OPENLDAP),y)
48SUDO_DEPENDENCIES += openldap
49SUDO_CONF_OPTS += --with-ldap
50else
51SUDO_CONF_OPTS += --without-ldap
52endif
53
54ifeq ($(BR2_PACKAGE_OPENSSL),y)
55SUDO_DEPENDENCIES += host-pkgconf openssl
56SUDO_CONF_OPTS += --enable-openssl
57else
58SUDO_CONF_OPTS += --disable-openssl
59endif
60
61define SUDO_PERMISSIONS
62	/usr/bin/sudo f 4755 0 0 - - - - -
63endef
64
65define SUDO_REMOVE_DIST_EXAMPLES
66	$(RM) $(TARGET_DIR)/etc/sudoers.dist
67	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/etc/sudoers.d
68endef
69SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_REMOVE_DIST_EXAMPLES
70
71define SUDO_USERS
72	- - sudo -1 - - - -
73endef
74
75define SUDO_ENABLE_SUDO_GROUP_RULE
76	$(SED) '/^# \%sudo\tALL=(ALL:ALL) ALL/s/^# //' $(TARGET_DIR)/etc/sudoers
77endef
78SUDO_POST_INSTALL_TARGET_HOOKS += SUDO_ENABLE_SUDO_GROUP_RULE
79
80$(eval $(autotools-package))
81