Page MenuHomeFreeBSD

periodic: Honor kern.localbase
ClosedPublic

Authored by otis on Jun 6 2023, 11:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 4:56 PM
Unknown Object (File)
Mar 9 2024, 9:03 PM
Unknown Object (File)
Dec 23 2023, 12:20 AM
Unknown Object (File)
Dec 14 2023, 10:41 AM
Unknown Object (File)
Dec 12 2023, 4:18 PM
Unknown Object (File)
Dec 10 2023, 1:15 AM
Unknown Object (File)
Dec 9 2023, 5:58 AM
Unknown Object (File)
Dec 7 2023, 1:41 AM

Details

Summary

Take kern.localbase into account with fallback to /usr/local

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

otis requested review of this revision.Jun 6 2023, 11:54 AM
This revision is now accepted and ready to land.Jun 6 2023, 5:48 PM

Allow also LOCALBASE/etc/periodic.conf

This revision now requires review to proceed.Jun 8 2023, 5:27 AM

tiny nit... I think this is good otherwise

usr.sbin/periodic/periodic.sh
33

Style nit: we prefer $(foo) to foo in our scripts.

usr.sbin/periodic/periodic.sh
33

Style nit: we prefer $(foo) to foo in our scripts.

I only wanted to be consistent. There are backticks in rest of the file, I even have looked into libexec/rc/rc source where there also are backticks. Do you think it's fine to introduce this inconsistency into periodic.sh only?

imp added inline comments.
usr.sbin/periodic/periodic.sh
33

ah, ok. Then never mind. This area of the tree hasn't been updated like I thought it had.

This revision is now accepted and ready to land.Jun 15 2023, 2:50 PM
This revision was automatically updated to reflect the committed changes.
freebsd_oldach.net added inline comments.
usr.sbin/periodic/periodic.sh
35

IMHO _localbase should be marked as 'export', else the sub-shells called as ${_localbase}/etc/periodic/xxx/xxx will not see the configurations defined in ${_localbase}/etc/periodic.conf by means of source_periodic_confs.

usr.sbin/periodic/periodic.sh
35

IMHO _localbase should be marked as 'export', else the sub-shells called as ${_localbase}/etc/periodic/xxx/xxx will not see the configurations defined in ${_localbase}/etc/periodic.conf by means of source_periodic_confs.

root@b14:/usr/local/etc/periodic/otis # ls -la
total 6
drwxr-xr-x  2 root  wheel    3 Jul  7 10:13 .
drwxr-xr-x  6 root  wheel    6 Jul  7 10:12 ..
-rwxr-xr-x  1 root  wheel  195 Jul  7 10:13 otis
root@b14:/usr/local/etc/periodic/otis # cat otis
#!/bin/sh -
#
# $FreeBSD$
#

if [ -r /etc/defaults/periodic.conf ]; then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi


echo "===> ENV <==="
env
echo "===> SET <==="
set
exit 0
root@b14:/usr/local/etc/periodic/otis # periodic otis | grep localbase
_localbase=/usr/local
root@b14:/usr/local/etc/periodic/otis #
usr.sbin/periodic/periodic.sh
35

root@latitude /usr/local/etc/periodic/hmo # cat hmo
#!/bin/sh -

if [ -r /etc/defaults/periodic.conf ]; then

. /etc/defaults/periodic.conf
source_periodic_confs

fi

echo "===> ENV <==="
env
echo "===> SET <==="
set
exit 0
root@latitude /usr/local/etc/periodic/hmo # fgrep daily_tarsnap_backup_enable /usr/local/etc/periodic.conf
daily_tarsnap_backup_enable="YES"
root@latitude /usr/local/etc/periodic/hmo # periodic hmo | fgrep daily_tarsnap_backup_enable
root@latitude /usr/local/etc/periodic/hmo # echo export _localbase >>/usr/local/etc/periodic.conf
root@latitude /usr/local/etc/periodic/hmo # periodic hmo | fgrep daily_tarsnap_backup_enable
daily_tarsnap_backup_enable=YES
root@latitude /usr/local/etc/periodic/hmo #

usr.sbin/periodic/periodic.sh
35

putting things differently:

root@latitude /usr/local/etc/periodic/hmo # periodic hmo | fgrep periodic_conf_files
periodic_conf_files='/etc/periodic.conf /etc/periodic.conf.local /etc/periodic.conf'
root@latitude /usr/local/etc/periodic/hmo # echo export _localbase >>/usr/local/etc/periodic.conf
root@latitude /usr/local/etc/periodic/hmo # periodic hmo | fgrep periodic_conf_files
periodic_conf_files='/etc/periodic.conf /etc/periodic.conf.local /usr/local/etc/periodic.conf'
root@latitude /usr/local/etc/periodic/hmo #
usr.sbin/periodic/periodic.sh
35

FWIW I have just powered up a fresh FreeBSD 14.0-CURRENT #0 main-n263985-884eaacd24bd: Thu Jul 6 08:32:11 UTC 2023 from FreeBSD-14.0-CURRENT-amd64-20230706-884eaacd24bd-263985-disc1, only added the otis/otis script like you did abov, and I am not seeing a match for _localbase like you do. I suspect something is a bit different on you machine?

usr.sbin/periodic/periodic.sh
35

FWIW I have just powered up a fresh FreeBSD 14.0-CURRENT #0 main-n263985-884eaacd24bd: Thu Jul 6 08:32:11 UTC 2023 from FreeBSD-14.0-CURRENT-amd64-20230706-884eaacd24bd-263985-disc1, only added the otis/otis script like you did abov, and I am not seeing a match for _localbase like you do. I suspect something is a bit different on you machine?

My VM is a stock -CURRENT VM.

usr.sbin/periodic/periodic.sh
35

FWIW I have just powered up a fresh FreeBSD 14.0-CURRENT #0 main-n263985-884eaacd24bd: Thu Jul 6 08:32:11 UTC 2023 from FreeBSD-14.0-CURRENT-amd64-20230706-884eaacd24bd-263985-disc1, only added the otis/otis script like you did abov, and I am not seeing a match for _localbase like you do. I suspect something is a bit different on you machine?

My VM is a stock -CURRENT VM.

See https://reviews.freebsd.org/P593