xref: /openbmc/openbmc/poky/meta/recipes-extended/sudo/sudo_1.9.16p2.bb (revision 8460358c3d24c71d9d38fd126c745854a6301564)
1*8460358cSPatrick Williamsrequire sudo.inc
2*8460358cSPatrick Williams
3*8460358cSPatrick WilliamsSRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \
4*8460358cSPatrick Williams           ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
5*8460358cSPatrick Williams           file://0001-sudo.conf.in-fix-conflict-with-multilib.patch \
6*8460358cSPatrick Williams           "
7*8460358cSPatrick Williams
8*8460358cSPatrick WilliamsPAM_SRC_URI = "file://sudo.pam"
9*8460358cSPatrick Williams
10*8460358cSPatrick WilliamsSRC_URI[sha256sum] = "976aa56d3e3b2a75593307864288addb748c9c136e25d95a9cc699aafa77239c"
11*8460358cSPatrick Williams
12*8460358cSPatrick WilliamsDEPENDS += " virtual/crypt ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
13*8460358cSPatrick WilliamsRDEPENDS:${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-limits pam-plugin-keyinit', '', d)}"
14*8460358cSPatrick Williams
15*8460358cSPatrick WilliamsCACHED_CONFIGUREVARS = " \
16*8460358cSPatrick Williams        ac_cv_type_rsize_t=no \
17*8460358cSPatrick Williams        ac_cv_path_MVPROG=${base_bindir}/mv \
18*8460358cSPatrick Williams        ac_cv_path_BSHELLPROG=${base_bindir}/sh \
19*8460358cSPatrick Williams        ac_cv_path_SENDMAILPROG=${sbindir}/sendmail \
20*8460358cSPatrick Williams        ac_cv_path_VIPROG=${base_bindir}/vi \
21*8460358cSPatrick Williams        "
22*8460358cSPatrick Williams
23*8460358cSPatrick WilliamsEXTRA_OECONF += " \
24*8460358cSPatrick Williams             ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \
25*8460358cSPatrick Williams             ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-tmpfiles.d=${nonarch_libdir}/tmpfiles.d', '--disable-tmpfiles.d', d)} \
26*8460358cSPatrick Williams             --with-rundir=/run/sudo \
27*8460358cSPatrick Williams             --with-vardir=/var/lib/sudo \
28*8460358cSPatrick Williams             --libexecdir=${libdir} \
29*8460358cSPatrick Williams             "
30*8460358cSPatrick Williams
31*8460358cSPatrick Williamsdo_install:append () {
32*8460358cSPatrick Williams	if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
33*8460358cSPatrick Williams		install -D -m 644 ${UNPACKDIR}/sudo.pam ${D}/${sysconfdir}/pam.d/sudo
34*8460358cSPatrick Williams		if ${@bb.utils.contains('PACKAGECONFIG', 'pam-wheel', 'true', 'false', d)} ; then
35*8460358cSPatrick Williams			echo 'auth       required     pam_wheel.so use_uid' >>${D}${sysconfdir}/pam.d/sudo
36*8460358cSPatrick Williams			sed -i 's/# \(%wheel ALL=(ALL) ALL\)/\1/' ${D}${sysconfdir}/sudoers
37*8460358cSPatrick Williams		fi
38*8460358cSPatrick Williams	fi
39*8460358cSPatrick Williams
40*8460358cSPatrick Williams	chmod 4111 ${D}${bindir}/sudo
41*8460358cSPatrick Williams	chmod 0440 ${D}${sysconfdir}/sudoers
42*8460358cSPatrick Williams
43*8460358cSPatrick Williams	# Explicitly remove the /sudo directory to avoid QA error
44*8460358cSPatrick Williams	rmdir -p --ignore-fail-on-non-empty ${D}/run/sudo
45*8460358cSPatrick Williams}
46*8460358cSPatrick Williams
47*8460358cSPatrick WilliamsFILES:${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/*.la \
48*8460358cSPatrick Williams                    ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la"
49*8460358cSPatrick Williams
50*8460358cSPatrick WilliamsCONFFILES:${PN}-lib = "${sysconfdir}/sudoers"
51*8460358cSPatrick Williams
52*8460358cSPatrick WilliamsSUDO_PACKAGES = "${PN}-sudo\
53*8460358cSPatrick Williams                 ${PN}-lib"
54*8460358cSPatrick Williams
55*8460358cSPatrick WilliamsPACKAGE_BEFORE_PN = "${SUDO_PACKAGES}"
56*8460358cSPatrick Williams
57*8460358cSPatrick WilliamsRDEPENDS:${PN}-sudo = "${PN}-lib"
58*8460358cSPatrick WilliamsRDEPENDS:${PN} += "${SUDO_PACKAGES}"
59*8460358cSPatrick Williams
60*8460358cSPatrick WilliamsFILES:${PN}-sudo = "${bindir}/sudo ${bindir}/sudoedit"
61*8460358cSPatrick WilliamsFILES:${PN}-lib = "${localstatedir} ${libexecdir} ${sysconfdir} ${libdir} ${nonarch_libdir}"
62