diff --git a/bootiso b/bootiso index 2013af4..3b97c0c 100755 --- a/bootiso +++ b/bootiso @@ -2,7 +2,7 @@ # shellcheck disable=SC2181 # shellcheck disable=SC2236 # -# Version 4.1.1 +# Version 4.2.0 # # bootiso - create a bootable USB drive from an image file # Copyright (C) 2018-2020 jules randolph @@ -26,7 +26,7 @@ set -o pipefail set -E -version="4.1.1" +version="4.2.0" scriptName=$(basename "$0") bashVersion=$(echo "$BASH_VERSION" | cut -d. -f1) @@ -309,7 +309,7 @@ function term_printLog() { function term_indentAll() { while read -r line; do term_printColumn " " "$term_logPrefixLength" "$line" - done < "${1:-/dev/stdin}" + done <"${1:-/dev/stdin}" } # $*: The message to print. @@ -480,7 +480,7 @@ function fs_mountUSB() { st_usbMountPoint=$(fs_createMountFolder usb) || exit "$?" st_temporaryAssets+=("$st_usbMountPoint") term_echoinfo "Created USB device mount point at '$st_usbMountPoint'" - if ! mount -t "$_type" "$st_targetPartition" "$st_usbMountPoint" > /dev/null; then + if ! mount -t "$_type" "$st_targetPartition" "$st_usbMountPoint" >/dev/null; then ps_failAndExit IO_ERROR "Could not mount USB device." fi } @@ -488,7 +488,7 @@ function fs_mountUSB() { # $1 - mountPoint function fs_mountElToritoFile() { local -r _mountPoint="$1" - if ! mount -r -o loop -- "$sourceImageFile" "$_mountPoint" > /dev/null; then + if ! mount -r -o loop -- "$sourceImageFile" "$_mountPoint" >/dev/null; then ps_failAndExit IO_ERROR "Could not mount image file." else st_temporaryAssets+=("$_mountPoint") @@ -587,7 +587,7 @@ function fs_syncWithProgress() { # $1 - The name of the command to check in $PATH. function sys_hasCommand() { - command -v "$1" &> /dev/null + command -v "$1" &>/dev/null return $? } @@ -928,7 +928,7 @@ function asrt_checkSudo() { if [[ -t 1 ]] && sys_hasCommand sudo; then sudo --preserve-env "$0" "$@" elif sys_hasCommand gksu; then - exec 1> output_file + exec 1>output_file gksu --preserve-env "$0" "$@" else ps_failAndExit MISSING_PRIVILEGE "You must run $scriptName as root." @@ -975,14 +975,14 @@ function asrt_checkImageHash() { printf "%s" \ "You can disable this check with $(term_boldify "-H, --no-hash-check") flags." | term_indentAll st_temporaryAssets+=("$_hashStoreFile") - ( + ( local _hash local -i _hash=$($_hashName "$_imageName" | awk "{print \$1; exit }") if (($? == 0)); then - printf "%s" "$_hash" > "$_hashStoreFile" + printf "%s" "$_hash" >"$_hashStoreFile" else - printf "%s" 1 > "$_hashStoreFile" + printf "%s" 1 >"$_hashStoreFile" fi ) & st_backgroundProcess=$! @@ -1083,11 +1083,11 @@ function asrt_checkPackages() { sys_checkCommand "$_pkg" done # test grep supports -P option - if ! echo 1 | grep -P '1' &> /dev/null; then + if ! echo 1 | grep -P '1' &>/dev/null; then ps_failAndExit MISSING_DEPENDENCY \ "You're using an old version of grep which does not support perl regular expression (-P option)." fi - if echo "" | column -t -N t -W t &> /dev/null; then + if echo "" | column -t -N t -W t &>/dev/null; then st_hasLegacyColumn=false else # Old BSD command, see https://git.io/JfauE @@ -1174,7 +1174,7 @@ function asrt_checkFSType() { ps_failAndExit SYNOPSIS_NONCOMPL "Filesystem type '$_fsType' not supported." \ "Supported filesystem types: $(sh_joinBy "," "${asrt_supportedFS[*]}")." fi - if ! command -v "mkfs.$_fsType" &> /dev/null; then + if ! command -v "mkfs.$_fsType" &>/dev/null; then ps_failAndExit MISSING_DEPENDENCY \ "Program 'mkfs.$_fsType' could not be found on your system." \ "Please install it and retry." @@ -1377,7 +1377,7 @@ function devi_configureLabel() { # Fallback to "USER_VENDOR" if format if [[ "$targetAction" == format ]]; then _user=${SUDO_USER:-$USER} - _vendor=$(lsblk -ldno VENDOR "$targetDevice" 2> /dev/null) + _vendor=$(lsblk -ldno VENDOR "$targetDevice" 2>/dev/null) _vendor=${_vendor:-FLASH} targetPartitionLabel=${targetPartitionLabel:-"${_user^^}_${_vendor^^}"} else @@ -1530,7 +1530,7 @@ function devi_partitionUSB() { # unmount any partition on selected device mapfile -t devicePartitions < <(grep -oP "^\\K$targetDevice\\S*" /proc/mounts) for _partition in "${devicePartitions[@]}"; do - if ! umount "$_partition" > /dev/null; then + if ! umount "$_partition" >/dev/null; then ps_failAndExit IO_ERROR \ "Failed to unmount $_partition. It's likely that the partition is busy." fi @@ -1539,7 +1539,7 @@ function devi_partitionUSB() { function _eraseDevice() { term_echoinfo "Erasing contents of '$targetDevice'..." # clean signature from selected device - wipefs --all --force "$targetDevice" &> /dev/null + wipefs --all --force "$targetDevice" &>/dev/null # erase drive dd if=/dev/zero of="$targetDevice" bs=512 count=1 conv=notrunc status=none |& term_indentAll || @@ -1773,8 +1773,8 @@ function devi_inspectHybridImage() { _supportsEFIBoot=false fi } - _diskReport=$(sfdisk -lJ -- "$sourceImageFile" 2> /dev/null) \ - || ps_failAndExit IO_ERROR "sfdisk couldn't read the partition table on the image file, which is likely corrupted." + _diskReport=$(sfdisk -lJ -- "$sourceImageFile" 2>/dev/null) || + ps_failAndExit IO_ERROR "sfdisk couldn't read the partition table on the image file, which is likely corrupted." _partScheme=$(echo "$_diskReport" | jq -r '.partitiontable.label') case $_partScheme in dos) _inspectMBRPartTable ;; @@ -1850,11 +1850,11 @@ function step_initDevicesList() { function step_inspectImageFile() { local _isHybrid function _inspectImageFilesystem() { - file -b -- "$sourceImageFile" | grep -q '^ISO 9660 CD-ROM filesystem' + sfdisk -J -- "$sourceImageFile" | jq -e .partitiontable.label &>/dev/null if (($? == 0)); then - _isHybrid=false - else _isHybrid=true + else + _isHybrid=false fi } _inspectImageFilesystem @@ -1905,7 +1905,7 @@ function step_installBootloader() { fi fi term_echoinfo "Found local SYSLINUX version '$_localSyslinuxVersion'" - sh_compute "$_localSyslinuxVersion == ${st_isoInspections[syslinuxVer]}" > /dev/null + sh_compute "$_localSyslinuxVersion == ${st_isoInspections[syslinuxVer]}" >/dev/null _versionsMatch=$? if ((_versionsMatch == 0)); then term_echogood "image SYSLINUX version matches local version." @@ -1951,7 +1951,7 @@ function step_installBootloader() { function _installWtKernelOrgExtlinux() { local _isExt32 _isHost32 _fallbackToLocal=false term_echoinfo "Installing SYSLINUX bootloader in '$_syslinuxFolder' with kernel.org version '$st_targetSyslinuxVersion'..." - file -b -- "${st_syslinuxBinaries['extBin']}" | awk '{print $2}' | grep -e '^32' &> /dev/null + file -b -- "${st_syslinuxBinaries['extBin']}" | awk '{print $2}' | grep -e '^32' &>/dev/null _isExt32=$? echo "$ct_architecture" | grep -e '32|i386' _isHost32=$? @@ -1975,7 +1975,7 @@ function step_installBootloader() { fi fi if [[ "$_fallbackToLocal" == true ]]; then - _installWtLocalExtlinux > /dev/null + _installWtLocalExtlinux >/dev/null fi fs_syncdev } @@ -2015,7 +2015,7 @@ function step_copyWithRsync() { term_echowarn "Detected a Windows install.wim file but wimsplit has been disabled with $(term_boldify '--no-wim-split') option." fi fi - ( + ( # shellcheck disable=SC2086 rsync -r -q -I --no-links --no-perms --no-owner --no-group $_rsyncOptions "$st_elToritoMountPoint"/. "$st_usbMountPoint" _status=$? @@ -2024,7 +2024,7 @@ function step_copyWithRsync() { echo wimlib-imagex split "$_wimFile" "$st_usbMountPoint/sources/install.swm" 1024 |& term_indentAll fi - echo "$_status" > "$_statusFile" + echo "$_status" >"$_statusFile" ) & st_backgroundProcess=$! echo -n "$scriptName: Copying files from image to USB device with 'rsync' " @@ -2050,9 +2050,9 @@ function step_copyWithDD() { local _status _statusFile=$(fs_createTempFile "bootiso-status") st_temporaryAssets+=("$_statusFile") - ( + ( dd if="$sourceImageFile" of="$targetDevice" bs="$targetDDBusSize" status=none - echo "$?" > "$_statusFile" + echo "$?" >"$_statusFile" ) & st_backgroundProcess=$! echo -n "$scriptName: Copying files from image to USB device with 'dd' " diff --git a/changelog.md b/changelog.md index fcabbbe..2df7c41 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -# v4.1.1 +# v4.2.0 **Enhancements** diff --git a/docs/index.html b/docs/index.html index a9d34ff..efa3b8a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -677,7 +677,7 @@

May 22, 2020 - bootiso 4.1.1 + bootiso 4.2.0 diff --git a/extra/man/bootiso.1 b/extra/man/bootiso.1 index bd52604..5bcd02e 100644 --- a/extra/man/bootiso.1 +++ b/extra/man/bootiso.1 @@ -14,7 +14,7 @@ . .Dd May 22, 2020 .Dt BOOTISO 1 -.Os bootiso 4.1.1 +.Os bootiso 4.2.0 .Sh NAME .Nm bootiso .Nd create a bootable USB drive from an image file