Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [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-sudo.conf.in-fix-conflict-with-multilib.patch \ |
| 6 | file://0001-lib-util-mksigname.c-correctly-include-header-for-ou.patch \ |
| 7 | " |
| 8 | |
| 9 | PAM_SRC_URI = "file://sudo.pam" |
| 10 | |
| 11 | SRC_URI[sha256sum] = "44a1461098e7c7b8e6ac597499c24fb2e43748c0c139a8b4944e57d1349a64f4" |
| 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-rundir=/run/sudo \ |
| 28 | --with-vardir=/var/lib/sudo \ |
| 29 | --libexecdir=${libdir} \ |
| 30 | " |
| 31 | |
| 32 | do_install:append () { |
| 33 | if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then |
| 34 | install -D -m 644 ${WORKDIR}/sudo.pam ${D}/${sysconfdir}/pam.d/sudo |
| 35 | if ${@bb.utils.contains('PACKAGECONFIG', 'pam-wheel', 'true', 'false', d)} ; then |
| 36 | echo 'auth required pam_wheel.so use_uid' >>${D}${sysconfdir}/pam.d/sudo |
| 37 | sed -i 's/# \(%wheel ALL=(ALL) ALL\)/\1/' ${D}${sysconfdir}/sudoers |
| 38 | fi |
| 39 | fi |
| 40 | |
| 41 | chmod 4111 ${D}${bindir}/sudo |
| 42 | chmod 0440 ${D}${sysconfdir}/sudoers |
| 43 | |
| 44 | # Explicitly remove the /sudo directory to avoid QA error |
| 45 | rmdir -p --ignore-fail-on-non-empty ${D}/run/sudo |
| 46 | } |
| 47 | |
| 48 | FILES:${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/*.la \ |
| 49 | ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la" |
| 50 | |
| 51 | CONFFILES:${PN}-lib = "${sysconfdir}/sudoers" |
| 52 | |
| 53 | SUDO_PACKAGES = "${PN}-sudo\ |
| 54 | ${PN}-lib" |
| 55 | |
| 56 | PACKAGE_BEFORE_PN = "${SUDO_PACKAGES}" |
| 57 | |
| 58 | RDEPENDS:${PN}-sudo = "${PN}-lib" |
| 59 | RDEPENDS:${PN} += "${SUDO_PACKAGES}" |
| 60 | |
| 61 | FILES:${PN}-sudo = "${bindir}/sudo ${bindir}/sudoedit" |
| 62 | FILES:${PN}-lib = "${localstatedir} ${libexecdir} ${sysconfdir} ${libdir} ${nonarch_libdir}" |