Page MenuHomeFreeBSD

periodic: Honor kern.localbase
ClosedPublic

Authored by otis on Jun 6 2023, 11:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 13, 4:03 AM
Unknown Object (File)
Oct 7 2024, 11:44 PM
Unknown Object (File)
Sep 10 2024, 3:53 AM
Unknown Object (File)
Sep 8 2024, 4:50 AM
Unknown Object (File)
Sep 5 2024, 4:06 PM
Unknown Object (File)
Sep 3 2024, 8:06 AM
Unknown Object (File)
Aug 31 2024, 3:43 AM
Unknown Object (File)
Aug 18 2024, 11:21 PM

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51922
Build 48813: arc lint + arc unit

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