diff --git a/bootiso b/bootiso index 3b97c0c..75e1ce5 100755 --- a/bootiso +++ b/bootiso @@ -132,6 +132,7 @@ typeset -A st_userVars=( ['remote-bootloader']='' ['part-type']='' ['data-part-fs']='' + ['assume-image-is']='' ) # oo.ooooo. .oooo. oooo d8b @@ -169,6 +170,7 @@ typeset disableConfirmation typeset disableHashCheck typeset disableWimsplit typeset disableDeviceEjection +typeset assumeImageIs # oooo # `888 @@ -803,6 +805,7 @@ typeset -Ar asrt_userVarsCompatibilityMatrix=( ['part-type']='format install-mount-rsync' ['dd-bs']='install-image-copy' ['data-part-fs']='install-image-copy' + ['assume-image-is']='install-auto install-mount-rsync install-image-copy' ) typeset -Ar ct_userFlagsCompatibilityMatrix=( ['assume-yes']='install-auto install-mount-rsync install-image-copy format' @@ -2209,6 +2212,13 @@ function step_parseArguments() { _setUserVar 'fs' "${2,,}" #lowercased shift 2 ;; + --assume-image-is) + if (($# < 2)); then + ps_failAndExit SYNOPSIS_NONCOMPL "Missing value for '$1' flag. Please provide an image type (one of: hybrid, non-hybrid)." + fi + _setUserVar 'assume-image-is' "${2,,}" #lowercased + shift 2 + ;; --data-part-fs) if (($# < 2)); then ps_failAndExit SYNOPSIS_NONCOMPL "Missing value for '$1' flag. Please provide a filesystem type." @@ -2330,6 +2340,7 @@ function step_assignInternalVariables() { targetBootloaderVersion=${st_userVars['remote-bootloader']:-'auto'} targetDDBusSize=${st_userVars['dd-bs']:-'4M'} targetDataPartFstype=${st_userVars['data-part-fs']:-'vfat'} + assumeImageIs=${st_userVars['assume-image-is']:-''} # Action-dependent flags case $targetAction in install-*) @@ -2543,11 +2554,11 @@ function exec_probe() { } function exec_installMountRsync() { - if [ "${st_isoInspections[isHybrid]}" == true ]; then + if [[ "${st_isoInspections[isHybrid]}" == true && "${assumeImageIs}" != "non-hybrid" ]]; then ps_failAndExit ASSERTION_FAILED "You cannot set Mount-Rsync mode with a hybrid image file." \ "Hybrid ISO or disk image files eventually contain multiple partitions and Mount-Rsync mode can only work with one." \ "If you think this image file is not hybrid and this is a bug, please report at " \ - "${ct_ticketsURL}." + "${ct_ticketsURL}. You can also use $(term_boldify "--assume-image-is non-hybrid") flag to bypass this check." fi st_shouldMakePartition=true asrt_checkSyslinuxInstall @@ -2564,11 +2575,11 @@ function exec_installMountRsync() { } function exec_installImageCopy() { - if [ "${st_isoInspections[isHybrid]}" == false ]; then + if [[ "${st_isoInspections[isHybrid]}" == false && "${assumeImageIs}" != "hybrid" ]]; then ps_failAndExit ASSERTION_FAILED "You cannot set Image-Copy mode with a non-hybrid, 'El-Torito' image file." \ "El-Torito image files don't have a partition table; and thus target device will not be recognized" \ "by any boot system as a boot candidate. If you think this image file is hybrid and this is a bug, please report at " \ - "${ct_ticketsURL}." + "${ct_ticketsURL}. You can also use $(term_boldify "--assume-image-is hybrid") flag to bypass this check." fi st_shouldMakePartition=false step_runSecurityAssessments @@ -2585,12 +2596,20 @@ function exec_installImageCopy() { } function exec_installAuto() { - if [ "${st_isoInspections[isHybrid]}" == true ]; then - term_echogood "Found hybrid image; choosing Image-Copy mode." + if [ "${assumeImageIs}" == "hybrid" ]; then + term_echogood "Assumed image is hybrid; choosing Image-Copy mode." exec_installImageCopy - else - term_echoinfo "Found non-hybrid image; inspecting image for boot capabilities..." + elif [ "${assumeImageIs}" == "non-hybrid" ]; then + term_echoinfo "Assumed image is non-hybrid; inspecting image for boot capabilities" exec_installMountRsync + else + if [ "${st_isoInspections[isHybrid]}" == true ]; then + term_echogood "Found hybrid image; choosing Image-Copy mode." + exec_installImageCopy + else + term_echoinfo "Found non-hybrid image; inspecting image for boot capabilities..." + exec_installMountRsync + fi fi } diff --git a/docs/index.html b/docs/index.html index efa3b8a..07dffbc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -39,7 +39,9 @@

< [--hash-file hashfile] [--force-hash-check]] [--no-size-check] - [--no-usb-check] [--] + [--no-usb-check] + [--assume-image-is + image-type] [--] imagefile @@ -218,6 +220,14 @@

+ image-type
+
Override bootiso assessment of + imagefile hybridness. Use “hybrid” to + force bootiso regard + imagefile as hybrid, and “non-hybrid” + to force bootiso regard + imagefile as non hybrid.
--autoselect
Enable “autoselect” behavior in combination with diff --git a/extra/completions/completions.bash b/extra/completions/completions.bash index fc3771c..e73e27f 100644 --- a/extra/completions/completions.bash +++ b/extra/completions/completions.bash @@ -1,6 +1,6 @@ # bootiso - create a bootable USB drive from an image file # Copyright (C) 2018-2020 jules randolph -# +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -136,6 +136,9 @@ __bootiso_handle_files() { __bootiso_handle_opt_arg() { if [[ -n "$last_opt_arg" ]]; then case "$last_opt_arg" in + --assume-image-is) + mapfile -t COMPREPLY < <(compgen -W "hybrid non-hybrid" -- "${cur}") + ;; --dd-bs) mapfile -t COMPREPLY < <(compgen -W "32k 64k 512k 1M 2M 4M 8M" -- "${cur}") ;; @@ -199,6 +202,7 @@ __bootiso_start() { local -a action_flags=("-f,--format" "-h,--help" "-l,--list-usb-drives" "-v,--version" "-p,--probe" "-i,--inspect") local -a one_word_format_opts=("-a,--autoselect" "-y,--asume-yes") local -a two_word_format_opts=("-d,--device") + local -a two_word_install_opts=("--assume-image-is") local -a one_word_advanced_format_opts=("--gpt") local -a two_word_advanced_format_opts=("-L,--label" "-F,--fs" "--part-type") local -a one_word_inspect_opts=("--no-hash-check" "--force-hash-check" "-M,--no-mime-check") @@ -264,6 +268,7 @@ __bootiso_start() { two_word_flags=( "${two_word_inspect_opts[@]}" "${two_word_format_opts[@]}" + "${two_word_install_opts[@]}" ) if [[ "${user_vars[installmode]}" == mrsync ]]; then one_word_flags+=( @@ -280,7 +285,7 @@ __bootiso_start() { two_word_flags+=( "${one_word_icopy_install_opts[@]}" "${two_word_icopy_install_opts[@]}" - ) + ) fi ;; format) diff --git a/extra/completions/completions.zsh b/extra/completions/completions.zsh index eddb992..f3683f9 100644 --- a/extra/completions/completions.zsh +++ b/extra/completions/completions.zsh @@ -206,6 +206,7 @@ typeset _bootiso_inspect_opts=( typeset _bootiso_install_opts=( '(--mrsync --dd --icopy)'{--dd,--icopy}"[assert 'Image-Copy' install mode]" "(--dd --icopy)--mrsync[assert 'Mount-Rsync' install mode]" + "--assume-image-is[override bootiso assessment of image hybridness]:imagetype:(hybrid non-hybrid)" '(-J --no-eject)'{-J,--no-eject}"[don't eject device after unmounting]" "--no-size-check[don't assert that selected device size is larger than ]" ) diff --git a/extra/man/bootiso.1 b/extra/man/bootiso.1 index 5bcd02e..d50f6ec 100644 --- a/extra/man/bootiso.1 +++ b/extra/man/bootiso.1 @@ -48,6 +48,7 @@ one is printed. .Oc .Op Cm --no-size-check .Op Cm --no-usb-check +.Op Cm --assume-image-is Ar image-type .Op Cm -- .Ar imagefile .\" Install Image-Copy mode @@ -215,6 +216,24 @@ version then exits. .Ss Generic Modifiers Use generic modifiers knowingly as some might override default safe behaviors. .Bl -tag +.It Cm --assume-image-is Ar image-type +Override +.Nm +assessment of +.Ar imagefile +hybridness. Use +.Dq hybrid +to force +.Nm +regard +.Ar imagefile +as hybrid, and +.Dq non-hybrid +to force +.Nm +regard +.Ar imagefile +as non hybrid. .It Fl a, Cm --autoselect Enable .Dq autoselect