summaryrefslogtreecommitdiffstats
path: root/textw/lilo_text.py
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2000-06-28 17:02:03 +0000
committerMike Fulbright <msf@redhat.com>2000-06-28 17:02:03 +0000
commit537bf5f32ced4b767f5b92b195a4528b2e8974b2 (patch)
tree6292af59b56464c0445ad54db5877cdb0dc9021f /textw/lilo_text.py
parentec14764b6ad0651d879421660edf5801483893e8 (diff)
downloadanaconda-537bf5f32ced4b767f5b92b195a4528b2e8974b2.tar.gz
anaconda-537bf5f32ced4b767f5b92b195a4528b2e8974b2.tar.xz
anaconda-537bf5f32ced4b767f5b92b195a4528b2e8974b2.zip
fixed to allow empty labels for non-root partition and also to prevent some bad chars from getting into label
Diffstat (limited to 'textw/lilo_text.py')
-rw-r--r--textw/lilo_text.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/textw/lilo_text.py b/textw/lilo_text.py
index 8acd844fc..6d4862727 100644
--- a/textw/lilo_text.py
+++ b/textw/lilo_text.py
@@ -97,7 +97,18 @@ class LiloWindow:
return INSTALL_OK
class LiloImagesWindow:
- def editItem(self, screen, partition, itemLabel):
+ def validLiloLabel(self, label):
+ i=0
+ while i < len(label):
+ cur = label[i]
+ if cur == ' ' or cur == '#' or cur == '$' or cur == '=':
+ return 0
+ i = i + 1
+
+ return 1
+
+
+ def editItem(self, screen, partition, itemLabel, allowNone=0):
devLabel = Label(_("Device") + ":")
bootLabel = Label(_("Boot label") + ":")
device = Label("/dev/" + partition)
@@ -129,17 +140,15 @@ class LiloImagesWindow:
elif (result == "clear"):
newLabel.set("")
elif (result == "ok" or result == "F12" or result == newLabel):
- import regex
-
- if not newLabel.value():
+ if not allowNone and not newLabel.value():
rc = ButtonChoiceWindow (screen, _("Invalid Boot Label"),
_("Boot label may not be empty."),
[ _("OK") ])
result = ""
- elif (regex.search (" ", newLabel.value()) != -1):
+ elif not self.validLiloLabel(newLabel.value()):
rc = ButtonChoiceWindow (screen, _("Invalid Boot Label"),
- _("Boot labels cannot contain "
- "space(s)."),
+ _("Boot label contains "
+ "illegal characters."),
[ _("OK") ])
result = ""
@@ -210,6 +219,7 @@ class LiloImagesWindow:
g.addHotKey(" ")
result = None
+ (rootdev, rootfs) = todo.fstab.getRootDevice()
while (result != "ok" and result != "back" and result != "F12"):
result = g.run()
if (buttons.buttonPressed(result)):
@@ -218,7 +228,7 @@ class LiloImagesWindow:
if (result == string.lower(_("Edit")) or result == listbox):
item = listbox.current()
(label, type) = images[item]
- label = self.editItem(screen, item, label)
+ label = self.editItem(screen, item, label, allowNone = (rootdev != item))
images[item] = (label, type)
if (default == item and not label):
default = ""