Merge pull request #9 from FOGProject/revert-8-revert-7-master

Revert "Revert "Fix some regex patterns and logic for setting UUID partition type info""
This commit is contained in:
Tom Elliott
2018-02-19 02:59:30 -05:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -807,6 +807,7 @@ makeAllSwapSystems() {
[[ -z $imgPartitionType ]] && handleError "No image partition type passed (${FUNCNAME[0]})\n Args Passed: $*"
local swapuuidfilename=""
swapUUIDFileName "$imagePath" "$disk_number"
[[ -r "$swapuuidfilename" ]] || return
local parts=""
local part=""
local part_number=0

View File

@@ -85,10 +85,10 @@ restoreUUIDInformation() {
for part in $parts; do
partitionIsSwap "$part"
getPartitionNumber "$part"
local escape_part=$(escapeItem $part)
[[ $is_swap -gt 0 ]] && continue
pat="/^.*\/dev\/[A-Za-z0-9]+([Pp]|)[$part_number].*"
partuuid=$(awk -F[,\ ] "match(\$0, ${pat}uuid=([A-Za-z0-9-]+)[,]?.*$/, type){printf(\"%s:%s\", $part_number, tolower(type[2]))}" $sfdiskoriginalpartitionfilename)
parttype=$(awk -F[,\ ] "match(\$0, ${pat}type=([A-Za-z0-9-]+)[,]?.*$/, type){printf(\"%s:%s\", $part_number, tolower(type[2]))}" $sfdiskoriginalpartitionfilename)
partuuid=$(awk -F[,\ ] "match(\$0, /^${escape_part} : .*uuid=([A-Za-z0-9-]+)[,]?.*$/, type){printf(\"%s:%s\", $part_number, tolower(type[1]))}" $sfdiskoriginalpartitionfilename)
parttype=$(awk -F[,\ ] "match(\$0, /^${escape_part} : .*type=([A-Za-z0-9-]+)[,]?.*$/, type){printf(\"%s:%s\", $part_number, tolower(type[1]))}" $sfdiskoriginalpartitionfilename)
dots "Partition type being set to"
echo $parttype
debugPause
@@ -354,8 +354,7 @@ makeSwapSystem() {
local part_number=""
local escape_part=$(escapeItem $part)
getPartitionNumber "$part"
local pat="/^\/dev\/[A-Za-z0-9]+([Pp]|)[$part_number]\ /"
local uuid=$(awk "$pat{print \$2}" $file)
local uuid=$(awk "/^${escape_part} /{print \$2}" $file)
local hasgpt=0
hasGPT "$disk"
case $hasgpt in