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)} \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 5 | " |
| 6 | |
| 7 | PAM_SRC_URI = "file://sudo.pam" |
| 8 | |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 9 | SRC_URI[sha256sum] = "294116cefe10a02773917fc7440d8384b925955bc96a6e0eaa1977c83b34adff" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 10 | |
| 11 | DEPENDS += " virtual/crypt ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" |
| 12 | RDEPENDS_${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-limits pam-plugin-keyinit', '', d)}" |
| 13 | |
| 14 | CACHED_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 | |
| 22 | EXTRA_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)} \ |
Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 25 | --with-rundir=/run/sudo \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 26 | --with-vardir=/var/lib/sudo \ |
| 27 | " |
| 28 | |
| 29 | do_install_append () { |
| 30 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 31 | install -D -m 644 ${WORKDIR}/sudo.pam ${D}/${sysconfdir}/pam.d/sudo |
| 32 | if ${@bb.utils.contains('PACKAGECONFIG', 'pam-wheel', 'true', 'false', d)} ; then |
| 33 | echo 'auth required pam_wheel.so use_uid' >>${D}${sysconfdir}/pam.d/sudo |
| 34 | sed -i 's/# \(%wheel ALL=(ALL) ALL\)/\1/' ${D}${sysconfdir}/sudoers |
| 35 | fi |
| 36 | fi |
| 37 | |
| 38 | chmod 4111 ${D}${bindir}/sudo |
| 39 | chmod 0440 ${D}${sysconfdir}/sudoers |
| 40 | |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 41 | # Explicitly remove the /sudo directory to avoid QA error |
Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 42 | rmdir -p --ignore-fail-on-non-empty ${D}/run/sudo |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | FILES_${PN} += "${nonarch_libdir}/tmpfiles.d" |
| 46 | FILES_${PN}-dev += "${libexecdir}/${BPN}/lib*${SOLIBSDEV} ${libexecdir}/${BPN}/*.la \ |
| 47 | ${libexecdir}/lib*${SOLIBSDEV} ${libexecdir}/*.la" |