blob: ba610ee2e77149e4cc9fab9045c3980456251ce4 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001require 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)} \
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
9PAM_SRC_URI = "file://sudo.pam"
10
Andrew Geissler615f2f12022-07-15 14:00:58 -050011SRC_URI[sha256sum] = "4687e7d2f56721708f59cca2e1352c056cb23de526c22725615a42bb094f1f70"
Andrew Geissler9aee5002022-03-30 16:27:02 +000012
13DEPENDS += " virtual/crypt ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
14RDEPENDS:${PN} += " ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-limits pam-plugin-keyinit', '', d)}"
15
16CACHED_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
24EXTRA_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
32do_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
48FILES:${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/*.la \
49 ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la"
50
51CONFFILES:${PN}-lib = "${sysconfdir}/sudoers"
52
53SUDO_PACKAGES = "${PN}-sudo\
54 ${PN}-lib"
55
56PACKAGE_BEFORE_PN = "${SUDO_PACKAGES}"
57
58RDEPENDS:${PN}-sudo = "${PN}-lib"
59RDEPENDS:${PN} += "${SUDO_PACKAGES}"
60
61FILES:${PN}-sudo = "${bindir}/sudo ${bindir}/sudoedit"
62FILES:${PN}-lib = "${localstatedir} ${libexecdir} ${sysconfdir} ${libdir} ${nonarch_libdir}"