cronie: miscellaneous fixes (#10389)

move settings back to /system/settings and adjust documentation
create crond user for the daemon to use
fix sendmail paths
fix standard PATH variable for jobs
This commit is contained in:
augiedoggie
2024-05-01 00:04:56 -06:00
committed by GitHub
parent 6b5724682f
commit bafd44ed4e
8 changed files with 88 additions and 33 deletions

View File

@@ -3,4 +3,4 @@ SHELL=/bin/bash
PATH=/boot/home/config/non-packaged/bin:/boot/home/config/bin:/boot/system/non-packaged/bin:/boot/system/bin
MAILTO=""
# If you change the username of UID 0 then you must change "user" below to match
01 * * * * user run-parts /etc/cron.hourly
01 * * * * user run-parts /boot/system/settings/cron.hourly

View File

@@ -1,4 +1,4 @@
# /etc/anacrontab: configuration file for anacron
# /boot/system/settings/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
@@ -11,6 +11,6 @@ RANDOM_DELAY=45
START_HOURS_RANGE=3-22
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly
1 5 cron.daily nice run-parts /boot/system/settings/cron.daily
7 25 cron.weekly nice run-parts /boot/system/settings/cron.weekly
@monthly 45 cron.monthly nice run-parts /boot/system/settings/cron.monthly

View File

@@ -1 +1 @@
# without this file, only users listed in /etc/cron.allow can use crontab
# without this file, only users listed in /boot/system/settings/cron.allow can use crontab

View File

@@ -0,0 +1,8 @@
#!/bin/sh
# for our pid file
install -d -m 755 -o 0 -g 0 `finddir B_SYSTEM_VAR_DIRECTORY`/run
# create our spool dirs
spoolDir=`finddir B_SYSTEM_SPOOL_DIRECTORY`
install -d $spoolDir/cron $spoolDir/anacron

View File

@@ -1,7 +1,7 @@
job x-vnd.cronie-crond {
launch @CROND_BIN@ -n -P -s
launch @CROND_BIN@ -n -P
on initial_volumes_mounted
no_safemode
legacy

View File

@@ -1,4 +1,4 @@
# /etc/crontab: configuration file for cron
# /boot/system/settings/crontab: configuration file for cron
# See cron(8) and crontab(5) for details.

View File

@@ -14,10 +14,11 @@ LICENSE="
ISC
MIT
"
REVISION="2"
REVISION="3"
SOURCE_URI="https://github.com/cronie-crond/cronie/archive/cronie-$portVersion.tar.gz"
CHECKSUM_SHA256="241ecc1dcd8d4b2a6744fe93509932254d20b7bb9d979d27429809493806357f"
SOURCE_DIR="cronie-cronie-$portVersion"
PATCHES="cronie-$portVersion.patchset"
ADDITIONAL_FILES="
0anacron
0hourly
@@ -25,25 +26,28 @@ ADDITIONAL_FILES="
cron.deny
crontab
cronie.launch.in
cronie-finish-setup.sh
"
GLOBAL_WRITABLE_FILES="
settings/anacrontab keep-old
settings/cron.deny keep-old
settings/cron.d/0hourly keep-old
settings/cron.hourly/0anacron keep-old
settings/cron.daily directory keep-old
settings/cron.weekly directory keep-old
settings/cron.monthly directory keep-old
settings/crontab keep-old
"
POST_INSTALL_SCRIPTS="$relativePostInstallDir/cronie-finish-setup.sh"
PACKAGE_USERS="
crond real-name \"cron daemon user\" home \"/var/empty\" shell \"/bin/true\" groups \"crond\"
"
PACKAGE_GROUPS="crond"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
GLOBAL_WRITABLE_FILES="
settings/etc/anacrontab keep-old
settings/etc/cron.deny keep-old
settings/etc/cron.d/0hourly keep-old
settings/etc/cron.hourly/0anacron keep-old
settings/etc/cron.daily directory keep-old
settings/etc/cron.weekly directory keep-old
settings/etc/cron.monthly directory keep-old
settings/etc/crontab keep-old
var/run directory keep-old
var/spool/cron directory keep-old
var/spool/anacron directory keep-old
"
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
@@ -81,15 +85,31 @@ BUILD_PREREQUIRES="
cmd:libtoolize$secondaryArchSuffix
"
PATCH()
{
# adjust documentation to match layout
sed -i \
-e "s,/etc/cron,$settingsDir/cron," \
-e "s,/etc/anacron,$settingsDir/anacron," \
man/*.{1,5,8}
# adjust sendmail path
sed -i "s,/usr/sbin/sendmail,/bin/sendmail," src/cron.c anacron/global.h
}
BUILD()
{
./autogen.sh
runConfigure --omit-dirs "binDir sbinDir sysconfDir" ./configure \
CFLAGS="-D_PATH_STDPATH='\"`findpaths -c: B_FIND_PATH_BIN_DIRECTORY`\"'" \
MAILARG="/bin/sendmail" \
runConfigure --omit-dirs "binDir sbinDir" ./configure \
--bindir=$commandBinDir \
--sbindir=$commandBinDir \
--sysconfdir=$settingsDir/etc \
--with-editor=nano \
--enable-anacron
--enable-anacron \
--with-daemon_username=crond \
--with-daemon_groupname=crond
make $jobArgs
}
@@ -100,16 +120,18 @@ INSTALL()
chmod u+s $commandBinDir/crontab
install -d $localStateDir/spool/{ana,}cron $localStateDir/run
install -d $settingsDir/etc/cron.{d,hourly,daily,weekly,monthly}
install -d $settingsDir/cron.{d,hourly,daily,weekly,monthly}
install -Dm0644 $portDir/additional-files/cron.deny $settingsDir/etc/cron.deny
install -Dm0644 $portDir/additional-files/crontab $settingsDir/etc/crontab
install -Dm0644 $portDir/additional-files/anacrontab $settingsDir/etc/anacrontab
install -Dm0644 $portDir/additional-files/0hourly $settingsDir/etc/cron.d/0hourly
install -Dm0755 $portDir/additional-files/0anacron $settingsDir/etc/cron.hourly/0anacron
install -Dm0644 $portDir/additional-files/cron.deny $settingsDir/cron.deny
install -Dm0644 $portDir/additional-files/crontab $settingsDir/crontab
install -Dm0644 $portDir/additional-files/anacrontab $settingsDir/anacrontab
install -Dm0644 $portDir/additional-files/0hourly $settingsDir/cron.d/0hourly
install -Dm0755 $portDir/additional-files/0anacron $settingsDir/cron.hourly/0anacron
install -d $dataDir/launch
sed -e "s|@CROND_BIN@|$commandBinDir/crond|" \
$portDir/additional-files/cronie.launch.in > $dataDir/launch/cronie.launch
install -Dm0755 $portDir/additional-files/cronie-finish-setup.sh \
$postInstallDir/cronie-finish-setup.sh
}

View File

@@ -0,0 +1,25 @@
From 97de1e4777755e8e8c81f5d826fabbf56540468e Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Tue, 30 Apr 2024 21:12:16 -0600
Subject: allow overriding sendmail path for MAILARG
diff --git a/configure.ac b/configure.ac
index c84edbd..a2c6d3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -194,7 +194,10 @@ fi
AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.])
-AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
+AC_PATH_PROG(MAILARG, sendmail, , $PATH:/usr/lib:/usr/sbin )
+if test "$MAILARG" != "" ; then
+ AC_DEFINE_UNQUOTED(MAILARG,"$MAILARG",[There will be path to sendmail.])
+fi
AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f %s",
[-i = don't terminate on "." by itself
--
2.43.2