/[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.1.1.1
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.1.1.1 2005/11/30 09:59:18 chriswhite 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-apps/cronbase-0.2.1-r3" 27 >=sys-process/cronbase-0.2.1-r3"
33 28
34PROVIDE="virtual/cron" 29PROVIDE="virtual/cron"
35 30
36# docrondir [ dir ] [ perms ] 31# docrondir [ dir ] [ perms ]
37# 32#
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
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() { 135cron_pkg_postinst() {
160 echo 136 echo
161 # vixie is the only daemon that has a true system crontab 137 # vixie is the only daemon that has a true system crontab
162 if [[ "${PN}" != "vixie-cron" ]] ; then 138 if [[ "${PN}" != "vixie-cron" ]] ; then
163 einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:" 139 einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:"
164 einfo " crontab /etc/crontab" 140 einfo " crontab /etc/crontab"
165 einfo 141 einfo
166 einfo "!!! That will replace root's current crontab !!!" 142 einfo "!!! That will replace root's current crontab !!!"
167 einfo 143 einfo
168 fi 144 fi
169 145
170 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"
171 einfo "found online at:" 147 einfo "found online at:"
172 einfo " http://www.gentoo.org/doc/en/cron-guide.xml" 148 einfo " http://www.gentoo.org/doc/en/cron-guide.xml"
173 echo 149 echo
174} 150}

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

  ViewVC Help
Powered by ViewVC 1.1.20