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