summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/cron.eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'eclass/cron.eclass')
-rw-r--r--eclass/cron.eclass161
1 files changed, 161 insertions, 0 deletions
diff --git a/eclass/cron.eclass b/eclass/cron.eclass
new file mode 100644
index 000000000000..1d97df3f73c3
--- /dev/null
+++ b/eclass/cron.eclass
@@ -0,0 +1,161 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: cron
+# @MAINTAINER:
+# cron-bugs@gentoo.org
+# @AUTHOR:
+# Original Author: Aaron Walker <ka0ttic@gentoo.org>
+# @BLURB: Some functions for cron
+# @DESCRIPTION:
+# Purpose: The main motivation for this eclass was to simplify
+# the jungle known as src_install() in cron ebuilds. Using these
+# functions also ensures that permissions are *always* reset,
+# preventing the accidental installation of files with wrong perms.
+#
+# NOTE on defaults: the default settings in the below functions were
+# chosen based on the most common setting among cron ebuilds.
+#
+# Please assign any bugs regarding this eclass to cron-bugs@gentoo.org.
+
+inherit eutils flag-o-matic
+
+EXPORT_FUNCTIONS pkg_postinst
+
+SLOT="0"
+
+DEPEND=">=sys-apps/sed-4.0.5"
+
+RDEPEND=">=sys-process/cronbase-0.3.2"
+for pn in vixie-cron bcron cronie dcron fcron; do
+ [[ ${pn} == "${PN}" ]] || RDEPEND="${RDEPEND} !sys-process/${pn}"
+done
+
+# @FUNCTION: docrondir
+# @USAGE: [ dir ] [ perms ]
+# @DESCRIPTION:
+# Creates crontab directory
+#
+# Both arguments are optional. Everything after 'dir' is considered
+# the permissions (same format as insopts).
+#
+# ex: docrondir /some/dir -m 0770 -o root -g cron
+# docrondir /some/dir (uses default perms)
+# docrondir -m0700 (uses default dir)
+
+docrondir() {
+ # defaults
+ local perms="-m0750 -o root -g cron" dir="/var/spool/cron/crontabs"
+
+ if [[ -n $1 ]] ; then
+ case "$1" in
+ */*)
+ dir=$1
+ shift
+ [[ -n $1 ]] && perms="$@"
+ ;;
+ *)
+ perms="$@"
+ ;;
+ esac
+ fi
+
+ diropts ${perms}
+ keepdir ${dir}
+
+ # reset perms to default
+ diropts -m0755
+}
+
+# @FUNCTION: docron
+# @USAGE: [ exe ] [ perms ]
+# @DESCRIPTION:
+# Install cron executable
+#
+# Both arguments are optional.
+#
+# ex: docron -m 0700 -o root -g root ('exe' defaults to "cron")
+# docron crond -m 0110
+
+docron() {
+ local cron="cron" perms="-m 0750 -o root -g wheel"
+
+ if [[ -n $1 ]] ; then
+ case "$1" in
+ -*)
+ perms="$@"
+ ;;
+ *)
+ cron=$1
+ shift
+ [[ -n $1 ]] && perms="$@"
+ ;;
+ esac
+ fi
+
+ exeopts ${perms}
+ exeinto /usr/sbin
+ doexe ${cron} || die "failed to install ${cron}"
+
+ # reset perms to default
+ exeopts -m0755
+}
+
+# @FUNCTION: docrontab
+# @USAGE: [ exe ] [ perms ]
+# @DESCRIPTION:
+# Install crontab executable
+#
+# Uses same semantics as docron.
+
+docrontab() {
+ local crontab="crontab" perms="-m 4750 -o root -g cron"
+
+ if [[ -n $1 ]] ; then
+ case "$1" in
+ -*)
+ perms="$@"
+ ;;
+ *)
+ crontab=$1
+ shift
+ [[ -n $1 ]] && perms="$@"
+ ;;
+ esac
+ fi
+
+ exeopts ${perms}
+ exeinto /usr/bin
+ doexe ${crontab} || die "failed to install ${crontab}"
+
+ # reset perms to default
+ exeopts -m0755
+
+ # users expect /usr/bin/crontab to exist...
+ if [[ "${crontab##*/}" != "crontab" ]] ; then
+ dosym ${crontab##*/} /usr/bin/crontab || \
+ die "failed to create /usr/bin/crontab symlink"
+ fi
+}
+
+# @FUNCTION: cron_pkg_postinst
+# @DESCRIPTION:
+# Outputs a message about system crontabs
+# daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes"
+cron_pkg_postinst() {
+ echo
+ # daemons that have a true system crontab set CRON_SYSTEM_CRONTAB="yes"
+ if [ "${CRON_SYSTEM_CRONTAB:-no}" != "yes" ] ; then
+ einfo "To activate /etc/cron.{hourly|daily|weekly|monthly} please run:"
+ einfo " crontab /etc/crontab"
+ einfo
+ einfo "!!! That will replace root's current crontab !!!"
+ einfo
+ fi
+
+ einfo "You may wish to read the Gentoo Linux Cron Guide, which can be"
+ einfo "found online at:"
+ einfo " http://www.gentoo.org/doc/en/cron-guide.xml"
+ echo
+}