summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-02-15 21:58:52 +0000
committergjb <gjb@FreeBSD.org>2016-02-15 21:58:52 +0000
commit64f34d0d7173b140b57c4ae2501a2f2c88a1ff4d (patch)
treea25465f4b4e80a989a48831c78025037d9013781 /etc/rc.d
parente4997c6184529300b3b432e327408ba7c6a89645 (diff)
parent197e3760ab195e2d3b05357e36b2f8857258d71a (diff)
downloadFreeBSD-src-64f34d0d7173b140b57c4ae2501a2f2c88a1ff4d.zip
FreeBSD-src-64f34d0d7173b140b57c4ae2501a2f2c88a1ff4d.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/jail29
-rwxr-xr-xetc/rc.d/ntpd8
2 files changed, 29 insertions, 8 deletions
diff --git a/etc/rc.d/jail b/etc/rc.d/jail
index b33f1b9..f7d6d3d 100755
--- a/etc/rc.d/jail
+++ b/etc/rc.d/jail
@@ -33,7 +33,8 @@ need_dad_wait=
# set it to $param. If not defined, $defval is used.
# When $num is [0-9]*, ${jail_$jv_$name$num} are looked up and
# $param is set by using +=. $num=0 is optional (params may start at 1).
-# When $num is YN or NY, the value is interpret as boolean.
+# When $num is YN or NY, the value is interpreted as boolean.
+# When $num is @, the value is interpreted as an array separted by IFS.
extract_var()
{
local i _jv _name _param _num _def _name1 _name2
@@ -78,6 +79,20 @@ extract_var()
i=$(($i + 1))
done
;;
+ @)
+ _name1=jail_${_jv}_${_name}
+ _name2=jail_${_name}
+ eval _tmpargs=\"\${$_name1:-\${$_name2:-$_def}}\"
+ set -- $_tmpargs
+ if [ $# -gt 0 ]; then
+ echo -n " $_param = "
+ while [ $# -gt 1 ]; do
+ echo -n "\"$1\", "
+ shift
+ done
+ echo "\"$1\";"
+ fi
+ ;;
*)
_name1=jail_${_jv}_${_name}
_name2=jail_${_name}
@@ -190,7 +205,7 @@ parse_options()
allow.raw_sockets NY YES
else
echo " vnet;"
- extract_var $_jv vnet_interface vnet.interface - ""
+ extract_var $_jv vnet_interface vnet.interface @ ""
fi
echo " exec.clean;"
@@ -521,7 +536,11 @@ jail_stop()
command=$jail_program
rc_flags=$jail_flags
command_args="-f $jail_conf -r"
- $jail_jls name | while read _j; do
+ if checkyesno jail_reverse_stop; then
+ $jail_jls name | tail -r
+ else
+ $jail_jls name
+ fi | while read _j; do
echo -n " $_j"
_tmp=`mktemp -t jail` || exit 3
$command $rc_flags $command_args $_j >> $_tmp 2>&1
@@ -536,6 +555,7 @@ jail_stop()
return
;;
esac
+ checkyesno jail_reverse_stop && set -- $(reverse_list $@)
for _j in $@; do
_j=$(echo $_j | tr /. _)
_jv=$(echo -n $_j | tr -c '[:alnum:]' _)
@@ -571,5 +591,6 @@ jail_warn()
load_rc_config $name
case $# in
1) run_rc_command $@ ${jail_list:-_ALL} ;;
-*) run_rc_command $@ ;;
+*) jail_reverse_stop="no"
+ run_rc_command $@ ;;
esac
diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd
index 7f28358..fe2fc4b 100755
--- a/etc/rc.d/ntpd
+++ b/etc/rc.d/ntpd
@@ -28,14 +28,14 @@ ntpd_precmd()
rc_flags="-g $rc_flags"
fi
- if [ -z "$ntpd_chrootdir" ]; then
- return 0;
- fi
-
if [ ! -f $ntp_db_leapfile ]; then
ntpd_fetch_leapfile
fi
+ if [ -z "$ntpd_chrootdir" ]; then
+ return 0;
+ fi
+
# If running in a chroot cage, ensure that the appropriate files
# exist inside the cage, as well as helper symlinks into the cage
# from outside.
OpenPOWER on IntegriCloud