File tree Expand file tree Collapse file tree 7 files changed +68
-4
lines changed
Expand file tree Collapse file tree 7 files changed +68
-4
lines changed Original file line number Diff line number Diff line change 77[33mzfsbootmenu[0m
88 Launch the interactive boot environment menu.
99
10- [33mzfs-chroot[0m [1mzfs filesystem [0m
10+ [33mzfs-chroot[0m [1mfilesystem [0m
1111 Enter a chroot of the specified boot environment. The boot environment is mounted [33mread/write[0m if the zpool is imported [33mread/write[0m.
1212
13+ [33mzkexec[0m [1mfilesystem[0m [1mkernel[0m [1minitramfs[0m
14+ Directly [33mkexec[0m a kernel and initramfs from a boot environment, allowing any kernel and initramfs to be loaded into memory and
15+ immediately booted.
16+
1317[33mset_rw_pool[0m [1mpool[0m
1418 Export, then re-import the pool [33mread/write[0m.
1519
Original file line number Diff line number Diff line change 77[33mzfsbootmenu[0m
88 Launch the interactive boot environment menu.
99
10- [33mzfs-chroot[0m [1mzfs filesystem [0m
10+ [33mzfs-chroot[0m [1mfilesystem [0m
1111 Enter a chroot of the specified boot environment.
1212 The boot environment is mounted [33mread/write[0m if the
1313 zpool is imported [33mread/write[0m.
1414
15+ [33mzkexec[0m [1mfilesystem[0m [1mkernel[0m [1minitramfs[0m
16+ Directly [33mkexec[0m a kernel and initramfs from a boot
17+ environment, allowing any kernel and initramfs to be
18+ loaded into memory and immediately booted.
19+
1520[33mset_rw_pool[0m [1mpool[0m
1621 Export, then re-import the pool [33mread/write[0m.
1722
Original file line number Diff line number Diff line change 77[33mzfsbootmenu[0m
88 Launch the interactive boot environment menu.
99
10- [33mzfs-chroot[0m [1mzfs filesystem [0m
10+ [33mzfs-chroot[0m [1mfilesystem [0m
1111 Enter a chroot of the specified boot environment. The boot environment is mounted [33mread/write[0m
1212 if the zpool is imported [33mread/write[0m.
1313
14+ [33mzkexec[0m [1mfilesystem[0m [1mkernel[0m [1minitramfs[0m
15+ Directly [33mkexec[0m a kernel and initramfs from a boot environment, allowing any kernel and
16+ initramfs to be loaded into memory and immediately booted.
17+
1418[33mset_rw_pool[0m [1mpool[0m
1519 Export, then re-import the pool [33mread/write[0m.
1620
Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ install() {
156156 inst_simple " ${moddir} /zfsbootmenu.sh" " /bin/zfsbootmenu" || _ret=$?
157157 inst_simple " ${moddir} /zlogtail.sh" " /bin/zlogtail" || _ret=$?
158158 inst_simple " ${moddir} /ztrace.sh" " /bin/ztrace" || _ret=$?
159+ inst_simple " ${moddir} /zkexec.sh" " /bin/zkexec" || _ret=$?
159160 inst_hook cmdline 95 " ${moddir} /zfsbootmenu-parse-commandline.sh" || _ret=$?
160161 inst_hook pre-mount 90 " ${moddir} /zfsbootmenu-preinit.sh" || _ret=$?
161162
Original file line number Diff line number Diff line change @@ -70,3 +70,34 @@ _mount_zfs() {
7070 COMPREPLY=( $( compgen -W " ${ZFS[*]} " -- " ${COMP_WORDS[1]} " ) )
7171}
7272complete -F _mount_zfs mount_zfs
73+
74+ _zkexec () {
75+ local ARG index
76+ COMPREPLY=()
77+
78+ shopt -s nullglob
79+
80+ index=" ${# COMP_WORDS[@]} "
81+ case " ${index} " in
82+ 2)
83+ for FS in $( zfs list -H -o name ) ; do
84+ ARG+=(" ${FS} " )
85+ done
86+
87+ COMPREPLY=( $( compgen -W " ${ARG[*]} " -- " ${COMP_WORDS[1]} " ) )
88+ ;;
89+ 3|4)
90+ mp=" $( mount_zfs " ${COMP_WORDS[1]} " ) "
91+ [ -d " ${mp} /boot" ] || return
92+
93+ for BIN in " ${mp} " /boot/* ; do
94+ BIN=" ${BIN##*/ } "
95+ ARG+=(" ${BIN} " )
96+ done
97+ umount " ${mp} "
98+ COMPREPLY=( $( compgen -W " ${ARG[*]} " -- " ${COMP_WORDS[$(( index - 1))]} " ) )
99+ ;;
100+ esac
101+
102+ }
103+ complete -F _zkexec zkexec
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # shellcheck disable=SC1091
4+ [ -f /lib/zfsbootmenu-lib.sh ] && source /lib/zfsbootmenu-lib.sh
5+
6+ if [ $# -ne 3 ] ; then
7+ echo " Usage: $0 filesystem kernel initramfs"
8+ exit
9+ fi
10+
11+ fs=" ${1} "
12+ kernel=" /boot/${2} "
13+ initramfs=" /boot/${3} "
14+
15+ kexec_kernel " ${fs} ${kernel} ${initramfs} "
Original file line number Diff line number Diff line change @@ -12,10 +12,14 @@ B<zfsbootmenu> - Recovery Shell
1212
1313Launch the interactive boot environment menu.
1414
15- =item I<zfs-chroot> B<zfs filesystem>
15+ =item I<zfs-chroot> B<filesystem>
1616
1717Enter a chroot of the specified boot environment. The boot environment is mounted I<read/write> if the zpool is imported I<read/write>.
1818
19+ =item I<zkexec> B<filesystem> B<kernel> B<initramfs>
20+
21+ Directly I<kexec> a kernel and initramfs from a boot environment, allowing any kernel and initramfs to be loaded into memory and immediately booted.
22+
1923=item I<set_rw_pool> B<pool>
2024
2125Export, then re-import the pool I<read/write>.
You can’t perform that action at this time.
0 commit comments