summaryrefslogtreecommitdiff
path: root/sbin/reboot/nextboot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/reboot/nextboot.sh')
-rw-r--r--sbin/reboot/nextboot.sh21
1 files changed, 11 insertions, 10 deletions
diff --git a/sbin/reboot/nextboot.sh b/sbin/reboot/nextboot.sh
index e975215f695a5..c2d1076337b96 100644
--- a/sbin/reboot/nextboot.sh
+++ b/sbin/reboot/nextboot.sh
@@ -33,6 +33,7 @@ delete="NO"
kenv=
force="NO"
nextboot_file="/boot/nextboot.conf"
+zfs=
add_kenv()
{
@@ -106,26 +107,26 @@ if [ -n "${kernel}" -a ${force} = "NO" -a ! -d /boot/${kernel} ]; then
exit 1
fi
-df -Tn "/boot/" 2>/dev/null | while read _fs _type _other ; do
+zfs=$(df -Tn "/boot/" 2>/dev/null | while read _fs _type _other ; do
[ "zfs" = "${_type}" ] || continue
- cat 1>&2 <<-EOF
- WARNING: loader(8) has only R/O support for ZFS
- nextboot.conf will NOT be reset in case of kernel boot failure
- EOF
-done
+ echo "${_fs%/ROOT/*}"
+done)
set -e
nextboot_tmp=$(mktemp $(dirname ${nextboot_file})/nextboot.XXXXXX)
-if [ ${append} = "YES" -a -f ${nextboot_file} ]; then
- cp -f ${nextboot_file} ${nextboot_tmp}
-fi
-
+if [ -n ${zfs} ]; then
+ zfsbootcfg -z ${zfs} -n freebsd:nvstore -k nextboot_enable -v YES
+ cat >> ${nextboot_tmp} << EOF
+$kenv
+EOF
+else
cat >> ${nextboot_tmp} << EOF
nextboot_enable="YES"
$kenv
EOF
+fi
fsync ${nextboot_tmp}