Patchwork [04/10] cronie: use useradd.bbclass instead of hardcoded groupadd calls

login
register
mail settings
Submitter Martin Jansa
Date Nov. 29, 2011, 7 a.m.
Message ID <62c60424478e493bdee61e7f3853f77feef6421d.1322549636.git.Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/15509/
State Accepted
Commit 42dde10337d464948ede8f7e7eec543f2396793e
Headers show

Comments

Martin Jansa - Nov. 29, 2011, 7 a.m.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/recipes-extended/cronie/cronie_1.4.8.bb |   33 +++++++++++--------------
 1 files changed, 15 insertions(+), 18 deletions(-)

Patch

diff --git a/meta/recipes-extended/cronie/cronie_1.4.8.bb b/meta/recipes-extended/cronie/cronie_1.4.8.bb
index 064347e..2d25627 100644
--- a/meta/recipes-extended/cronie/cronie_1.4.8.bb
+++ b/meta/recipes-extended/cronie/cronie_1.4.8.bb
@@ -18,7 +18,7 @@  DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
 RDEPENDS_${PN} = "${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_DEPS}', '', d)}"
 PAM_DEPS = "libpam libpam-runtime pam-plugin-access pam-plugin-loginuid"
 
-PR = "r1"
+PR = "r2"
 
 SRC_URI = "https://fedorahosted.org/releases/c/r/cronie/cronie-${PV}.tar.gz \
            file://crond.init \
@@ -31,7 +31,7 @@  PAM_SRC_URI = "file://crond_pam_config.patch"
 SRC_URI[md5sum] = "9b1d2ce6db8d1883e06635f437170657"
 SRC_URI[sha256sum] = "a3b910876f255712f1a5c364b74f34b0ceac9f6f3bbc45e854c5722785f513b3"
 
-inherit autotools update-rc.d
+inherit autotools update-rc.d useradd
 
 EXTRA_OECONF += "\
                 ${@base_contains('DISTRO_FEATURES', 'pam', '--with-pam', '--without-pam', d)}"
@@ -39,6 +39,9 @@  EXTRA_OECONF += "\
 INITSCRIPT_NAME = "crond"
 INITSCRIPT_PARAMS = "start 90 2 3 4 5 . stop 60 0 1 6 ."
 
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM_${PN} = "crontab"
+
 do_install_append () {
 	install -d ${D}${sysconfdir}/sysconfig/
 	install -d ${D}${sysconfdir}/init.d/
@@ -54,25 +57,19 @@  do_install_append () {
 	mkdir -p ${D}${sysconfdir}/cron.weekly
 	mkdir -p ${D}${sysconfdir}/cron.monthly
 	touch ${D}${sysconfdir}/cron.deny
-}
-
-FILES_${PN} += "${sysconfdir}/cron*"
-
-pkg_postinst_${PN} () {
-	if [ "x$D" != "x" ] ; then
-		exit 1
-	fi
-
+	
 	# below setting is necessary to allow normal user using crontab
 
-	# add 'crontab' group and setgid for crontab binary
-	grep crontab /etc/group || addgroup crontab
-	chown root:crontab /usr/bin/crontab
-	chmod 2755 /usr/bin/crontab
+	# setgid for crontab binary
+	chown root:crontab ${D}/usr/bin/crontab
+	chmod 2755 ${D}/usr/bin/crontab
 
 	# allow 'crontab' group write to /var/spool/cron
-	chown root:crontab /var/spool/cron
-	chmod 770 /var/spool/cron
+	chown root:crontab ${D}/var/spool/cron
+	chmod 770 ${D}/var/spool/cron
 
-	chmod 600 /etc/crontab
+	chmod 600 ${D}/etc/crontab
 }
+
+FILES_${PN} += "${sysconfdir}/cron*"
+