Teach 'hostname' script how to act inside a jail.

No objections from:	mtm, arch@
This commit is contained in:
Pawel Jakub Dawidek 2004-03-05 09:17:01 +00:00
parent 799969be75
commit 303d38369a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126647

View File

@ -39,12 +39,20 @@ stop_cmd=":"
hostname_start()
{
# Set the host name if it is not already set
# If we are not inside a jail, set the host name if it is not already set.
# If we are inside a jail, set the host name even if it is already set,
# but first check if it is permitted.
#
if [ -z "`hostname -s`" ]; then
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
if [ `$SYSCTL_N security.jail.set_hostname_allowed` -eq 0 ]; then
return
fi
elif [ -n "`hostname -s`" ]; then
return
fi
hostname ${hostname}
echo "Setting hostname: `hostname`."
fi
}
load_rc_config $name