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

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

  ViewVC Help
Powered by ViewVC 1.1.20