Skip to content

Commit

Permalink
Add legacy BIOS warning
Browse files Browse the repository at this point in the history
Signed-off-by: Mark D Horn <[email protected]>
  • Loading branch information
mdhorn committed Feb 27, 2020
1 parent 52de059 commit ec6d983
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gui/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ func (window *Window) confirmInstall() {
}
}

medias := storage.GetPlannedMediaChanges(window.model.InstallSelected, window.model.TargetMedias)
medias := storage.GetPlannedMediaChanges(window.model.InstallSelected, window.model.TargetMedias, window.model.LegacyBios)
for _, media := range medias {
log.Debug("MediaChange: %s", media)
buffer.Insert(buffer.GetEndIter(), media+"\n")
Expand Down
3 changes: 3 additions & 0 deletions locale/en_US/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ msgstr "Selected media will be partitioned."
msgid "Selected media will have partitions added."
msgstr "Selected media will have partitions added."

msgid "WARNING: Booting set for legacy BIOS mode."
msgstr "WARNING: Booting set for legacy BIOS mode."

msgid "WARNING: New Partition table will be created."
msgstr "WARNING: New Partition table will be created."

Expand Down
3 changes: 3 additions & 0 deletions locale/es_MX/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ msgstr "Los medios seleccionados se dividirán en particiones."
msgid "Selected media will have partitions added."
msgstr "Se añadirán particiones a los medios seleccionados."

msgid "WARNING: Booting set for legacy BIOS mode."
msgstr "ADVERTENCIA: arranque para el modo BIOS heredado."

msgid "WARNING: New Partition table will be created."
msgstr "ADVERTENCIA: se creará una nueva tabla de particiones."

Expand Down
3 changes: 3 additions & 0 deletions locale/zh_CN/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ msgstr "将对选定的媒介进行分区。"
msgid "Selected media will have partitions added."
msgstr "选定的媒介将添加分区。"

msgid "WARNING: Booting set for legacy BIOS mode."
msgstr "警告:启动设置为传统 BIOS 模式。"

msgid "WARNING: New Partition table will be created."
msgstr "警告: 将创建新的分区表。"

Expand Down
7 changes: 5 additions & 2 deletions storage/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ func (bd *BlockDevice) WritePartitionTable(legacyBios bool, wholeDisk bool, dryR

//write the partition label
if dryRun != nil {
if legacyBios {
*dryRun = append(*dryRun, bd.Name+": "+utils.Locale.Get(LegacyModeWarning))
}
if wholeDisk {
*dryRun = append(*dryRun, bd.Name+": "+utils.Locale.Get(PartitioningWarning))
}
Expand Down Expand Up @@ -1935,7 +1938,7 @@ func getPlannedPartitionChanges(media *BlockDevice) []string {

// GetPlannedMediaChanges returns an array of strings with all of
// disk and partition planned changes to advise the user before start
func GetPlannedMediaChanges(targets map[string]InstallTarget, medias []*BlockDevice) []string {
func GetPlannedMediaChanges(targets map[string]InstallTarget, medias []*BlockDevice, legacyBios bool) []string {
results := []string{}

if len(targets) != len(medias) {
Expand Down Expand Up @@ -1963,7 +1966,7 @@ func GetPlannedMediaChanges(targets map[string]InstallTarget, medias []*BlockDev

for _, curr := range medias {
if target.Name == curr.Name {
if err := curr.WritePartitionTable(false, target.WholeDisk, &results); err != nil {
if err := curr.WritePartitionTable(legacyBios, target.WholeDisk, &results); err != nil {
results = append(results, FailedPartitionWarning)
}
if partChanges := getPlannedPartitionChanges(curr); len(partChanges) > 0 {
Expand Down
3 changes: 3 additions & 0 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ const (
// MediaToBeUsed identified a disk which will be used during the installation
MediaToBeUsed = "Selected media will be used for installation."

// LegacyModeWarning specifies the warning message we are using legacy bios mode
LegacyModeWarning = "WARNING: Booting set for legacy BIOS mode."

// PartitioningWarning specifies the warning message for writing partition table
PartitioningWarning = "WARNING: New Partition table will be created."

Expand Down
2 changes: 1 addition & 1 deletion tui/confirm_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func initConfirmDiaglogWindow(dialog *ConfirmInstallDialog) error {
dialog.mediaDetail.SetWordWrap(true)
dialog.mediaDetail.SetStyle("AltEdit")

medias := storage.GetPlannedMediaChanges(dialog.modelSI.InstallSelected, dialog.modelSI.TargetMedias)
medias := storage.GetPlannedMediaChanges(dialog.modelSI.InstallSelected, dialog.modelSI.TargetMedias, dialog.modelSI.LegacyBios)
for _, media := range medias {
log.Debug("MediaChange: %s", media)
}
Expand Down

0 comments on commit ec6d983

Please sign in to comment.