blob: d6bc1a9c3a7f764be87a4a767b80f59edaba9dfb [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)} \
Andrew Geisslerb7d28612020-07-24 16:15:54 -050025 --with-rundir=/run/sudo \
Andrew Geissler82c905d2020-04-13 13:39:40 -050026 --with-vardir=/var/lib/sudo \
27 "
28
29do_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 Geissler475cb722020-07-10 16:00:51 -050041 # Explicitly remove the /sudo directory to avoid QA error
Andrew Geisslerb7d28612020-07-24 16:15:54 -050042 rmdir -p --ignore-fail-on-non-empty ${D}/run/sudo
Andrew Geissler82c905d2020-04-13 13:39:40 -050043}
44
45FILES_${PN} += "${nonarch_libdir}/tmpfiles.d"
46FILES_${PN}-dev += "${libexecdir}/${BPN}/lib*${SOLIBSDEV} ${libexecdir}/${BPN}/*.la \
47 ${libexecdir}/lib*${SOLIBSDEV} ${libexecdir}/*.la"