/[gentoo-x86]/eclass/cron.eclass
Gentoo

Diff of /eclass/cron.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.8
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/cron.eclass,v 1.1 2005/01/15 12:37:53 ka0ttic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cron.eclass,v 1.8 2005/07/11 15:08:06 swegener Exp $
4 4
5# Original Author: Aaron Walker <ka0ttic@gentoo.org> 5# Original Author: Aaron Walker <ka0ttic@gentoo.org>
6# 6#
7# Purpose: The main motivation for this eclass was to simplify 7# Purpose: The main motivation for this eclass was to simplify
8# the jungle known as src_install() in cron ebuilds. Using these 8# the jungle known as src_install() in cron ebuilds. Using these
14# 14#
15# Please assign any bugs regarding this eclass to cron-bugs@gentoo.org. 15# Please assign any bugs regarding this eclass to cron-bugs@gentoo.org.
16 16
17inherit eutils flag-o-matic 17inherit eutils flag-o-matic
18 18
19ECLASS="cron"
20INHERITED="$INHERITED $ECLASS"
21EXPORT_FUNCTIONS pkg_postinst 19EXPORT_FUNCTIONS pkg_postinst
22 20
23SLOT="0" 21SLOT="0"
24 22
25DEPEND="${DEPEND} 23DEPEND="virtual/libc
26 virtual/libc
27 >=sys-apps/sed-4.0.5" 24 >=sys-apps/sed-4.0.5"
28 25
29RDEPEND="${RDEPEND} 26RDEPEND="!virtual/cron
30 !virtual/cron
31 virtual/mta 27 virtual/mta
32 >=sys-apps/cronbase-0.2.1-r3" 28 >=sys-process/cronbase-0.2.1-r3"
33 29
34PROVIDE="virtual/cron" 30PROVIDE="virtual/cron"
35 31
36# docrondir [ dir ] [ perms ] 32# docrondir [ dir ] [ perms ]
37# 33#
45# docrondir -m0700 (uses default dir) 41# docrondir -m0700 (uses default dir)
46 42
47docrondir() { 43docrondir() {
48 # defaults 44 # defaults
49 local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs" 45 local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs"
50 46
51 if [[ -n "$1" ]] ; then 47 if [[ -n "$1" ]] ; then
52 case "$1" in 48 case "$1" in
53 */*) 49 */*)
54 dir="$1" 50 dir="$1"
55 shift 51 shift
76# 72#
77# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron") 73# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron")
78# docron crond -m 0110 74# docron crond -m 0110
79 75
80docron() { 76docron() {
81 local cron="cron" perms="-m 0750 -o root -g root" 77 local cron="cron" perms="-m 0750 -o root -g wheel"
82 78
83 if [[ -n "$1" ]] ; then 79 if [[ -n "$1" ]] ; then
84 case "$1" in 80 case "$1" in
85 -*) 81 -*)
86 perms="$@" 82 perms="$@"
135 dosym ${crontab##*/} /usr/bin/crontab || \ 131 dosym ${crontab##*/} /usr/bin/crontab || \
136 die "failed to create /usr/bin/crontab symlink" 132 die "failed to create /usr/bin/crontab symlink"
137 fi 133 fi
138} 134}
139 135
140# dopamd [ file ] [ new file ]
141#
142# Install pam auth config file in /etc/pam.d
143#
144# NOTE: this would make much more sense as a portage script (eg. doenvd)
145#
146# The first argument, 'file' is required. Install as 'new file', if
147# specified.
148
149dopamd() {
150 local pamd="${1}" newpamd="${2:-${1}}"
151 [[ -z "${1}" ]] && die "dopamd requires at least one argument."
152
153 insinto /etc/pam.d
154 # these are the default doins options, but be explicit just in case
155 insopts -m 0644 -o root -g root
156 newins ${pamd} ${newpamd} || die "failed to install ${newpamd}"
157}
158
159cron-pkg_postinst() { 136cron_pkg_postinst() {
160 echo 137 echo
161 # vixie is the only daemon that has a true system crontab 138 # vixie is the only daemon that has a true system crontab
162 if [[ "${PN}" != "vixie-cron" ]] ; then 139 if [[ "${PN}" != "vixie-cron" ]] ; then
163 einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:" 140 einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:"
164 einfo " crontab /etc/crontab" 141 einfo " crontab /etc/crontab"
165 einfo 142 einfo
166 einfo "!!! That will replace root's current crontab !!!" 143 einfo "!!! That will replace root's current crontab !!!"
167 einfo 144 einfo
168 fi 145 fi
169 146
170 einfo "You may wish to read the Gentoo Linux Cron Guide, which can be" 147 einfo "You may wish to read the Gentoo Linux Cron Guide, which can be"
171 einfo "found online at:" 148 einfo "found online at:"
172 einfo " http://www.gentoo.org/doc/en/cron-guide.xml" 149 einfo " http://www.gentoo.org/doc/en/cron-guide.xml"
173 echo 150 echo
174} 151}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20