From 5acda3eaeabae9045609539303a8c12c4ce401f1 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 25 Apr 2016 12:01:08 +0200 Subject: merge with latest dev version --- core/modules/cron/data/etc/cron.d/.placeholder | 2 ++ .../cron/data/etc/systemd/system/cron.service | 10 +++++++ .../system/multi-user.target.wants/cron.service | 1 + .../cron/data/opt/openslx/scripts/cron-sendmail | 30 ++++++++++++++++++++ core/modules/cron/module.build | 32 ++++++++++++++++++++++ core/modules/cron/module.conf | 5 ++++ 6 files changed, 80 insertions(+) create mode 100644 core/modules/cron/data/etc/cron.d/.placeholder create mode 100644 core/modules/cron/data/etc/systemd/system/cron.service create mode 120000 core/modules/cron/data/etc/systemd/system/multi-user.target.wants/cron.service create mode 100755 core/modules/cron/data/opt/openslx/scripts/cron-sendmail create mode 100644 core/modules/cron/module.build create mode 100644 core/modules/cron/module.conf (limited to 'core/modules/cron') diff --git a/core/modules/cron/data/etc/cron.d/.placeholder b/core/modules/cron/data/etc/cron.d/.placeholder new file mode 100644 index 00000000..98d2cd16 --- /dev/null +++ b/core/modules/cron/data/etc/cron.d/.placeholder @@ -0,0 +1,2 @@ +# DO NOT EDIT OR REMOVE +# This file is a simple placeholder to keep git from removing this directory diff --git a/core/modules/cron/data/etc/systemd/system/cron.service b/core/modules/cron/data/etc/systemd/system/cron.service new file mode 100644 index 00000000..d2c09ebb --- /dev/null +++ b/core/modules/cron/data/etc/systemd/system/cron.service @@ -0,0 +1,10 @@ +[Unit] +Description=Cron Daemon (cronie) +After=auditd.service nss-user-lookup.target systemd-user-sessions.service time-sync.target ypbind.service + +[Service] +ExecStart=/opt/openslx/sbin/crond -n +Restart=on-failure +ExecReload=/opt/openslx/bin/kill -HUP $MAINPID +KillMode=process + diff --git a/core/modules/cron/data/etc/systemd/system/multi-user.target.wants/cron.service b/core/modules/cron/data/etc/systemd/system/multi-user.target.wants/cron.service new file mode 120000 index 00000000..8c1084c3 --- /dev/null +++ b/core/modules/cron/data/etc/systemd/system/multi-user.target.wants/cron.service @@ -0,0 +1 @@ +../cron.service \ No newline at end of file diff --git a/core/modules/cron/data/opt/openslx/scripts/cron-sendmail b/core/modules/cron/data/opt/openslx/scripts/cron-sendmail new file mode 100755 index 00000000..3ce2a19d --- /dev/null +++ b/core/modules/cron/data/opt/openslx/scripts/cron-sendmail @@ -0,0 +1,30 @@ +#!/bin/ash + +. /opt/openslx/config + +if [ "x$SLX_CRON_MAIL" = "xslxlog" ]; then + # slxlog handling - special case + TMP=$(mktemp) + cat > "$TMP" + + SUBJ=$(grep '^Subject: .*$' "$TMP" | cut -c 10-) + + if [ -n "$SUBJ" ]; then + slxlog "cron" "$SUBJ" "$TMP" + fi + + rm -f -- "$TMP" +elif [ -n "$SLX_CRON_MAIL" ] && [ -x "$SLX_CRON_MAIL" ]; then + # see if SLX_CRON_MAIL is a valid binary and use that + $SLX_CRON_MAIL $@ +elif which sendmail 2> /dev/null; then + # fallback to sendmail + sendmail $@ +elif which logger 2> /dev/null; then + # nothing worked, write to syslog if logger is present + TMP=$(mktemp /tmp/cron.XXXXXXXX) + cat > "$TMP" + chmod 0600 "$TMP" + logger "cron tried to mail, but no mailer found! Mail dumped to $TMP" +fi + diff --git a/core/modules/cron/module.build b/core/modules/cron/module.build new file mode 100644 index 00000000..a80caf57 --- /dev/null +++ b/core/modules/cron/module.build @@ -0,0 +1,32 @@ +#!/bin/bash + + +fetch_source() { + [ -d "${MODULE_WORK_DIR}/src/.git" ] && return 0 + rm -rf -- "${MODULE_WORK_DIR}/src" + git clone --depth 1 "${REQUIRED_GIT}" "${MODULE_WORK_DIR}/src" || perror "Could not create ${MODULE_WORK_DIR}/src" + cd "${MODULE_WORK_DIR}/src" + git checkout "${REQUIRED_COMMIT}" || perror "Could not switch to required commit" + cd - +} + +build() { + + # compilation + cd "${MODULE_WORK_DIR}/src" || perror "Could not cd to '${MODULE_WORK_DIR}/src'. Did fetch_source work?" + ./autogen.sh || perror "Autogen failed" + ./configure --disable-dependency-tracking --enable-syscrontab --prefix= --exec-prefix= --bindir=/opt/openslx/bin --sbindir=/opt/openslx/sbin || perror "configure failed" + + make || perror "Could not compile cron using 'make'." + + # NO MAKE INSTALL: Copy to build dir, since there are no shared libs linked in + mkdir -p "${MODULE_BUILD_DIR}/opt/openslx/sbin" + cp "${MODULE_WORK_DIR}/src/src/crond" "${MODULE_BUILD_DIR}/opt/openslx/sbin/" || perror "Could not copy crond binary to ${MODULE_BUILD_DIR}" + + cd - &>/dev/null +} + +post_copy() { + : +} + diff --git a/core/modules/cron/module.conf b/core/modules/cron/module.conf new file mode 100644 index 00000000..60d5555d --- /dev/null +++ b/core/modules/cron/module.conf @@ -0,0 +1,5 @@ +REQUIRED_GIT="http://git.fedorahosted.org/git/cronie.git" +REQUIRED_COMMIT="bab45f0b817d8829f2423e033d90974c9a3abc20" +REQUIRED_BINARIES=" + crond +" -- cgit v1.2.3-55-g7522