Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
v3.1.1
Browse files Browse the repository at this point in the history
fix #18, adding compatibility code for sfdisk versions < 2.28
  • Loading branch information
jsamr committed Jul 14, 2018
1 parent e1100ab commit 70803da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
37 changes: 23 additions & 14 deletions bootiso
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Author: jules randolph <jules.sam.randolph@gmail.com> https://github.com/jsamr
# License: MIT
# Version 3.1.0
# Version 3.1.1

set -o pipefail
set -E
Expand Down Expand Up @@ -52,7 +52,7 @@ typeset -Ar userFlagsCompatibilityMatrix=(
)

# internal variables
typeset version="3.1.0"
typeset version="3.1.1"
typeset ticketsurl="https://github.com/jsamr/bootiso/issues"
typeset mountRoot=/mnt
typeset tempRoot=/var/tmp/bootiso
Expand Down Expand Up @@ -185,7 +185,7 @@ OPTION FLAGS
Applicable to [install-mount-rsync] and [format] actions.
-L, --label <label> Set partition label as \`<label>' instead of inferring.
Applicable to [install-mount-rsync] and [format] actions. $scriptName
will cut labels which are too long regarding the selected filesystem
will cut labels which are too long regarding the selected filesystem
limitations.
--no-usb-check $scriptName won't assert that selected device is connected
through USB bus. $(redify 'Use at your own risks.')
Expand Down Expand Up @@ -244,6 +244,15 @@ failAndExit() {
exit 1
}

compute() {
answer=$(echo "$@" | bc)
if ((answer == 0)); then
return 1
else
return 0
fi
}

# $1: The name of the command to check against $PATH.
hasPackage() {
command -v "$1" &>/dev/null
Expand Down Expand Up @@ -820,16 +829,25 @@ shouldWipeUSBKey() {
}

createMBRPartitionTable() {
typeset sfdiskCommand='sfdisk'
typeset sfdiskVersion=$(sfdisk -v | grep -Po '\d+\.\d+')
typeset -Ar mbrTypeCodes=(['vfat']='c' ['exfat']='7' ['ntfs']='7' ['ext2']='83' ['ext3']='83' ['ext4']='83' ['f2fs']='83')
typeset partitionOptions
makeSfdiskCommand() {
# Retrocompatibility for 'old' sfdisk versions
if compute "$sfdiskVersion >= 2.28"; then
sfdiskCommand='sfdisk -W always'
fi
}
makeSfdiskCommand
if [ "$notBootable" == true ]; then
partitionOptions="$selectedPartition : start=2048, type=${mbrTypeCodes[$partitionType]}"
else
partitionOptions="$selectedPartition : start=2048, type=${mbrTypeCodes[$partitionType]}, bootable"
fi
echogood "Creating MBR partition table with \`sfdisk'..."
echogood "Creating MBR partition table with \`sfdisk' v$sfdiskVersion..."
# Create partition table
echo "$partitionOptions" | sfdisk -W always "$selectedDevice" |& indentAll || failAndExit "Failed to write USB device partition table."
echo "$partitionOptions" | $sfdiskCommand "$selectedDevice" |& indentAll || failAndExit "Failed to write USB device partition table."
partprobe "$selectedDevice" # Refresh partition table
sync
}
Expand Down Expand Up @@ -1076,15 +1094,6 @@ installSyslinuxVersion() {
echogood "SYSLINUX version \`$minor' temporarily set for installation."
}

compute() {
answer=$(echo "$@" | bc)
if ((answer == 0)); then
return 1
else
return 0
fi
}

installBootloader() {
typeset syslinuxFolder
typeset syslinuxConfig
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v3.1.1

- add compatibility code for `sfdisk` versions older then 2.28 which don't support `-W` option

# v3.1.0

- fixed a bug with `--local-bootloader` where C32 BIOS modules were not copied on USB key
Expand Down

0 comments on commit 70803da

Please sign in to comment.