Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -433,17 +433,12 @@ detectCustom() {
return 0
}

getEsdFieldValue() {
getEsdField() {

local values="$1"
local list="$1"
local index="$2"

awk -F: -v index="$index" '
NR == index {
gsub(/^[ \t]+|[ \t]+$/, "", $2)
print $2
}
' <<< "$values"
sed -n "${index}p" <<< "$list" | tr -cd '0-9'

return 0
}
Expand Down Expand Up @@ -506,8 +501,8 @@ extractESD() {
totals=$(grep "Total Bytes:" <<< "$info" || true)
links=$(grep "Hard Link Bytes:" <<< "$info" || true)

bootTotal=$(getEsdFieldValue "$totals" 1)
bootLinks=$(getEsdFieldValue "$links" 1)
bootTotal=$(getEsdField "$totals" 1)
bootLinks=$(getEsdField "$links" 1)

if [[ ! "$bootTotal" =~ ^[0-9]+$ ]] || [[ ! "$bootLinks" =~ ^[0-9]+$ ]]; then
error "Cannot read bootdisk size from ESD file!"
Expand All @@ -516,8 +511,8 @@ extractESD() {

bootSize=$(( bootTotal - bootLinks ))

wimTotal=$(getEsdFieldValue "$totals" 3)
wimLinks=$(getEsdFieldValue "$links" 3)
wimTotal=$(getEsdField "$totals" 3)
wimLinks=$(getEsdField "$links" 3)

if [[ ! "$wimTotal" =~ ^[0-9]+$ ]] || [[ ! "$wimLinks" =~ ^[0-9]+$ ]]; then
error "Cannot read boot.wim size from ESD file!"
Expand Down