/[gentoo-x86]/sys-process/fcron/fcron-3.0.6-r2.ebuild
Gentoo

Contents of /sys-process/fcron/fcron-3.0.6-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Thu May 24 05:51:09 2012 UTC (2 years, 4 months ago) by vapier
Branch: MAIN
Changes since 1.2: +3 -3 lines
Inherit flag-o-matic for append-flags, and user for enewuser/etc...

(Portage version: 2.2.0_alpha107_p3/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-process/fcron/fcron-3.0.6-r2.ebuild,v 1.2 2011/08/11 10:57:54 ulm Exp $
4
5 inherit cron pam eutils flag-o-matic user
6
7 MY_P=${P/_/-}
8 DESCRIPTION="A command scheduler with extended capabilities over cron and anacron"
9 HOMEPAGE="http://fcron.free.fr/"
10 SRC_URI="http://fcron.free.fr/archives/${MY_P}.src.tar.gz"
11
12 LICENSE="GPL-2"
13 KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~sparc ~x86 ~x86-fbsd"
14 IUSE="debug pam selinux linguas_fr"
15
16 DEPEND="selinux? ( sys-libs/libselinux )
17 pam? ( virtual/pam )"
18
19 # see bug 282214 for the reason to depend on bash
20 RDEPEND="${DEPEND}
21 app-shells/bash
22 >=app-misc/editor-wrapper-3
23 pam? ( >=sys-auth/pambase-20100310 )"
24
25 S="${WORKDIR}/${MY_P}"
26
27 pkg_setup() {
28 enewgroup fcron
29 enewuser fcron -1 -1 -1 fcron
30 rootuser=$(egetent passwd 0 | cut -d ':' -f 1)
31 rootgroup=$(egetent group 0 | cut -d ':' -f 1)
32 }
33
34 src_unpack() {
35 unpack ${A}
36 cd "${S}"
37
38 # respect LDFLAGS
39 sed -i "s:\(@LIBS@\):\$(LDFLAGS) \1:" Makefile.in || die "sed failed"
40
41 sed -i -e 's:/etc/fcrontab:/etc/fcron/fcrontab:' script/check_system_crontabs.sh || die
42 }
43
44 src_compile() {
45 local myconf
46
47 # Don't try to pass --with-debug as it'll play with cflags as
48 # well, and run foreground which is a _very_ nasty idea for
49 # Gentoo.
50 use debug && append-flags -DDEBUG
51
52 [[ -n "${rootuser}" ]] && myconf="${myconf} --with-rootname=${rootuser}"
53 [[ -n "${rootgroup}" ]] && myconf="${myconf} --with-rootgroup=${rootgroup}"
54
55 econf \
56 --with-cflags="${CFLAGS}" \
57 $(use_with pam) \
58 $(use_with selinux) \
59 --sysconfdir=/etc/fcron \
60 --with-username=fcron \
61 --with-groupname=fcron \
62 --with-piddir=/var/run \
63 --with-spooldir=/var/spool/fcron \
64 --with-fifodir=/var/run \
65 --with-fcrondyn=yes \
66 --disable-checks \
67 --with-editor=/usr/libexec/editor \
68 --with-sendmail=/usr/sbin/sendmail \
69 --with-shell=/bin/sh \
70 --without-db2man --without-dsssl-dir \
71 ${myconf} \
72 || die "configure failed"
73
74 emake || die "make failed"
75
76 # bug #216460
77 sed -i \
78 -e 's:/usr/local/etc/fcron:/etc/fcron/fcron:g' \
79 -e 's:/usr/local/etc:/etc:g' \
80 -e 's:/usr/local/:/usr/:g' \
81 doc/*/*/*.{txt,1,5,8,html} \
82 || die "unable to fix documentation references"
83 }
84
85 src_install() {
86 # create directories that don't have special permissions first so
87 # that we can play with the permissions later
88 dodir /usr/bin /etc /var/spool
89
90 diropts -m6770 -o fcron -g fcron
91 keepdir /var/spool/fcron
92
93 # install fcron tools
94 insinto /usr/bin
95 dosbin fcron || die
96
97 # fcronsighup needs to be suid root, because it sends a HUP
98 # to the running fcron daemon
99 insopts -m6755 -o ${rootuser:-root} -g fcron
100 doins fcronsighup || die
101 insopts -m6755 -o fcron -g fcron
102 doins fcrondyn fcrontab || die
103 dosym /usr/bin/fcrontab /usr/bin/crontab || die
104
105 # /etc stuff
106 diropts -m0750 -o ${rootuser:-root} -g fcron
107 dodir /etc/fcron
108 insinto /etc/fcron
109 insopts -m0640 -o ${rootuser:-root} -g fcron
110 doins files/fcron.{allow,deny,conf} || die
111
112 diropts -m0755
113 insopts -m0644
114
115 # install /etc/fcrontab
116 insopts -m0640 -o ${rootuser:-root} -g ${rootgroup:-root}
117 doins "${FILESDIR}"/fcrontab || die
118
119 # install /etc/crontab
120 insinto /etc
121 insopts -m0640 -o ${rootuser:-root} -g ${rootgroup:-root}
122 doins "${FILESDIR}"/crontab || die
123
124 # install PAM files
125 pamd_mimic system-services fcron auth account session
126 cat - > "${T}"/fcrontab.pam <<EOF
127 # Don't ask for the user's password; fcrontab will only allow to
128 # change user if running as root.
129 auth sufficient pam_permit.so
130
131 # Still use the system-auth stack for account and session as the
132 # sysadmin might have set up stuff properly, and also avoids
133 # sidestepping limits (since fcrontab will run $EDITOR).
134 account include system-auth
135 session include system-auth
136 EOF
137 newpamd "${T}"/fcrontab.pam fcrontab
138
139 # install init script
140 newinitd "${FILESDIR}"/fcron.init.2 fcron || die
141
142 # install the very handy check_system_crontabs script, POSIX sh variant
143 newsbin script/check_system_crontabs.sh check_system_crontabs || die
144
145 # doc stuff
146 dodoc MANIFEST VERSION "${FILESDIR}"/crontab \
147 doc/en/txt/{readme,thanks,faq,todo,relnotes,changes}.txt \
148 || die
149 newdoc files/fcron.conf fcron.conf.sample || die
150 dohtml doc/en/HTML/*.html || die
151 doman doc/en/man/*.{1,5,8} || die
152
153 # localized docs
154 for lang in fr; do
155 use linguas_${lang} || continue
156
157 doman -i18n=${lang} doc/${lang}/man/*.{1,5,8} || die
158 docinto html/${lang}
159 dohtml doc/${lang}/HTML/*.html || die
160 done
161 }
162
163 pkg_postinst() {
164 elog
165 elog "fcron has some important differences compared to vixie-cron:"
166 elog
167 elog "1. fcron stores the crontabs in ${ROOT}var/spool/fcron"
168 elog " instead of ${ROOT}var/spool/cron/crontabs"
169 elog
170 elog "2. fcron uses a special binary file format for storing the"
171 elog " crontabs in ${ROOT}var/spool/fcron/USERNAME,"
172 elog " but the original plain text version is saved as"
173 elog " ${ROOT}var/spool/fcron/USERNAME.orig for your"
174 elog " reference (and for being edited with fcrontab)."
175 elog
176 elog "3. fcron does not feature a system crontab in exactly the"
177 elog " same way as vixie-cron does. This version of fcron"
178 elog " features a crontab for a pseudo-user 'systab' for use"
179 elog " as the system crontab. Running a command like"
180 elog
181 elog " fcrontab -u systab ${ROOT}etc/crontab"
182 elog
183 elog " will write ${ROOT}etc/crontab to the fcron crontabs directory as"
184 elog
185 elog " ${ROOT}var/spool/fcron/systab"
186 elog
187 elog " Please note that changes to ${ROOT}etc/crontab will not become"
188 elog " active automatically! fcron also does not use the directory"
189 elog " ${ROOT}etc/cron.d by default like vixie-cron does."
190 elog " Fortunately, it's possible to emulate vixie-cron's behavior"
191 elog " with regards to ${ROOT}etc/crontab and ${ROOT}etc/cron.d by using a"
192 elog " little helper script called 'check_system_crontabs'."
193 elog " The file ${ROOT}etc/fcron/fcrontab (not ${ROOT}etc/crontab!) has been set up"
194 elog " to run the script once a while to check whether"
195 elog " ${ROOT}etc/fcron/fcrontab, ${ROOT}etc/crontab or files in ${ROOT}etc/cron.d/ have"
196 elog " changed since the last generation of the systab and"
197 elog " regenerate it from those three locations as necessary."
198 elog " You should now run 'check_system_crontabs' once to properly"
199 elog " generate an initial systab:"
200 elog
201 elog " check_system_crontabs -v -i -f"
202 elog
203 elog " The file ${ROOT}etc/fcron/fcrontab should only be used to run that"
204 elog " script in order to ensure independence from the standard"
205 elog " system crontab file ${ROOT}etc/crontab."
206 elog " You may of course adjust the schedule for the script"
207 elog " 'check_system_crontabs' or any other setting in"
208 elog " ${ROOT}etc/fcron/fcrontab as you desire."
209 elog
210 elog "If you do NOT want to use 'check_system_crontabs', you"
211 elog "might still want to activate the use of the well known"
212 elog "directories ${ROOT}etc/cron.{hourly|daily|weekly|monthly} by"
213 elog "just generating a systab once from ${ROOT}etc/crontab:"
214 elog
215 elog " fcrontab -u systab ${ROOT}etc/crontab"
216 elog
217 elog "Happy fcron'ing!"
218 elog
219
220 ewarn
221 ewarn "Fixing permissions and ownership of ${ROOT}usr/bin/fcron{tab,dyn,sighup}"
222 chown fcron:fcron "${ROOT}"usr/bin/fcron{tab,dyn} >&/dev/null
223 chown ${rootuser:-root}:fcron "${ROOT}"usr/bin/fcronsighup >&/dev/null
224 chmod 6755 "${ROOT}"usr/bin/fcron{tab,dyn,sighup} >&/dev/null
225 ewarn "Fixing permissions and ownership of ${ROOT}etc/{fcron,crontab}"
226 chown -R ${rootuser:-root}:fcron "${ROOT}"etc/{fcron,crontab} >&/dev/null
227 chmod -R g+rX,o= "${ROOT}"etc/fcron "${ROOT}"etc/{fcron,crontab} >&/dev/null
228 ewarn
229
230 ewarn
231 ewarn "WARNING: fcron now uses a dedicated user and group"
232 ewarn "'fcron' for the suid/sgid programs/files instead of"
233 ewarn "the user and group 'cron' that were previously used."
234 ewarn
235 ewarn "fcron usage can now only be restricted by adding users"
236 ewarn "to the following files instead of to the group 'cron':"
237 ewarn
238 ewarn " ${ROOT}etc/fcron/fcron.allow"
239 ewarn " ${ROOT}etc/fcron/fcron.deny"
240 ewarn
241
242 if ls -1 "${ROOT}"var/spool/cron/fcrontabs/* >&/dev/null; then
243 ewarn
244 ewarn "WARNING: fcron now uses a dedicated fcron-specific"
245 ewarn "spooldir ${ROOT}var/spool/fcron instead of the commonly"
246 ewarn "used ${ROOT}var/spool/cron for several reasons."
247 ewarn
248 ewarn "Copying over existing crontabs from ${ROOT}var/spool/cron/fcrontabs"
249 cp "${ROOT}"var/spool/cron/fcrontabs/* "${ROOT}"var/spool/fcron/ >&/dev/null \
250 || die "failed to migrate existing crontabs"
251 ewarn "You should now remove ${ROOT}var/spool/cron/fcrontabs!"
252 ewarn
253 ewarn "Fixing permissions and ownership of ${ROOT}var/spool/fcron"
254 chown root:root "${ROOT}"var/spool/fcron/* >&/dev/null
255 chmod 0600 "${ROOT}"var/spool/fcron/* >&/dev/null
256 chown fcron:fcron "${ROOT}"var/spool/fcron/*.orig >&/dev/null
257 chmod 0640 "${ROOT}"var/spool/fcron/*.orig >&/dev/null
258 ewarn
259 ewarn "*** YOU SHOULD IMMEDIATELY UPDATE THE"
260 ewarn "*** fcrontabs ENTRY IN ${ROOT}etc/fcron/fcron.conf"
261 ewarn "*** AND RESTART YOUR FCRON DAEMON!"
262 fi
263
264 elog ""
265 elog "Since version 3.0.5 the fcron init script will no longer wait for LDAP, MySQL"
266 elog "or PostgreSQL before starting. If you need any of these for authentication or"
267 elog "for jobs that are executed by fcron, please create a /etc/conf.d/fcron file to"
268 elog "set the rc_need variable to the list of services you should be waiting for."
269 elog ""
270 }

  ViewVC Help
Powered by ViewVC 1.1.20