blob: 9b5b2f3c69482e50a1648901c8d5ae0eb6df2ac2 [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 Geissler6ce62a22020-11-30 19:58:47 -06005 file://0001-sudo.conf.in-fix-conflict-with-multilib.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -05006 "
7
8PAM_SRC_URI = "file://sudo.pam"
9
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050010SRC_URI[sha256sum] = "28b5ee725dbf89a7852f42f309ca877d2810a9531b4eecfe59f3a84b6b4afca8"
Andrew Geissler82c905d2020-04-13 13:39:40 -050011
12DEPENDS += " virtual/crypt ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -050013RDEPENDS:${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-limits pam-plugin-keyinit', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050014
15CACHED_CONFIGUREVARS = " \
16 ac_cv_type_rsize_t=no \
17 ac_cv_path_MVPROG=${base_bindir}/mv \
18 ac_cv_path_BSHELLPROG=${base_bindir}/sh \
19 ac_cv_path_SENDMAILPROG=${sbindir}/sendmail \
20 ac_cv_path_VIPROG=${base_bindir}/vi \
21 "
22
23EXTRA_OECONF += " \
24 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)} \
25 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--enable-tmpfiles.d=${nonarch_libdir}/tmpfiles.d', '--disable-tmpfiles.d', d)} \
Andrew Geisslerb7d28612020-07-24 16:15:54 -050026 --with-rundir=/run/sudo \
Andrew Geissler82c905d2020-04-13 13:39:40 -050027 --with-vardir=/var/lib/sudo \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060028 --libexecdir=${libdir} \
Andrew Geissler82c905d2020-04-13 13:39:40 -050029 "
30
Patrick Williams213cb262021-08-07 19:21:33 -050031do_install:append () {
Andrew Geissler82c905d2020-04-13 13:39:40 -050032 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
33 install -D -m 644 ${WORKDIR}/sudo.pam ${D}/${sysconfdir}/pam.d/sudo
34 if ${@bb.utils.contains('PACKAGECONFIG', 'pam-wheel', 'true', 'false', d)} ; then
35 echo 'auth required pam_wheel.so use_uid' >>${D}${sysconfdir}/pam.d/sudo
36 sed -i 's/# \(%wheel ALL=(ALL) ALL\)/\1/' ${D}${sysconfdir}/sudoers
37 fi
38 fi
39
40 chmod 4111 ${D}${bindir}/sudo
41 chmod 0440 ${D}${sysconfdir}/sudoers
42
Andrew Geissler475cb722020-07-10 16:00:51 -050043 # Explicitly remove the /sudo directory to avoid QA error
Andrew Geisslerb7d28612020-07-24 16:15:54 -050044 rmdir -p --ignore-fail-on-non-empty ${D}/run/sudo
Andrew Geissler82c905d2020-04-13 13:39:40 -050045}
46
Patrick Williams213cb262021-08-07 19:21:33 -050047FILES:${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/*.la \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060048 ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060049
50SUDO_PACKAGES = "${PN}-sudo\
51 ${PN}-lib"
52
53PACKAGE_BEFORE_PN = "${SUDO_PACKAGES}"
54
Patrick Williams213cb262021-08-07 19:21:33 -050055RDEPENDS:${PN}-sudo = "${PN}-lib"
56RDEPENDS:${PN} += "${SUDO_PACKAGES}"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060057
Patrick Williams213cb262021-08-07 19:21:33 -050058FILES:${PN}-sudo = "${bindir}/sudo ${bindir}/sudoedit"
59FILES:${PN}-lib = "${localstatedir} ${libexecdir} ${sysconfdir} ${libdir} ${nonarch_libdir}"