periodic: set _localbase for periodic scripts from within periodic.conf
Set _localbase variable from within /etc/defaults/periodic.conf
for use by periodic scripts.
This fixes e5d7100c09, no other functional changes intended.
Reported by: gahr, otis
Reviewed by: markj, gahr
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47486
This commit is contained in:
@@ -15,6 +15,15 @@
|
||||
#
|
||||
#
|
||||
|
||||
_set_localbase() {
|
||||
_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null`
|
||||
# Set default value of _localbase if not previously set
|
||||
: ${_localbase:="/usr/local"}
|
||||
}
|
||||
|
||||
# Set _localbase with fallback to /usr/local
|
||||
_set_localbase
|
||||
|
||||
# What files override these defaults ?
|
||||
periodic_conf_files="/etc/periodic.conf /etc/periodic.conf.local ${_localbase}/etc/periodic.conf"
|
||||
|
||||
|
||||
@@ -29,14 +29,6 @@ if [ $# -lt 1 ] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null`
|
||||
# Set default value of _localbase if not previously set
|
||||
: ${_localbase:="/usr/local"}
|
||||
|
||||
# Use a deterministic path to match the preset from /etc/crontab in case
|
||||
# periodic is run interactively.
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${_localbase}/sbin:${_localbase}/bin
|
||||
|
||||
# If possible, check the global system configuration file,
|
||||
# to see if there are additional dirs to check
|
||||
if [ -r /etc/defaults/periodic.conf ]; then
|
||||
@@ -44,6 +36,10 @@ if [ -r /etc/defaults/periodic.conf ]; then
|
||||
source_periodic_confs
|
||||
fi
|
||||
|
||||
# Use a deterministic path to match the preset from /etc/crontab in case
|
||||
# periodic is run interactively.
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:${_localbase}/sbin:${_localbase}/bin
|
||||
|
||||
host=`hostname`
|
||||
export host
|
||||
|
||||
|
||||
Reference in New Issue
Block a user