diff --git a/main.go b/main.go index 6c657b6..ac1f8b8 100644 --- a/main.go +++ b/main.go @@ -287,20 +287,24 @@ func unlockAll() error { } block, err := ghw.Block() - if err == nil { - for _, disk := range block.Disks { - for _, p := range disk.Partitions { - if p.Type == "crypto_LUKS" { - if partitionInfo != nil { - p.Label = partitionInfo.LookupLabelForUUID(p.UUID) - } - fmt.Printf("Unmounted Luks found at '%s' LABEL '%s' \n", p.Name, p.Label) - err = multierror.Append(err, unlockDisk(p)) - if err != nil { - fmt.Printf("Unlocking failed: '%s'\n", err.Error()) - } - time.Sleep(10 * time.Second) + if err != nil { + fmt.Printf("Warning: Error reading partitions '%s \n", err.Error()) + + return nil + } + + for _, disk := range block.Disks { + for _, p := range disk.Partitions { + if p.Type == "crypto_LUKS" { + if partitionInfo != nil { + p.Label = partitionInfo.LookupLabelForUUID(p.UUID) } + fmt.Printf("Unmounted Luks found at '%s' LABEL '%s' \n", p.Name, p.Label) + err = multierror.Append(err, unlockDisk(p)) + if err != nil { + fmt.Printf("Unlocking failed: '%s'\n", err.Error()) + } + time.Sleep(10 * time.Second) } } }