blob: aac505af601841b0fec97f35913340a3979d08e9 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001require sudo.inc
2
3SRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \
4 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
Andrew Geissler82c905d2020-04-13 13:39:40 -05005 "
6
7PAM_SRC_URI = "file://sudo.pam"
8
Andrew Geissler475cb722020-07-10 16:00:51 -05009SRC_URI[sha256sum] = "294116cefe10a02773917fc7440d8384b925955bc96a6e0eaa1977c83b34adff"
Andrew Geissler82c905d2020-04-13 13:39:40 -050010
11DEPENDS += " virtual/crypt ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
12RDEPENDS_${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-limits pam-plugin-keyinit', '', d)}"
13
14CACHED_CONFIGUREVARS = " \
15 ac_cv_type_rsize_t=no \
16 ac_cv_path_MVPROG=${base_bindir}/mv \
17 ac_cv_path_BSHELLPROG=${base_bindir}/sh \
18 ac_cv_path_SENDMAILPROG=${sbindir}/sendmail \
19 ac_cv_path_VIPROG=${base_bindir}/vi \
20 "
21
22EXTRA_OECONF += " \
23 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \
24 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-tmpfiles.d=${nonarch_libdir}/tmpfiles.d', '--disable-tmpfiles.d', d)} \
25 --with-vardir=/var/lib/sudo \
26 "
27
28do_install_append () {
29 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
30 install -D -m 644 ${WORKDIR}/sudo.pam ${D}/${sysconfdir}/pam.d/sudo
31 if ${@bb.utils.contains('PACKAGECONFIG', 'pam-wheel', 'true', 'false', d)} ; then
32 echo 'auth required pam_wheel.so use_uid' >>${D}${sysconfdir}/pam.d/sudo
33 sed -i 's/# \(%wheel ALL=(ALL) ALL\)/\1/' ${D}${sysconfdir}/sudoers
34 fi
35 fi
36
37 chmod 4111 ${D}${bindir}/sudo
38 chmod 0440 ${D}${sysconfdir}/sudoers
39
Andrew Geissler475cb722020-07-10 16:00:51 -050040 # Explicitly remove the /sudo directory to avoid QA error
41 rmdir -p --ignore-fail-on-non-empty ${D}/sudo
Andrew Geissler82c905d2020-04-13 13:39:40 -050042}
43
44FILES_${PN} += "${nonarch_libdir}/tmpfiles.d"
45FILES_${PN}-dev += "${libexecdir}/${BPN}/lib*${SOLIBSDEV} ${libexecdir}/${BPN}/*.la \
46 ${libexecdir}/lib*${SOLIBSDEV} ${libexecdir}/*.la"