@@ -907,7 +907,7 @@ find_root_prefix() {
907907# returns: 0 on success
908908
909909preload_be_cmdline () {
910- local fs mnt args args_file deprecated need_rw zsout
910+ local fs args args_file
911911
912912 fs=" ${1} "
913913 if [ -z " ${fs} " ]; then
@@ -921,77 +921,9 @@ preload_be_cmdline() {
921921 if args=" $( read_kcl_prop " ${fs} " ) " && [ -n " ${args} " ]; then
922922 zdebug " using org.zfsbootmenu:commandline"
923923 kcl_tokenize <<< " ${args}" > " ${args_file} "
924- return 0
925- fi
926-
927- # Mount R/O to check for config files
928- if ! mnt=" $( mount_zfs " ${fs} " ) " ; then
929- zerror " unable to mount ${fs} "
930- return 1
931- fi
932-
933- if [ -r " ${mnt} /etc/default/zfsbootmenu" ]; then
934- zdebug " using ${mnt} /etc/default/zfsbootmenu"
935- kcl_tokenize < " ${mnt} /etc/default/zfsbootmenu" > " ${args_file} "
936- deprecated=" /etc/default/zfsbootmenu"
937- elif [ -r " ${mnt} /etc/default/grub" ]; then
938- zdebug " using ${mnt} /etc/default/grub"
939- echo " $(
940- # shellcheck disable=SC1090,SC1091
941- . " ${mnt} /etc/default/grub" ;
942- echo " ${GRUB_CMDLINE_LINUX_DEFAULT} "
943- ) " | kcl_tokenize > " ${args_file} "
944- deprecated=" /etc/default/grub"
945- fi
946-
947- # Always unmount, pool must be writable to perform migration
948- umount " ${mnt} " || return 1
949-
950- if [ " ${deprecated} " = " /etc/default/zfsbootmenu" ]; then
951- # Need an R/W mount to remove deprecated config
952- need_rw=" yes"
953- elif [ -z " ${deprecated} " ] || [ -n " ${zbm_ignore_kcl_deprecation} " ]; then
954- # Nothing is deprecated, so there is nothing to do
955- return 0
956- fi
957-
958- # It is not an error if user declines automatic migration
959- if ! timed_prompt -d 60 \
960- -p " Will attempt migration in $( colorize yellow " %0.2d" ) seconds" \
961- -m " $( colorize green " Using KCL from ${deprecated} on ${fs} " ) " \
962- -m " $( colorize green " This behavior is DEPRECATED and will be removed soon" ) " \
963- -m " " \
964- -m " KCL should be migrated to an $( colorize orange " org.zfsbootmenu:commandline" ) property" ; then
965-
966- # Suppress repeated messages
967- export zbm_ignore_kcl_deprecation=1
968- echo ' export zbm_ignore_kcl_deprecation="1"' >> /etc/zfsbootmenu.conf
969- return 0
970924 fi
971925
972- zdebug " migrating ${deprecated} to org.zfsbootmenu:commandline"
973-
974- # Pool must be writable to set property and remove config
975- set_rw_pool " ${fs%%/* } " || return 1
976- CLEAR_SCREEN=1 load_key " ${fs} "
977-
978- if ! mnt=" $( allow_rw=" ${need_rw} " mount_zfs " ${fs} " ) " ; then
979- zerror " unable to mount ${fs} "
980- return 1
981- fi
982-
983- args=" $( kcl_assemble < " ${args_file} " ) "
984-
985- if ! zsout=" $( zfs set org.zfsbootmenu:commandline=" ${args} " " ${fs} " 2>&1 ) " ; then
986- zerror " Unable to migrate ${deprecated} to org.zfsbootmenu:commandline: ${zsout} "
987- elif [ " ${deprecated} " = " /etc/default/zfsbootmenu" ] ; then
988- zdebug " removing ${deprecated} from ${fs} "
989- rm " ${mnt}${deprecated} " > /dev/null 2>&1
990- else
991- zdebug " not removing ${deprecated} from ${fs} "
992- fi
993-
994- umount " ${mnt} "
926+ return 0
995927}
996928
997929# arg1: ZFS filesystem
0 commit comments