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

Diff of /eclass/cron.eclass

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

Revision 1.3 Revision 1.9
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.3 2005/03/04 23:25:25 ciaranm Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/cron.eclass,v 1.9 2005/09/06 04:20:02 vapier 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}
26 virtual/libc
27 >=sys-apps/sed-4.0.5" 23DEPEND=">=sys-apps/sed-4.0.5"
28 24
29RDEPEND="${RDEPEND} 25RDEPEND="!virtual/cron
30 !virtual/cron
31 virtual/mta 26 virtual/mta
32 >=sys-process/cronbase-0.2.1-r3" 27 >=sys-process/cronbase-0.2.1-r3"
33 28
34PROVIDE="virtual/cron" 29PROVIDE="virtual/cron"
35 30
45# docrondir -m0700 (uses default dir) 40# docrondir -m0700 (uses default dir)
46 41
47docrondir() { 42docrondir() {
48 # defaults 43 # defaults
49 local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs" 44 local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs"
50 45
51 if [[ -n "$1" ]] ; then 46 if [[ -n $1 ]] ; then
52 case "$1" in 47 case "$1" in
53 */*) 48 */*)
54 dir="$1" 49 dir=$1
55 shift 50 shift
56 [[ -n "$1" ]] && perms="$@" 51 [[ -n $1 ]] && perms="$@"
57 ;; 52 ;;
58 *) 53 *)
59 perms="$@" 54 perms="$@"
60 ;; 55 ;;
61 esac 56 esac
76# 71#
77# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron") 72# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron")
78# docron crond -m 0110 73# docron crond -m 0110
79 74
80docron() { 75docron() {
81 local cron="cron" perms="-m 0750 -o root -g root" 76 local cron="cron" perms="-m 0750 -o root -g wheel"
82 77
83 if [[ -n "$1" ]] ; then 78 if [[ -n $1 ]] ; then
84 case "$1" in 79 case "$1" in
85 -*) 80 -*)
86 perms="$@" 81 perms="$@"
87 ;; 82 ;;
88 *) 83 *)
89 cron="$1" 84 cron=$1
90 shift 85 shift
91 [[ -n "$1" ]] && perms="$@" 86 [[ -n $1 ]] && perms="$@"
92 ;; 87 ;;
93 esac 88 esac
94 fi 89 fi
95 90
96 exeopts ${perms} 91 exeopts ${perms}
108# Uses same semantics as docron. 103# Uses same semantics as docron.
109 104
110docrontab() { 105docrontab() {
111 local crontab="crontab" perms="-m 4750 -o root -g cron" 106 local crontab="crontab" perms="-m 4750 -o root -g cron"
112 107
113 if [[ -n "$1" ]] ; then 108 if [[ -n $1 ]] ; then
114 case "$1" in 109 case "$1" in
115 -*) 110 -*)
116 perms="$@" 111 perms="$@"
117 ;; 112 ;;
118 *) 113 *)
119 crontab="$1" 114 crontab=$1
120 shift 115 shift
121 [[ -n "$1" ]] && perms="$@" 116 [[ -n $1 ]] && perms="$@"
122 ;; 117 ;;
123 esac 118 esac
124 fi 119 fi
125 120
126 exeopts ${perms} 121 exeopts ${perms}
135 dosym ${crontab##*/} /usr/bin/crontab || \ 130 dosym ${crontab##*/} /usr/bin/crontab || \
136 die "failed to create /usr/bin/crontab symlink" 131 die "failed to create /usr/bin/crontab symlink"
137 fi 132 fi
138} 133}
139 134
140cron-pkg_postinst() { 135cron_pkg_postinst() {
141 echo 136 echo
142 # vixie is the only daemon that has a true system crontab 137 # vixie is the only daemon that has a true system crontab
143 if [[ "${PN}" != "vixie-cron" ]] ; then 138 if [[ "${PN}" != "vixie-cron" ]] ; then
144 einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:" 139 einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:"
145 einfo " crontab /etc/crontab" 140 einfo " crontab /etc/crontab"
146 einfo 141 einfo
147 einfo "!!! That will replace root's current crontab !!!" 142 einfo "!!! That will replace root's current crontab !!!"
148 einfo 143 einfo
149 fi 144 fi
150 145
151 einfo "You may wish to read the Gentoo Linux Cron Guide, which can be" 146 einfo "You may wish to read the Gentoo Linux Cron Guide, which can be"
152 einfo "found online at:" 147 einfo "found online at:"
153 einfo " http://www.gentoo.org/doc/en/cron-guide.xml" 148 einfo " http://www.gentoo.org/doc/en/cron-guide.xml"
154 echo 149 echo
155} 150}

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20