1 |
commit: 70d25281d0c76654142dd60038b9b0a285455444 |
2 |
Author: David Seifert <soap <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 17 22:04:10 2023 +0000 |
4 |
Commit: David Seifert <soap <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 17 22:04:10 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=70d25281 |
7 |
|
8 |
cron.eclass: add EAPI 8 |
9 |
|
10 |
Signed-off-by: David Seifert <soap <AT> gentoo.org> |
11 |
|
12 |
eclass/cron.eclass | 85 ++++++++++++++++++++++++++---------------------------- |
13 |
1 file changed, 41 insertions(+), 44 deletions(-) |
14 |
|
15 |
diff --git a/eclass/cron.eclass b/eclass/cron.eclass |
16 |
index 3198c181f21b..ebf8ea1e824a 100644 |
17 |
--- a/eclass/cron.eclass |
18 |
+++ b/eclass/cron.eclass |
19 |
@@ -1,4 +1,4 @@ |
20 |
-# Copyright 1999-2022 Gentoo Authors |
21 |
+# Copyright 1999-2023 Gentoo Authors |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
|
24 |
# @ECLASS: cron.eclass |
25 |
@@ -6,11 +6,11 @@ |
26 |
# maintainer-needed@g.o |
27 |
# @AUTHOR: |
28 |
# Original Author: Aaron Walker <ka0ttic@g.o> |
29 |
-# @SUPPORTED_EAPIS: 6 7 |
30 |
+# @SUPPORTED_EAPIS: 6 7 8 |
31 |
# @BLURB: Some functions for cron |
32 |
# @DESCRIPTION: |
33 |
# Purpose: The main motivation for this eclass was to simplify |
34 |
-# the jungle known as src_install() in cron ebuilds. Using these |
35 |
+# the jungle known as src_install() in cron ebuilds. Using these |
36 |
# functions also ensures that permissions are *always* reset, |
37 |
# preventing the accidental installation of files with wrong perms. |
38 |
# |
39 |
@@ -18,26 +18,23 @@ |
40 |
# chosen based on the most common setting among cron ebuilds. |
41 |
|
42 |
case ${EAPI} in |
43 |
- [67]) inherit eutils ;; |
44 |
- *) die "EAPI=${EAPI:-0} is not supported" ;; |
45 |
+ 6|7|8) ;; |
46 |
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
47 |
esac |
48 |
|
49 |
-inherit flag-o-matic |
50 |
- |
51 |
-EXPORT_FUNCTIONS pkg_postinst |
52 |
- |
53 |
if [[ -z ${_CRON_ECLASS} ]]; then |
54 |
_CRON_ECLASS=1 |
55 |
|
56 |
-SLOT="0" |
57 |
+inherit flag-o-matic |
58 |
|
59 |
RDEPEND=">=sys-process/cronbase-0.3.2" |
60 |
-for pn in vixie-cron bcron cronie dcron fcron; do |
61 |
- [[ ${pn} == "${PN}" ]] || RDEPEND="${RDEPEND} !sys-process/${pn}" |
62 |
+for pn in bcron cronie dcron fcron; do |
63 |
+ [[ ${pn} == "${PN}" ]] || RDEPEND+=" !sys-process/${pn}" |
64 |
done |
65 |
+unset pn |
66 |
|
67 |
# @FUNCTION: docrondir |
68 |
-# @USAGE: [ dir ] [ perms ] |
69 |
+# @USAGE: [dir] [perms] |
70 |
# @DESCRIPTION: |
71 |
# Creates crontab directory |
72 |
# |
73 |
@@ -49,12 +46,13 @@ done |
74 |
# docrondir -m0700 (uses default dir) |
75 |
docrondir() { |
76 |
# defaults |
77 |
- local perms="-m0750 -o 0 -g cron" dir="/var/spool/cron/crontabs" |
78 |
+ local perms="-m0750 -o 0 -g cron" |
79 |
+ local dir="/var/spool/cron/crontabs" |
80 |
|
81 |
if [[ -n $1 ]] ; then |
82 |
- case "$1" in |
83 |
+ case $1 in |
84 |
*/*) |
85 |
- dir=$1 |
86 |
+ dir="$1" |
87 |
shift |
88 |
[[ -n $1 ]] && perms="$@" |
89 |
;; |
90 |
@@ -64,15 +62,14 @@ docrondir() { |
91 |
esac |
92 |
fi |
93 |
|
94 |
- diropts ${perms} |
95 |
- keepdir ${dir} |
96 |
- |
97 |
- # reset perms to default |
98 |
- diropts -m0755 |
99 |
+ ( |
100 |
+ diropts ${perms} |
101 |
+ keepdir ${dir} |
102 |
+ ) |
103 |
} |
104 |
|
105 |
# @FUNCTION: docron |
106 |
-# @USAGE: [ exe ] [ perms ] |
107 |
+# @USAGE: [exe] [perms] |
108 |
# @DESCRIPTION: |
109 |
# Install cron executable |
110 |
# |
111 |
@@ -81,40 +78,41 @@ docrondir() { |
112 |
# ex: docron -m 0700 -o 0 -g root ('exe' defaults to "cron") |
113 |
# docron crond -m 0110 |
114 |
docron() { |
115 |
- local cron="cron" perms="-m 0750 -o 0 -g wheel" |
116 |
+ local cron="cron" |
117 |
+ local perms="-m 0750 -o 0 -g wheel" |
118 |
|
119 |
if [[ -n $1 ]] ; then |
120 |
- case "$1" in |
121 |
+ case $1 in |
122 |
-*) |
123 |
perms="$@" |
124 |
;; |
125 |
*) |
126 |
- cron=$1 |
127 |
+ cron="$1" |
128 |
shift |
129 |
[[ -n $1 ]] && perms="$@" |
130 |
;; |
131 |
esac |
132 |
fi |
133 |
|
134 |
- exeopts ${perms} |
135 |
- exeinto /usr/sbin |
136 |
- doexe ${cron} || die "failed to install ${cron}" |
137 |
- |
138 |
- # reset perms to default |
139 |
- exeopts -m0755 |
140 |
+ ( |
141 |
+ exeopts ${perms} |
142 |
+ exeinto /usr/sbin |
143 |
+ doexe ${cron} |
144 |
+ ) |
145 |
} |
146 |
|
147 |
# @FUNCTION: docrontab |
148 |
-# @USAGE: [ exe ] [ perms ] |
149 |
+# @USAGE: [exe] [perms] |
150 |
# @DESCRIPTION: |
151 |
# Install crontab executable |
152 |
# |
153 |
# Uses same semantics as docron. |
154 |
docrontab() { |
155 |
- local crontab="crontab" perms="-m 4750 -o 0 -g cron" |
156 |
+ local crontab="crontab" |
157 |
+ local perms="-m 4750 -o 0 -g cron" |
158 |
|
159 |
if [[ -n $1 ]] ; then |
160 |
- case "$1" in |
161 |
+ case $1 in |
162 |
-*) |
163 |
perms="$@" |
164 |
;; |
165 |
@@ -126,15 +124,14 @@ docrontab() { |
166 |
esac |
167 |
fi |
168 |
|
169 |
- exeopts ${perms} |
170 |
- exeinto /usr/bin |
171 |
- doexe ${crontab} || die "failed to install ${crontab}" |
172 |
- |
173 |
- # reset perms to default |
174 |
- exeopts -m0755 |
175 |
+ ( |
176 |
+ exeopts ${perms} |
177 |
+ exeinto /usr/bin |
178 |
+ doexe ${crontab} |
179 |
+ ) |
180 |
|
181 |
# users expect /usr/bin/crontab to exist... |
182 |
- if [[ "${crontab##*/}" != "crontab" ]] ; then |
183 |
+ if [[ ${crontab##*/} != crontab ]] ; then |
184 |
dosym ${crontab##*/} /usr/bin/crontab || \ |
185 |
die "failed to create /usr/bin/crontab symlink" |
186 |
fi |
187 |
@@ -145,9 +142,8 @@ docrontab() { |
188 |
# Outputs a message about system crontabs |
189 |
# daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes" |
190 |
cron_pkg_postinst() { |
191 |
- echo |
192 |
# daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes" |
193 |
- if [ "${CRON_SYSTEM_CRONTAB:-no}" != "yes" ] ; then |
194 |
+ if [[ ${CRON_SYSTEM_CRONTAB:-no} != yes ]] ; then |
195 |
einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:" |
196 |
einfo " crontab /etc/crontab" |
197 |
einfo |
198 |
@@ -158,7 +154,8 @@ cron_pkg_postinst() { |
199 |
einfo "You may wish to read the Gentoo Linux Cron Guide, which can be" |
200 |
einfo "found online at:" |
201 |
einfo " https://wiki.gentoo.org/wiki/Cron" |
202 |
- echo |
203 |
} |
204 |
|
205 |
fi |
206 |
+ |
207 |
+EXPORT_FUNCTIONS pkg_postinst |