xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-extended/cronie/cronie_1.6.1.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "Cron daemon for executing programs at set times"
2*4882a593SmuzhiyunDESCRIPTION = "Cronie contains the standard UNIX daemon crond that runs \
3*4882a593Smuzhiyunspecified programs at scheduled times and related tools. It is based on the \
4*4882a593Smuzhiyunoriginal cron and has security and configuration enhancements like the \
5*4882a593Smuzhiyunability to use pam and SELinux."
6*4882a593SmuzhiyunHOMEPAGE = "https://github.com/cronie-crond/cronie/"
7*4882a593SmuzhiyunBUGTRACKER = "https://bugzilla.redhat.com"
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun# Internet Systems Consortium License
10*4882a593SmuzhiyunLICENSE = "ISC & BSD-3-Clause & BSD-2-Clause & GPL-2.0-or-later"
11*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://COPYING;md5=dd2a592170760e1386c769e1043b3722 \
12*4882a593Smuzhiyun                    file://src/cron.c;endline=20;md5=b425c334265026177128353a142633b4 \
13*4882a593Smuzhiyun                    file://src/popen.c;beginline=3;endline=31;md5=edd50742d8def712e9472dba353668a9"
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSECTION = "utils"
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunUPSTREAM_CHECK_URI = "https://github.com/cronie-crond/${BPN}/releases/"
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunSRC_URI = "https://github.com/cronie-crond/cronie/releases/download/cronie-${PV}/cronie-${PV}.tar.gz \
20*4882a593Smuzhiyun           file://crond.init \
21*4882a593Smuzhiyun           file://crontab \
22*4882a593Smuzhiyun           file://crond.service \
23*4882a593Smuzhiyun           ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunPAM_SRC_URI = "file://crond_pam_config.patch"
26*4882a593SmuzhiyunPAM_DEPS = "libpam libpam-runtime pam-plugin-access pam-plugin-loginuid"
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunSRC_URI[sha256sum] = "2cd0f0dd1680e6b9c39bf1e3a5e7ad6df76aa940de1ee90a453633aa59984e62"
29*4882a593Smuzhiyun
30*4882a593Smuzhiyuninherit autotools update-rc.d useradd systemd
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunPACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunPACKAGECONFIG[audit] = "--with-audit,--without-audit,audit,"
35*4882a593SmuzhiyunPACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam,${PAM_DEPS}"
36*4882a593SmuzhiyunPACKAGECONFIG[anacron] = "--enable-anacron,--disable-anacron,anacron"
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunINITSCRIPT_NAME = "crond"
39*4882a593SmuzhiyunINITSCRIPT_PARAMS = "start 90 2 3 4 5 . stop 60 0 1 6 ."
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunUSERADD_PACKAGES = "${PN}"
42*4882a593SmuzhiyunGROUPADD_PARAM:${PN} = "--system crontab"
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "crond.service"
45*4882a593Smuzhiyun
46*4882a593Smuzhiyundo_install:append () {
47*4882a593Smuzhiyun	install -d ${D}${sysconfdir}/sysconfig/
48*4882a593Smuzhiyun	install -d ${D}${sysconfdir}/init.d/
49*4882a593Smuzhiyun	install -m 0644 ${S}/crond.sysconfig ${D}${sysconfdir}/sysconfig/crond
50*4882a593Smuzhiyun	install -m 0755 ${WORKDIR}/crond.init ${D}${sysconfdir}/init.d/crond
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun	# install systemd unit files
53*4882a593Smuzhiyun	install -d ${D}${systemd_system_unitdir}
54*4882a593Smuzhiyun	install -m 0644 ${WORKDIR}/crond.service ${D}${systemd_system_unitdir}
55*4882a593Smuzhiyun	sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
56*4882a593Smuzhiyun	       -e 's,@SBINDIR@,${sbindir},g' \
57*4882a593Smuzhiyun	       ${D}${systemd_system_unitdir}/crond.service
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun	# below are necessary for a complete cron environment
60*4882a593Smuzhiyun	install -d ${D}${localstatedir}/spool/cron
61*4882a593Smuzhiyun	install -m 0755 ${WORKDIR}/crontab ${D}${sysconfdir}/
62*4882a593Smuzhiyun	mkdir -p ${D}${sysconfdir}/cron.d
63*4882a593Smuzhiyun	mkdir -p ${D}${sysconfdir}/cron.hourly
64*4882a593Smuzhiyun	mkdir -p ${D}${sysconfdir}/cron.daily
65*4882a593Smuzhiyun	mkdir -p ${D}${sysconfdir}/cron.weekly
66*4882a593Smuzhiyun	mkdir -p ${D}${sysconfdir}/cron.monthly
67*4882a593Smuzhiyun	touch ${D}${sysconfdir}/cron.deny
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun	# below setting is necessary to allow normal user using crontab
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun	# setgid for crontab binary
72*4882a593Smuzhiyun	chown root:crontab ${D}${bindir}/crontab
73*4882a593Smuzhiyun	chmod 2755 ${D}${bindir}/crontab
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun	# allow 'crontab' group write to /var/spool/cron
76*4882a593Smuzhiyun	chown root:crontab ${D}${localstatedir}/spool/cron
77*4882a593Smuzhiyun	chmod 770 ${D}${localstatedir}/spool/cron
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun	chmod 600 ${D}${sysconfdir}/crontab
80*4882a593Smuzhiyun}
81*4882a593Smuzhiyun
82*4882a593SmuzhiyunFILES:${PN} += "${sysconfdir}/cron*"
83*4882a593SmuzhiyunCONFFILES:${PN} += "${sysconfdir}/crontab"
84